0.3.0 • Published 3 years ago
@thatdev/lib-i18n v0.3.0
@thatdev/lib-i18n
Configuration
- uri - the URI endpoint used for loading languages (defaults to /assets/nls)
- language - the I18nLanguage to use as default (defaults to EN)
I18n Language Files
Assumes that i18n language files are available at the URI provided :-
/assets/nls/en.jsonThese should be a standard i18n JSON, such as :-
{
"my-i18n-key": "Some sort of text",
"my-other-i18n-key": "Some sort of text with {{value}}",
}Usage
Wrap your React app with the provider
<I18nProvider>
...
</I18nProvider>and then use the hook inside your components
function MyComponent() {
const i18n = useI18n()
console.log(i18n.lower('my-i18n-key'))
// Some sort of text
console.log(i18n.lower('my-other-i18n-key', {
value: "something"
}))
// Some sort of text with something
}0.3.0
3 years ago
0.3.0-staging.0
3 years ago
0.3.0-staging.1
3 years ago
0.2.7-staging.12
4 years ago
0.2.7-staging.11
4 years ago
0.2.7-staging.10
4 years ago
0.2.7-staging.9
4 years ago
0.2.7-staging.8
4 years ago
0.2.7-staging.7
4 years ago
0.2.7-staging.6
4 years ago
0.2.7-staging.5
4 years ago
0.2.7-staging.4
4 years ago
0.2.7-staging.3
4 years ago
0.2.7-staging.2
4 years ago
0.2.7-staging.1
4 years ago
0.2.7-staging.0
4 years ago
0.2.6
4 years ago
0.2.5
4 years ago
0.2.3
4 years ago