Method: GetText::TextDomain#translate_plural_message
- Defined in:
- lib/gettext/text_domain.rb
#translate_plural_message(lang, msgid, msgid_plural) ⇒ Object
Translates the translated string.
- lang: Locale::Tag::Simple's subclass.
- msgid: the original message.
- msgid_plural: the original message(plural).
- Returns: the translated string as an Array ([[msgstr1, msgstr2, ...], cond]) or nil.
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/gettext/text_domain.rb', line 117 def (lang, msgid, msgid_plural) #:nodoc: key = msgid + "\000" + msgid_plural msg = (lang, key) ret = nil if ! msg ret = nil elsif msg.include?("\000") # [[msgstr[0], msgstr[1], msgstr[2],...], cond] mo = @mofiles[lang.to_s] cond = (mo and mo != :empty) ? mo.plural_as_proc : DEFAULT_PLURAL_CALC ret = [msg.split("\000", -1), cond] else ret = [[msg], DEFAULT_SINGLE_CALC] end ret end |