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