Idiom.Local (idiom v0.4.1)
Local source for Idiom.
Idiom is backend-agnostic and can be used with many different sources. By default, it also loads resources from the local filesystem at boot time. This can be turned off in configuration, but it is highly recommended to have it as a fallback in case your chosen backend is unavailable.
Directory structure
You can set the data directory changing the :data_dir
setting Idiom.Local
will use as such:
config :idiom, data_dir: "priv/idiom"
Inside that directory, the structure should be as follows:
priv/idiom
└── en
├── default.json
└── login.json
Where en
is the target locale and default
and login
are namespaces.
File format
The json
files expected by Idiom.Local
are a subset of the i18next format. The following example shows all of
its features that Idiom currently supports.
{
"key": "value",
"keyDeep": {
"inner": "value"
},
"keyInterpolate": "replace this {{value}}",
"keyPluralSimple_one": "the singular",
"keyPluralSimple_other": "the plural",
"keyPluralMultipleEgArabic_zero": "the plural form 0",
"keyPluralMultipleEgArabic_one": "the plural form 1",
"keyPluralMultipleEgArabic_two": "the plural form 2",
"keyPluralMultipleEgArabic_few": "the plural form 3",
"keyPluralMultipleEgArabic_many": "the plural form 4",
"keyPluralMultipleEgArabic_other": "the plural form 5",
}
Summary
Functions
Parses all local data.
Functions
Link to this function
data(opts \\ [])
Parses all local data.