text-localizer
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

📖 Text Localizer

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

Readme

Keywords

Package Sidebar

Install

npm i text-localizer

Weekly Downloads

1

Version

0.1.4

License

MIT

Unpacked Size

30.5 kB

Total Files

45

Last publish

Collaborators

  • enzomanuelmangano