JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1040
  • Score
    100M100P100Q111730F
  • License MIT

i18n utils

Package Exports

  • @ezuikit/utils-i18n
  • @ezuikit/utils-i18n/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@ezuikit/utils-i18n) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

I18n

多语言

scripts

pnpm run dev

pnpm run build

使用

pnpm install @ezuikit/utils-i18n
import I18n from '@ezuikit/utils-i18n';
import zh from './locales/zh_CN';
import en from './locales/en_US';

const i18n = new I18n(
  {
    zh,
    en,
  },
  {
    locale: 'zh',
    defaultLocale: 'zh',
    enableFallback: true,
  },
);

i18n.t('title');

// name 是一个占位符
i18n.t('name', { name: 'ShineShao' }); // {name: "name: {{name}}"} =>  {name: "name: ShineShao"}