print l("Hello"); # "Hallo"
print ln("You have %d message","You have %d messages",4); # 'Du hast 4 Nachrichten'
ln("You have %d message","You have %d messages",4);
Sample PO file, in this case data/locale/test.po
"Content-Type: text/plain; charset=UTF-8\n"
"Plural-Forms: nplurals=2; plural=n != 1;"
msgid "You have %d message"
msgid_plural "You have %d messages"
msgstr "Du hast %d Nachricht"
msgstr "Du hast %d Nachrichten"
This is a small wrapper around Gettext functionality that integrates sprintf and makes it a bit more easy to setup the internationalization. It ONLY supports UTF8 data, and in or output, that is a fixed setup (and always will be).
Gettext in Perl requires compiled po files, so called mo files. You can generate those with the following command (if you have gettext in general installed on your system):
msgfmt -o data/locale/test.mo data/locale/test.po
echo -n "locale_data['test'] = " >data/locale/test.json
po2json data/locale/test.po >>data/locale/test.json
echo ";" >>data/locale/test.json
Pull request and additional contributors are welcome
Torsten Raudssus <email@example.com>
This software is copyright (c) 2012 by DuckDuckGo, Inc. http://duckduckgo.com/, Torsten Raudssus <firstname.lastname@example.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Locale::Simple, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.