server | browser | |
---|---|---|
extract | gettext | jsxgettext |
translate | fast_gettext gettext_i18n_rails |
po2json/Jed |
_('Car') == 'Auto'
_('not-found') == 'not-found'
s_('Namespace|not-found') == 'not-found'
n_('Axis','Axis',3) == 'Achsen'
_('Hello %{name}!') % {name: "Pete"} == 'Hello Pete!'
validates_presence_of :first_name, message: N_("Can\'t be blank")
What jsxgettext supports:
gettext("Hello world!");
gettext("Hello " + 'world!');
myModule.gettext("Hello " + 'world!');
gettext.call(myObj, "Hello " + 'world!');
ngettext("Here's an apple for you", "Here are %s apples for you", 3); ngettext("Here's an apple" + ' for you', "Here are %s apples" + ' for you', 3);
myModule.ngettext("Here's an apple" + ' for you', "Here are %s apples" + ' for you', 3);
ngettext.call(myObj, "Here's an apple" + ' for you', "Here are %s apples" + ' for you', 3);
What Jed supports:
gettext = function ( key )
dgettext = function ( domain, key )
dcgettext = function ( domain, key, category )
ngettext = function ( singular_key, plural_key, value )
dngettext = function ( domain, singular_ley, plural_key, value )
dcngettext = function ( domain, singular_key, plural_key, value, category )
pgettext = function ( context, key )
dpgettext = function ( domain, context, key )
npgettext = function ( context, singular_key, plural_key, value )
dnpgettext = function ( domain, context, singular_key, plural_key, value )
dcnpgettext = function ( domain, context, singular_key, plural_key, value, category )
i18n.gettext('Car').value == 'Auto'
Â
i18n.gettext('My car is %(brand)s').with({brand: 'ford'}) == 'My auto is ford'
Â
i18n.ngettext('Car','Cars',3).value == 'Cars'
Â
i18n.ngettext('buy a %(brand)s car','buy %(brand)s cars',3)
.with({brand: 'ford'}) == 'buy ford cars'
Regarding *.yml as *.erb
rake gettext:add_language[en]
Â
rake gettext:find
Â
jsxgettext app.js -o app.po # need npm i -g, plural lost
Â
po2json sample.po sample.json -p # need npm i -g, plural lost
https://github.com/grosser/gettext_i18n_rails
https://github.com/grosser/fast_gettext
https://github.com/mutoh/gettext
https://github.com/zaach/jsxgettext
https://github.com/SlexAxton/Jed/