"use strict";
const Localizer = require('../../src/js/Localizer.js');
const l10n = new Localizer();
// setup supported locales
l10n.locale('en', {});
l10n.locale('el', {
'I want to say {0}' : '???? ?? ?? {0}',
'hello to you' : '???? ?? ????',
'hello to all' : '???? ?? ?????',
'@' : {
// specific context
'ctx1' : {
'hello to you' : '???? ?? ???? ????',
},
},
});
// set current locale
l10n.locale('el', true);
// UTF8 BOM
const UTF8_BOM = Buffer.from([0xEF,0xBB,0xBF]);
require('fs').writeSync(process.stdout.fd, UTF8_BOM, 0, UTF8_BOM.length);
console.log('Localizer.VERSION = ' + Localizer.VERSION);
console.log(l10n.locale());
console.log(l10n.l('hello to you'));
console.log(l10n.l('hello to all'));
console.log(l10n.l('hello to you', '???? ?? ????'));
console.log(l10n.l('hello to all', '???? ?? ?????'));
console.log(l10n.l('I want to say {0}', [l10n.l('hello to you')]));
console.log(l10n.l('I want to say {0}', [l10n.l('hello to all')]));
console.log(l10n.ln(1, 'hello to you', 'hello to all'));
console.log(l10n.ln(2, 'hello to you', 'hello to all'));
console.log(l10n.l('hello to you', '???? ?? ???? ????'));
console.log(l10n.l(['hello to you','ctx1']));
|