We internationalized our site months ago, but forgot one part: The drop down where a user picks their timezone.
How do you translate the following line:
= f.time_zone_select :timezone, ActiveSupport::TimeZone.all
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’ve come across the same problem. However, when I was trying to implement Peter’s solution, a simpler solution occurred to me. The
time_zone_selecthelper takes a:modeloption, which defaults toActiveSupport::TimeZone. According to the API documentation, all this model has to do is return an array of timezone objects in theallmethod. We can then override theto_smethod to return the translation (defaulting to the original if the translation isn’t found). Here is the class:And in the view:
With the translations specified in the translation file as before: