You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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
The text was updated successfully, but these errors were encountered: