Class: GetText::Tools::MsgInit::CLDRPluralsConverter
- Inherits:
-
Object
- Object
- GetText::Tools::MsgInit::CLDRPluralsConverter
- Defined in:
- lib/gettext/tools/msginit.rb
Instance Method Summary collapse
- #convert ⇒ Object
-
#initialize(language) ⇒ CLDRPluralsConverter
constructor
A new instance of CLDRPluralsConverter.
Constructor Details
#initialize(language) ⇒ CLDRPluralsConverter
Returns a new instance of CLDRPluralsConverter.
374 375 376 377 |
# File 'lib/gettext/tools/msginit.rb', line 374 def initialize(language) @language = language end |
Instance Method Details
#convert ⇒ Object
379 380 381 382 383 384 385 386 387 388 389 390 391 |
# File 'lib/gettext/tools/msginit.rb', line 379 def convert n_plurals = nil expression = nil if defined?(Datasets::CLDRPlurals) plurals = Datasets::CLDRPlurals.new plurals.each do |locale| next unless locale.name == @language n_plurals, expression = convert_plural_rules(locale.rules) break end end "nplurals=#{n_plurals}; plural=#{expression};" end |