trans.js
This is a simple translation solution, which is inspired by the Symfony Translator Component.
It's a CommonJS module, so it must be used alongside with Browserify, or something similar, like WebPacker.
Example
// Requiring the modulevar translator = ; // Adding the translation data. This could come from anywhere like: Ajax, jsonp,// another module or the parsed JSON contents of a DOM element.translator;translator; // Domains could be added later on if needed.translator; // If a translation fails in the current locale, it will fall back to the// default localetranslatordefaultLocale = 'en';translatorlocale = 'en'; // Returns '(en) translation_value: "param"'console; // Returns 'some value'console; // Returns 'something still not translated to the "hu" locale'console;