Class: AdLocalize::Interactors::Platforms::ExportIOSLocaleWording

Inherits:
Object
  • Object
show all
Defined in:
lib/ad_localize/interactors/platforms/export_ios_locale_wording.rb

Constant Summary collapse

INFO_PLIST_FILENAME =
"InfoPlist.strings".freeze
LOCALIZABLE_STRINGS_FILENAME =
"Localizable.strings".freeze
LOCALIZABLE_STRINGSDICT_FILENAME =
"Localizable.stringsdict".freeze
LOCALE_DIRECTORY_CONVENTION =
"%{locale}.lproj".freeze

Instance Method Summary collapse

Constructor Details

#initializeExportIOSLocaleWording

Returns a new instance of ExportIOSLocaleWording.



10
11
12
13
14
15
# File 'lib/ad_localize/interactors/platforms/export_ios_locale_wording.rb', line 10

def initialize
  @info_plist_serializer = Serializers::InfoPlistSerializer.new
  @localizable_strings_serializer = Serializers::LocalizableStringsSerializer.new
  @localizable_stringsdict_serializer = Serializers::LocalizableStringsdictSerializer.new
  @file_system_repository = Repositories::FileSystemRepository.new
end

Instance Method Details

#call(wording:, locale:, platform_dir:) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ad_localize/interactors/platforms/export_ios_locale_wording.rb', line 17

def call(wording:, locale:, platform_dir:)
  LOGGER.debug("Starting export iOS wording for locale #{locale}")
  locale_wording = wording.translations_for(locale: locale)
  return unless has_ios_wording?(locale_wording: locale_wording)

  output_dir = platform_dir.join(LOCALE_DIRECTORY_CONVENTION % { locale: locale })
  @file_system_repository.create_directory(path: output_dir)

  export_info_plist(locale_wording: locale_wording, output_dir: output_dir)
  export_localizable_strings(locale_wording: locale_wording, output_dir: output_dir)
  export_localizable_stringsdict(locale_wording: locale_wording, output_dir: output_dir)
end

#should_export_locale_by_locale?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/ad_localize/interactors/platforms/export_ios_locale_wording.rb', line 30

def should_export_locale_by_locale?
  true
end