@theowenyoung/languages
v1.5.1
Published
Shared language identifiers and locales for OpenTranslate projects.
Downloads
1
Maintainers
Readme
@theowenyoung/languages
Shared language identifiers and locales for OpenTranslate projects.
Usage
Install
Yarn
yarn add @theowenyoung/languages
NPM
npm i @theowenyoung/languages
Import
CommonJS
const { languages } = require("@theowenyoung/languages");
const en = require("@theowenyoung/languages/locales/en");
const zhCN = require("@theowenyoung/languages/locales/zh-CN");
const zhTW = require("@theowenyoung/languages/locales/zh-TW");
TypeScript (with resolveJsonModule
enabled)
import { languages } from "@theowenyoung/languages";
import en from "@theowenyoung/languages/locales/en.json";
import zhCN from "@theowenyoung/languages/locales/zh-CN.json";
import zhTW from "@theowenyoung/languages/locales/zh-TW.json";
API
const langCode = languages[0];
console.log(langCode); //af
console.log(zhCN[langCode]); //南非荷兰语
console.log(en["en"]); //English