JSPM

i18n-nodejs-browserify

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q12182F
  • License MIT

Internationalization localization package

Package Exports

  • i18n-nodejs-browserify

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (i18n-nodejs-browserify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Install

npm install i18n-nodejs-browserify --save

Usage

New


var locale = require('./locale.json');
var lang = "fr";
var i18n_module = require('i18n-nodejs-browserify');

var i18n = new i18n_module(lang, locale);
console.log(i18n.__('Welcome'));

Languages file

Put it in the same folder as index.js

{
    "Welcome": {
        "ar": "مرحبا",
        "fr": "Bienvenue"
    },
    "Looking for user": {
        "ar": "نبحث الان عن مستخدم اخر"
    },
    "You have disconnected.": {
        "ar": "تم قطع الاتصال."
    },
    "Chat": {
        "ar": "شات"
    }
}