@ckpack/i18n

The World's smallest fastest internationalization library

Usage no npm install needed!

<script type="module">
  import ckpackI18n from 'https://cdn.skypack.dev/@ckpack/i18n';
</script>

README

@ckpack/i18n

The smallest fastest internationalization library

Example

const i18n = new I18n({
  locale: defaultLocale,
  fallbackLocale: defaultLocale,
  messages: {
    zh: {
      hello: "你好 世界",
      say: {
        thanks: "{name} 谢谢"
      }
    },
    en: {
      hello: "hello world",
      say: {
        thanks: "thanks {name}"
      }
    }
  }
});

i18n.t('hello') // 你好 世界
i18n.t('say.thanks', {name: 'xiaohong'}) // xiaohong 谢谢

Demo

Documentation