Modules@robinpath/i18n

@robinpath/i18n

0.1.0Public

Internationalization: translations, number/currency/date formatting, relative time, pluralization, RTL detection

@robinpath/i18n

Internationalization: translations, number/currency/date formatting, relative time, pluralization, RTL detection

Category Functions Auth License

Why use this module?

The i18n module lets you:

  • Get current locale
  • Load translations for a locale
  • Translate a key
  • Format number for locale
  • Format currency

All functions are callable directly from RobinPath scripts with a simple, consistent API.

Installation

npm install @robinpath/i18n

Quick Start

No credentials needed — start using it right away:

i18n.getLocale

Available Functions

FunctionDescription
i18n.setLocaleSet default locale
i18n.getLocaleGet current locale
i18n.loadTranslationsLoad translations for a locale
i18n.tTranslate a key
i18n.formatNumberFormat number for locale
i18n.formatCurrencyFormat currency
i18n.formatDateFormat date for locale
i18n.formatRelativeTimeFormat relative time
i18n.formatListFormat list (A, B, and C)
i18n.pluralizeSimple pluralization
i18n.directionGet text direction for locale
i18n.listLocalesList loaded translation locales
i18n.hasTranslationCheck if key exists
i18n.languageNameGet language display name
i18n.regionNameGet region display name

Examples

Get current locale

i18n.getLocale

Load translations for a locale

i18n.loadTranslations "es" {"hello": "Hola", "bye": "Adiós"}

Translate a key

i18n.t "hello" "es"

Integration with RobinPath

import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/i18n";

const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);

const result = await rp.executeScript(`
  i18n.getLocale
`);

Full API Reference

See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.

Related Modules

License

MIT

Versions (1)

VersionTagPublished
0.1.0latestyesterday
Install
$ robinpath install @robinpath/i18n
Version0.1.0
LicenseMIT
Unpacked Size5.2 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

Category

utilities