Skip to content

Instantly share code, notes, and snippets.

@th1agoalmeida
Created November 1, 2010 14:27
Show Gist options
  • Save th1agoalmeida/658245 to your computer and use it in GitHub Desktop.
Save th1agoalmeida/658245 to your computer and use it in GitHub Desktop.
def self.translate_hash_keys(source)
r = {}
source.each { |k,v| r[I18n.t k] = v }
r
end
BACKGROUND_REPEAT_POLICIES = {0=>'no-repeat',1=>'repeat'}#repeat-X, repeat-Y
GENDERS = {'-'=>'0','model.user.gender.female'=>'1','model.user.gender.male'=>'2'}
BIRTH_POLICIES = {'model.user.birth_policy.dm'=>0,'model.user.birth_policy.dmy'=>1,'model.user.birth_policy.nothing'=>2}
LOCALES = {'locales.en' => "en",'locales.pt-BR' => "pt-BR"}
def self.GENDERS
MyFunctions.translate_hash_keys(User::GENDERS)
end
def self.BIRTH_POLICIES
MyFunctions.translate_hash_keys(User::BIRTH_POLICIES)
end
def self.LOCALES
MyFunctions.translate_hash_keys(User::LOCALES)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment