0.1.4 ā€¢ Published 2 years ago

text-localizer v0.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Tutorial

Tutorial can be found here.

Usage

import { TextLocalizer } from 'text-localizer';
import { fetchItTranslations } from './l10n/it';

(async () => {
  const localizer = new TextLocalizer({
    us: import('./l10n/us.json'),
    gb: import('./l10n/gb'),
    it: fetchItTranslations,
  });

  await localizer.setOptions({
    language: 'gb',
  });

  const translations = localizer.translations;

  console.log(translations.question); // "Which is your favourite cat?"

  console.log(
    localizer.formatTranslation(translations.help, { topic: 'Text Localizer' })
  );
})();

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT