You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You will need to run with --allow-read to load alternative locales.
JSON Language Files
The JSON language files should be stored in a ./locales folder.
File names correspond to locales, e.g., en.json, pirate.json.
When strings are observed for the first time they will be
added to the JSON file corresponding to the current locale.
Methods
require('y18n')(config)
Create an instance of y18n with the config provided, options include:
directory: the locale directory, default ./locales.
updateFiles: should newly observed strings be updated in file, default true.
locale: what locale should be used.
fallbackToLanguage: should fallback to a language-only file (e.g. en.json)
be allowed if a file matching the locale does not exist (e.g. en_US.json),
default true.
y18n.__(str, arg, arg, arg)
Print a localized string, %s will be replaced with args.
This function can also be used as a tag for a template literal. You can use it
like this: __`hello ${'world'}`. This will be equivalent to
__('hello %s', 'world').