Class: AdLocalize::Interactors::Platforms::ExportPropertiesLocaleWording

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

Instance Method Summary collapse

Constructor Details

#initializeExportPropertiesLocaleWording

Returns a new instance of ExportPropertiesLocaleWording.



5
6
7
8
# File 'lib/ad_localize/interactors/platforms/export_properties_locale_wording.rb', line 5

def initialize
  @properties_serializer = Serializers::PropertiesSerializer.new
  @file_system_repository = Repositories::FileSystemRepository.new
end

Instance Method Details

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



10
11
12
13
14
15
16
17
18
19
# File 'lib/ad_localize/interactors/platforms/export_properties_locale_wording.rb', line 10

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

  content = @properties_serializer.render(locale_wording: locale_wording)
  @file_system_repository.create_directory(path: platform_dir)
  @file_system_repository.write(content: content, path: platform_dir.join("#{locale}.properties"))
  LOGGER.debug("#{locale}.properties done !")
end

#should_export_locale_by_locale?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/ad_localize/interactors/platforms/export_properties_locale_wording.rb', line 21

def should_export_locale_by_locale?
  true
end