https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21156
--- Comment #3 from Julian Maurice <[email protected]> --- (In reply to Katrin Fischer from comment #2) > 1. Add a translatable string in a JS file. For example, add this: > alert(__nx("There is one item", "There are {count} items", 3, > {count: 3})); > > It looks like we already have a way of doing this with the format() syntax. Variable substitution works the same way as format() but allows to give names to substitutions, to ease the work of translators (ex: "I like {food} and {drink}" is easier to read and translate than "I like %s and %s") > How would plural translation work? Can you give examples for context and > plurals? For plural translation, gettext will select the correct string based on the integer parameter (the 3rd for __n and __nx, the 4th for __np and __npx) and the Plural-Forms header in the PO file For instance, var count = <a positive integer> __n('item', 'items', count) In English, __n will return 'item' if count == 1, 'items' otherwise In French, __n will return 'exemplaire' if count == 0 or count == 1, 'exemplaires' otherwise, because Plural-Forms is "nplurals=2; plural=(n > 1); In Slovenian, __n can return up to 4 different strings, because Slovenian has 4 different "plural forms" The context is just another string to help disambiguation. Ex: __p('Bibliographic record', 'item') This will appear in the po file as msgctxt "Bibliographic record" msgid "item" And you can combine context and plural forms __np('Bibliographic record', 'item', 'items', count) -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
