pretty simple library.
-
A languages directory and desired language will be inputed into the
init_lang
function. -
All directories within languages directory are treated as individual languages.
-
Each languages is compared with desired language using the
language_matches_score
function. -
A score-sorted list is then passed to FluentBundle.
-
Languages of the same type are sorted alphabetically. For example, given the desired language
en
, the available languages areen_US
anden_GB
, the chosen language would be en_GB (due to string order).
Example of directory structure:
- i18n/fluent:
- en_US
- lang.ftl
- pl
- lang.ftl