0.4.0 • Published 10 months ago

moosmann v0.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 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.4.0

10 months ago

0.3.1

10 months ago

0.3.0

10 months ago

0.2.0

10 months ago

0.1.4

10 months ago

0.1.3

10 months ago

0.1.2

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago