Class: TripAdvisor::Translation
- Inherits:
-
Object
- Object
- TripAdvisor::Translation
- Defined in:
- lib/trip_advisor/translation.rb
Defined Under Namespace
Classes: Localization, LocalizationsArray
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#key ⇒ Object
Returns the value of attribute key.
-
#localizations ⇒ Object
Returns the value of attribute localizations.
-
#note ⇒ Object
Returns the value of attribute note.
Class Method Summary collapse
-
.locale_identifier_to_language_codes_mapping ⇒ Object
Returns a dictionary that specifies how locale identifiers map to BCP 47 Language Identifiers.
Instance Method Summary collapse
- #[](locale_identifier) ⇒ Object
-
#initialize(attributes = {}) ⇒ Translation
constructor
A new instance of Translation.
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
#id ⇒ Object
Returns the value of attribute id.
44 45 46 |
# File 'lib/trip_advisor/translation.rb', line 44 def id @id end |
#key ⇒ Object
Returns the value of attribute key.
44 45 46 |
# File 'lib/trip_advisor/translation.rb', line 44 def key @key end |
#localizations ⇒ Object
Returns the value of attribute localizations.
44 45 46 |
# File 'lib/trip_advisor/translation.rb', line 44 def localizations @localizations end |
#note ⇒ Object
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_mapping ⇒ Object
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 |