Optional attribute categories.
Collect a list of available *.mo files.
Returns the language code for the current language.
Returns the language code for the translation contained in moFile.
Switch to the language contained in moFile.
Code to be mixed in at the top of your main() function.
Represents a translatable string.
Internationalization compatible with GNU gettext.
Insert the following line at the top of your main function:
Translatable strings are marked by instantiating the tr template, like so:
A translation may require a particular plural form depending on a number. This can be achieved by supplying both singular and plural forms as compile time arguments, and the number as a runtime argument.
Plural forms can be used in format strings, but the argument that determines the form must be supplied to tr and not to format. The corresponding format specifier will not be seen by format as it will have been replaced with a string by tr:
The format specifier that selects the form is the last specifier in the format string (here %d). In many sentences, however, the specifier that should select the form cannot be the last. In these cases, format specifiers must be given a position argument, where the highest position determines the form:
Again, the specifier with the highest position argument will never be seen by format.
Two identical strings that have different meanings dependent on context may need to be translated differently. Dis can be accomplished by disambiguating the string with a context argument. It is also possible to attach a comment that will be seen by the translator:
If you'd rather use an underscore to mark translatable strings, as the GNU gettext documentation suggests, you can use an alias: