Skip to content

i18n-v0.1.0

Compare
Choose a tag to compare
@aklinker1 aklinker1 released this 19 Aug 14:32
· 138 commits to main since this release
5821ae0

First release of @wxt-dev/i18n! It's meant to be a simpler, type-safe alternative to the browser.i18n APIs. If you're using the browser.i18n APIs, give it a try! If you're using a different i18n library, you can try it out, but you don't have to switch to it - keep doing what's working for you.

It features:

  • Full type-safety
  • A simpler messages file format
  • Plural forms
  • Translations in the manifest (like the vanilla APIs)
  • Translations in CSS (like the vanilla APIs)
  • Support for both WXT extensions and non-WXT extensions

Coming soon:

  • Number formatting (currency, rounding, commas)
  • Support for more plural forms (like Arabic's few/many)

Quickstart with WXT

Read the docs for a full overview: https://wxt.dev/guide/i18n/introduction.html

pnpm i -D @wxt-dev/i18n
// wxt.config.ts
export default defineConfig({
  modules: ["@wxt-dev/i18n/module"],
  manifest: {
    default_locale: "en"
  }
});
# <srcDir>/locales/en.yml
helloWorld: Hello world!
// Auto-imported or import manually from:
// import { i18n } from "#i18n";

i18n.t("helloWorld"); // "Hello world!"