0.5.1 • Published 6 months ago

moosmann v0.5.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

moosmann

npm version

i18n for typescript developers

I'm currently developing this while doing other things because I wanted to have a simple system for localization. It is in no way ready to use in production and the API may will change on a whim.

How to use

  1. Create your locales:
// [locales/en.ts]
export default {
    greeting: (name: string) => `Hello, ${name}!`,
};
// [locales/de.ts]
import type en from "./en";

export default {
    greeting: (name) => `Hallo, ${name}!`,
} satisfies typeof en;
  1. Construct an instance of moosmann
export const i18n = moosmann({
    en: en,
    de: () => import("./locales/de"),
});
  1. Load a locale and use it
const t = await i18n.loadLocale("de");

const greeting = t("greeting", "Moosmann");
// => "Hallo, Moosmann!"

See examples for more!

0.5.0

6 months ago

0.5.1

6 months ago

0.4.0

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago