Locale::MakePhrase::BackingStore::File - Retrieve language translations for all supported languages, from a single file.
This backing store is capable of loading language rules from a single translation file.
The file must be formatted as shown in the example.txt file (which can be located in the same directories that these modules are are installed in). The important points to note are that the file is broken into groups containing:
Where expression & priority are optional. However, if you specify the priority and/or expression, make sure the translation key is the last entry in the group - this is necessary, as we dont know when the the block is finished.
The following methods are implemented:
We support loading text/translations (from the translation file) which may be encoded using any character encoding. Since we need to know something about the file we are trying to load, we expect this object to be constructed with the following options:
file
The full path to the file containing the translations. eg:
/usr/local/myapp/translations.mpt
Default: none; you must specify a filename
encoding
We can load translations from any enocding supported by the Encode module. Upon load, this module will convert the translations from the specified encoding, into the interal encoding of UTF-8.
Default: load UTF-8 encoded text translations.
reload
It is handy for the language module to be able to dynamically reload its known translations, if the file gets updated. You can set this to avoid reloading the file if it changes.
Default: reload if file changes
Retrieve the translations (that have been previously loaded), using the selected languages. This implementation will reload the language file if it changes (unless it has been told not to).
We automatically handle the Unix/MS-DOS line-ending difference.
Strings can be spanned over multiple lines, if the end of the line is backslash-escaped.
To install Locale::MakePhrase, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Locale::MakePhrase
CPAN shell
perl -MCPAN -e shell install Locale::MakePhrase
For more information on module installation, please visit the detailed CPAN module installation guide.