struct Gettext::MOBackend
- Gettext::MOBackend
- Struct
- Value
- Object
Overview
The backend for Gettext's MO files. This class contains methods to parse and interact with them.
Similar to the Gettext module from Python, feel free to subclass and override the #parse
method
to create a backend for other .mo files. However, please consider opening a PR and adding it directly
to lens instead!
Defined in:
backend/gettext/mo/backend.crConstant Summary
-
BE_MAGIC =
3725722773_i64
-
LE_MAGIC =
2500072158_i64
Constructors
-
.new(locale_directory_path : String)
Create a new MO backend instance that reads from the given locale directory path
Instance Method Summary
-
#create : Hash(String, Catalogue)
Create message catalogue from the loaded locale files.
-
#parse : Hash(String, Catalogue)
Parse gettext mo files into message catalogues.
Constructor Detail
Create a new MO backend instance that reads from the given locale directory path
Gettext::MOBackend.new("locales")
Instance Method Detail
Create message catalogue from the loaded locale files.
This is the equivalent to #parse
and is only here for compatibility with Gettext::POBackend
This is returned as a mapping of the language code to the catalogue
in which the language code is taken from the Language
header. If
none can be found then the mo file name is used as a fallback.
backend = Gettext::MOBackend.new("locales")
backend.create # => Hash(String, Catalogue)
Parse gettext mo files into message catalogues.
This is returned as a mapping of the language code to the catalogue
in which the language code is taken from the Language
header. If
none can be found then the mo file name is used as a fallback.
backend = Gettext::MOBackend.new("locales")
backend.parse # => Hash(String, Catalogue)