class AdLocalize::Interactors::Platforms::ExportIOSLocaleWording
Constants
- INFO_PLIST_FILENAME
- LOCALE_DIRECTORY_CONVENTION
- LOCALIZABLE_STRINGSDICT_FILENAME
- LOCALIZABLE_STRINGS_FILENAME
Public Class Methods
new()
click to toggle source
# 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
Public Instance Methods
call(wording:, locale:, platform_dir:)
click to toggle source
# 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?()
click to toggle source
# File lib/ad_localize/interactors/platforms/export_ios_locale_wording.rb, line 30 def should_export_locale_by_locale? true end
Private Instance Methods
export_info_plist(locale_wording:, output_dir:)
click to toggle source
# File lib/ad_localize/interactors/platforms/export_ios_locale_wording.rb, line 43 def export_info_plist(locale_wording:, output_dir:) return unless locale_wording.has_info_plist_keys? content = @info_plist_serializer.render(locale_wording: locale_wording) @file_system_repository.write(content: content, path: output_dir.join(INFO_PLIST_FILENAME)) LOGGER.debug("#{INFO_PLIST_FILENAME} done !") end
export_localizable_strings(locale_wording:, output_dir:)
click to toggle source
# File lib/ad_localize/interactors/platforms/export_ios_locale_wording.rb, line 50 def export_localizable_strings(locale_wording:, output_dir:) return unless locale_wording.has_singular_keys? content = @localizable_strings_serializer.render(locale_wording: locale_wording) @file_system_repository.write(content: content, path: output_dir.join(LOCALIZABLE_STRINGS_FILENAME)) LOGGER.debug("#{LOCALIZABLE_STRINGS_FILENAME} done !") end
export_localizable_stringsdict(locale_wording:, output_dir:)
click to toggle source
# File lib/ad_localize/interactors/platforms/export_ios_locale_wording.rb, line 57 def export_localizable_stringsdict(locale_wording:, output_dir:) return unless locale_wording.has_plural_keys? || locale_wording.has_adaptive_keys? content = @localizable_stringsdict_serializer.render(locale_wording: locale_wording) @file_system_repository.write(content: content, path: output_dir.join(LOCALIZABLE_STRINGSDICT_FILENAME)) LOGGER.debug("#{LOCALIZABLE_STRINGSDICT_FILENAME} done !") end
has_ios_wording?(locale_wording:)
click to toggle source
# File lib/ad_localize/interactors/platforms/export_ios_locale_wording.rb, line 36 def has_ios_wording?(locale_wording:) locale_wording.has_info_plist_keys? || locale_wording.has_singular_keys? || locale_wording.has_plural_keys? || locale_wording.has_adaptive_keys? end