Skip to content

Commit

Permalink
Allow hyphens in locales
Browse files Browse the repository at this point in the history
Panda currently uses hyphens in locales, and it seems like this
solution may work based on grosser/gettext_i18n_rails#60
  • Loading branch information
yesthatguy committed Jun 29, 2018
1 parent 8ea909b commit aaafb05
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/fast_gettext/storage.rb
Expand Up @@ -177,9 +177,9 @@ def weighted_locales(locales)
found
end

#de-de -> de_DE
#de-de -> de-DE
def format_locale(locale)
locale.sub(/^([a-zA-Z]{2,3})[-_]([a-zA-Z]{2,3})$/){$1.downcase+'_'+$2.upcase}
locale.sub(/^([a-zA-Z]{2,3})([-_])([a-zA-Z]{2,3})$/){$1.downcase+$2+$3.upcase}
end

def switch_cache
Expand Down

0 comments on commit aaafb05

Please sign in to comment.