glob array of glob patterns and options representing files to load
The order of globs/files pass in the array is important. Files are loaded in the order found with later files overwriting the dictionary value from earlier sources
import {Translator} from '@ortac/libs-js';
const translator = new Translator([{pattern: './localeFiles*.json'}]);
console.log(translator.lookup('en-US', '_metres')); // => 'meters'
Gets the log containing a unique list of calls made to this dictionary
Optional
locale: stringthe locale to get the logs for, or all locales if omitted
array of phrases passed in for translation in the order first passed (ie no duplications)
The returned array will always be an array of unique phrases even if the same phrase has been looked up in multiple locales
Returns a trace explaining which source(s) have been used by the translator on a particular phrase
BCP47 format
the phrase to get a trace for
a multiline string, one line per source with each successive source overriding previous sources for the phrase
Generated using TypeDoc
The Translator Class provides translations of phrases used in ortac systems across multiple locales.
The Translator Class uses locale files per the ortac specification, currently supporting v1.0.0. The Class also provides for the ability to trace where the source of a particular translation has come from, and can also log all phrases passed into the translator.