[Koha-bugs] [Bug 15395] Internationalization: plural forms, context, and more
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Mon Feb 19 14:47:32 CET 2018
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395
Julian Maurice <julian.maurice at biblibre.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #62326|0 |1
is obsolete| |
--- Comment #62 from Julian Maurice <julian.maurice at biblibre.com> ---
Created attachment 71940
-->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=71940&action=edit
Bug 15395: Allow correct handling of plural translation
Locale::Maketext does not allow correct handling of plural translation
for languages that have more than one plural forms.
Locale::Messages does.
So Koha::I18N is now a wrapper around Locale::Messages, just like
Locale::TextDomain, and export the same symbols as Locale::TextDomain.
You can refer to documentation of Locale::TextDomain to know how to use
exported subroutines.
The PO file moves from misc/translator/po/xx-XX-messages.po to
misc/translator/po/xx_XX/LC_MESSAGES/Koha.po and now needs to be
compiled to MO in order to be used by Koha.
Compilation of PO file is done by running:
./translate install xx-XX
Remove dependency to Locale::Maketext and Locale::Maketext::Lexicon
Add dependency to Locale::Messages
Test plan:
1. Open a .pl script or .pm module with your favorite text editor
2. Add 'use Koha::I18N;' in the beginning of file
3. Use one of the subroutines exported by Koha::I18N and be sure to have
a way to visualize the result (pass result to the template for
example, or simply warn and watch the log file)
4. cd misc/translator && ./translate update fr-FR # try other languages
5. Open misc/translator/po/fr_FR/LC_MESSAGES/Koha.po and translate your
string(s)
You will need to change the "Plural-Forms" header. See
https://localization-guide.readthedocs.org/en/latest/l10n/pluralforms.html
6. ./translate install fr-FR
7. Use your web browser to go to the page that should display the
translation, change language and verify the translation is correct
Example usage:
__("Hi")
__x("Hi {name}", name => 'Bob')
__n("item", "items", $num_items)
__nx("one item", "{count} items", $num_items, count => $num_items)
__p("Bibliographic record", "item")
Signed-off-by: Marc Véron <veron at veron.ch>
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list