Class: AdLocalize::Platform::IosFormatter

Inherits:
PlatformFormatter show all
Defined in:
lib/ad_localize/platform/ios_formatter.rb

Constant Summary

Constants inherited from PlatformFormatter

PlatformFormatter::OPTIONS, PlatformFormatter::PLURAL_KEY_SYMBOL, PlatformFormatter::SINGULAR_KEY_SYMBOL

Instance Attribute Summary

Attributes inherited from PlatformFormatter

#default_locale, #output_path, #platform_dir

Instance Method Summary collapse

Methods inherited from PlatformFormatter

#initialize

Constructor Details

This class inherits a constructor from AdLocalize::Platform::PlatformFormatter

Instance Method Details

#export(locale, data, export_extension = nil, substitution_format = nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/ad_localize/platform/ios_formatter.rb', line 7

def export(locale, data, export_extension = nil, substitution_format = nil)
  create_locale_dir(locale)
  [AdLocalize::Constant::PLURAL_KEY_SYMBOL, AdLocalize::Constant::SINGULAR_KEY_SYMBOL].each do |numeral_key|
    numeral_data = data.select {|key, wording| wording.dig(locale.to_sym)&.key? numeral_key}
    if numeral_data.empty?
      AdLocalize::LOGGER.log(:info, :black, "[#{locale.upcase}] no #{numeral_key.to_s} keys were found to generate the file")
    else
      send("write_#{numeral_key}", locale, numeral_data)
    end
  end
end

#platformObject



3
4
5
# File 'lib/ad_localize/platform/ios_formatter.rb', line 3

def platform
  :ios
end