Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not updating locale upon I18N.locale changed #25

Closed
ghost opened this issue Oct 9, 2012 · 0 comments
Closed

not updating locale upon I18N.locale changed #25

ghost opened this issue Oct 9, 2012 · 0 comments

Comments

@ghost
Copy link

ghost commented Oct 9, 2012

date-picker-rails is running fine with my simple_form, however upon changing locale ( fr or en) , the calendar is still in english ..

I inserted into my application.js
//= require bootstrap-datepicker/core
//= require bootstrap-datepicker/locales/bootstrap-datepicker.fr
//= require bootstrap-datepicker/locales/bootstrap-datepicker.es

I have a simple_form input
class DatePickerInput < SimpleForm::Inputs::StringInput
def input
value = object.send(attribute_name) if object.respond_to? attribute_name
input_html_options[:value] ||= I18n.localize(value) if value.present?
input_html_classes << "datepicker"
super # leave StringInput do the real rendering
end
end

how the I18n.locale relate to the datepicker locale ?

[SOLVED]
I inserted into my layout application.html.haml
=javascript_tag "window.locale = #{I18n.locale.to_s.inspect};"

Then in my js file :
$(".datepicker").datepicker format: "dd-mm-yyyy", language: locale

@ghost ghost closed this as completed Oct 9, 2012
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants