Class: ZendeskAppsTools::LocaleIdentifier

Inherits:
Object
  • Object
show all
Defined in:
lib/zendesk_apps_tools/locale_identifier.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ LocaleIdentifier

Convert :“en-US-x-12” to ‘en-US’



6
7
8
# File 'lib/zendesk_apps_tools/locale_identifier.rb', line 6

def initialize(code)
  @locale_id = code.start_with?('en-US') ? 'en-US' : code.sub(/-x-.*/, '').downcase
end

Instance Attribute Details

#locale_idObject (readonly)

Returns the value of attribute locale_id.



3
4
5
# File 'lib/zendesk_apps_tools/locale_identifier.rb', line 3

def locale_id
  @locale_id
end