0

I'm currently using the country_select gem for users profiles. With the locales you can have :en, :en-Us, :en-GB and I see to change the current locale you can do I18n.locale =. So lets say I need to select 'United Kingdom' from the country_select, this will save gb into the database. Now I would like to change the locale to the users selected country but this will change it to gb which won't work as it needs to be 'en-GB' and this include the uppercase.

How would I go about doing this? This could also be the same for all the es locales.

Peter
  • 749
  • 10
  • 27

1 Answers1

0

In the end I created a helper method, which has a 'case' statement and returning the right result.

def prefix_locale(locale)
  case locale
    when 'gb'
      'en-GB'
    else
      locale
    end
end
Peter
  • 749
  • 10
  • 27