Class: AdLocalize::Interactors::Platforms::ExportAndroidLocaleWording
- Inherits:
-
Object
- Object
- AdLocalize::Interactors::Platforms::ExportAndroidLocaleWording
- Defined in:
- lib/ad_localize/interactors/platforms/export_android_locale_wording.rb
Constant Summary collapse
- STRINGS_FILENAME =
'strings.xml'.freeze
- LOCALE_DIRECTORY_CONVENTION =
"values%{locale_suffix}".freeze
Instance Method Summary collapse
- #call(wording:, locale:, platform_dir:) ⇒ Object
-
#initialize ⇒ ExportAndroidLocaleWording
constructor
A new instance of ExportAndroidLocaleWording.
- #should_export_locale_by_locale? ⇒ Boolean
Constructor Details
#initialize ⇒ ExportAndroidLocaleWording
Returns a new instance of ExportAndroidLocaleWording.
8 9 10 11 |
# File 'lib/ad_localize/interactors/platforms/export_android_locale_wording.rb', line 8 def initialize @strings_serializer = Serializers::StringsSerializer.new @file_system_repository = Repositories::FileSystemRepository.new end |
Instance Method Details
#call(wording:, locale:, platform_dir:) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ad_localize/interactors/platforms/export_android_locale_wording.rb', line 13 def call(wording:, locale:, platform_dir:) LOGGER.debug("Starting export Android wording for locale #{locale}") locale_wording = wording.translations_for(locale: locale) return unless has_android_wording?(locale_wording: locale_wording) output_dir = compute_output_dir(wording: wording, locale: locale, platform_dir: platform_dir) @file_system_repository.create_directory(path: output_dir) content = @strings_serializer.render(locale_wording: locale_wording) @file_system_repository.write(content: content, path: output_dir.join(STRINGS_FILENAME)) LOGGER.debug("#{STRINGS_FILENAME} done !") end |
#should_export_locale_by_locale? ⇒ Boolean
26 27 28 |
# File 'lib/ad_localize/interactors/platforms/export_android_locale_wording.rb', line 26 def should_export_locale_by_locale? true end |