"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/y18n/README.md" (8 Mar 2017, 2365 Bytes) of archive /windows/misc/atom-windows.zip:

As a special service "Fossies" has tried to format the requested source page into HTML format (assuming markdown format). Alternatively you can here view or download the uninterpreted source code file. A member file download can also be achieved by clicking within a package contents listing on the according byte size field.


Build Status Coverage Status NPM version js-standard-style

The bare-bones internationalization library used by yargs.

Inspired by i18n.


simple string translation:

var __ = require('y18n').__

console.log(__('my awesome string %s', 'foo'))


my awesome string foo

pluralization support:

var __n = require('y18n').__n

console.log(__n('one fish %s', '%d fishes %s', 2, 'foo'))


2 fishes foo

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.



Create an instance of y18n with the config provided, options include:

y18n.__(str, arg, arg, arg)

Print a localized string, %s will be replaced with args.

y18n.__n(singularString, pluralString, count, arg, arg, arg)

Print a localized string with appropriate pluralization. If %d is provided in the string, the count will replace this placeholder.


Set the current locale being used.


What locale is currently being used?


Update the current locale with the key value pairs in obj.