Module: TripAdvisor::TranslationTool::Scraper

Defined in:
lib/trip_advisor/translation_tool.rb

Class Method Summary collapse

Class Method Details

.localizations_from_doc(doc) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/trip_advisor/translation_tool.rb', line 18

def localizations_from_doc(doc)
  Array.new.tap do |localizations|
    doc.each { |localization| 
      locale_string = localization["lang"]["locale"]
      localized_string = localization["displayedValue"]
      status = localization["isTranslatedValue"]
      language_name = localization["lang"]["localizedDisplayName"]
      locale_identifier = localization["lang"]["locale"]
      localizations << Translation::Localization.new(locale_identifier: locale_identifier, language_name: language_name, string: localized_string, status: status, )
    }
  end
end

.translations_from_doc(doc) ⇒ Object



12
13
14
15
16
# File 'lib/trip_advisor/translation_tool.rb', line 12

def translations_from_doc(doc)
  Array.new.tap do |translations|
    doc.each { |translation| translations << Translation.new(id: translation["id"], key: translation["key"], note: translation["note"]) }
  end
end