Top Level Namespace
Defined Under Namespace
Modules: LangTools, PoHelper, Rake Classes: Catalog, GettextScanner, I18nService, Msg, NewMsgList, Object, PoSource, String
Instance Method Summary collapse
-
#_(string) ⇒ Object
it just returns the unchanged
string. -
#_i(string, caller = self) ⇒ Object
Default translator with interpolation used in case where no catalog is loaded.
-
#N_(msg) ⇒ Object
the ‘noop’ translator, better named ‘message marker’.
-
#n_(msgid, msgid_plural, n) ⇒ Object
Default plural translator used in case where no catalog is loaded.
- #s_(string) ⇒ Object
Instance Method Details
#_(string) ⇒ Object
it just returns the unchanged string
6 7 8 9 |
# File 'lib/ri18n/translators.rb', line 6 def _(string) fetch = I18nService.instance.table.fetch(string, string) fetch.empty? ? string : fetch end |
#_i(string, caller = self) ⇒ Object
Default translator with interpolation used in case where no catalog is loaded. It returns the interpolated string
19 20 21 22 |
# File 'lib/ri18n/translators.rb', line 19 def _i(string, caller = self) ret = I18nService.instance.table.fetch(string, string) || string ret.interpolate(caller) end |
#N_(msg) ⇒ Object
the ‘noop’ translator, better named ‘message marker’
40 41 42 |
# File 'lib/ri18n/translators.rb', line 40 def N_(msg) msg end |
#n_(msgid, msgid_plural, n) ⇒ Object
Default plural translator used in case where no catalog is loaded. it returns the msgid if n == 1 and msgid_plural otherwise (i.e. ‘germanic’ type plural form like for ‘de’ or ‘en’)
30 31 32 33 34 35 36 37 |
# File 'lib/ri18n/translators.rb', line 30 def n_(msgid, msgid_plural, n) ret = I18nService.instance.table[msgid] unless ret.empty? sprintf(ret.plurals[plural_form(n)], n) else sprintf(n == 1 ? msgid : msgid_plural, n) end end |
#s_(string) ⇒ Object
11 12 13 14 |
# File 'lib/ri18n/translators.rb', line 11 def s_(string) fetch = I18nService.instance.table.fetch(string, "") fetch.empty? ? string.split('|').last : fetch end |