Module reahl.component.i18n¶
Catalogue¶
-
class
reahl.component.i18n.
Catalogue
(domain)¶ Create an instance of this class at the top of your module, in module scope and assign it to the name _ for use in translating literal strings to the language of the current locale.
Note
Don’t ever .call an instance of Catalogue in module scope. It only works once the locale is known.
- Parameters
domain – A name identifying which translation catalogue use with this Catalogue. Always set this to the name of the component where the code resides where this Catalogue instance is instantiated.
Changed in version 4.0: Renamed to Catalogue (previously Translator)
-
gettext
(message)¶ Returns a str literal containing a translation of message to the correct language according to the current locale.
-
ngettext
(message_singular, message_plural, n)¶ Returns a str literal containing a translation of the given messages in the correct plural (or singular) form of the target language for n items.
-
property
current_locale
¶ Returns a string identifying the current locale to be used for the interface.