@k4k3ru/i18n-json
v1.0.1
Published
Utility for i18n for JSON
Readme
i18n for JSON
Installation
npm i @k4k3ru/i18n-jsonUsage
- Create localized JSON files
en.json:
{
"dictionary": {
"login": "Login"
}
}ja.json:
{
"dictionary": {
"login": "ログイン"
}
}- Import the package.
import { I18nJson } from 'YOUR_PROJECT_PATH/node_modules/@k4k3ru/i18n-json/dist/script.js';- Initialize the class.
const locales = [{
langCode: 'en',
url: '/i18n/en.json'
},{
langCode: 'ja',
url: '/i18n/ja.json'
}]
await I18nJson.Load(ConfigI18n.Map);- Get the localized value.
const loginTxt = I18nJson.String('ja', 'dictionary.login');
// loginTxt = 'ログイン';Support me
I am a Japanese developer, and your support is a great encouragement for my work! In addition to support, feel free to reach out with comments, feature requests, or development inquiries!
Thank you for your support😊
License
This repository is open-source and distributed under the MIT License.
