Class: TripAdvisor::Translation

Inherits:
Object
  • Object
show all
Defined in:
lib/trip_advisor/translation.rb

Defined Under Namespace

Classes: Localization, LocalizationsArray

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Translation

Returns a new instance of Translation.



46
47
48
49
# File 'lib/trip_advisor/translation.rb', line 46

def initialize(attributes = {})
  @localizations = LocalizationsArray.new
  attributes.each { |k, v| self.send("#{k}=", v) }
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



44
45
46
# File 'lib/trip_advisor/translation.rb', line 44

def id
  @id
end

#keyObject

Returns the value of attribute key.



44
45
46
# File 'lib/trip_advisor/translation.rb', line 44

def key
  @key
end

#localizationsObject

Returns the value of attribute localizations.



44
45
46
# File 'lib/trip_advisor/translation.rb', line 44

def localizations
  @localizations
end

#noteObject

Returns the value of attribute note.



44
45
46
# File 'lib/trip_advisor/translation.rb', line 44

def note
  @note
end

Class Method Details

.locale_identifier_to_language_codes_mappingObject

Returns a dictionary that specifies how locale identifiers map to BCP 47 Language Identifiers



4
5
6
7
# File 'lib/trip_advisor/translation.rb', line 4

def self.locale_identifier_to_language_codes_mapping
  {  "zh_TW" => "zh-Hant", "zh_CN"=> "zh-Hans", "zh_CN"=> "zh",
     "no"=> "nb", "in"=> "id", "en_UK"=> "en-GB" }
end

Instance Method Details

#[](locale_identifier) ⇒ Object



59
60
61
# File 'lib/trip_advisor/translation.rb', line 59

def [](locale_identifier)
  localizations[locale_identifier]
end