anjlab / anjlab-widgets

UI Widgets on top of anjlab-bootstrap-rails
MIT License
54 stars 15 forks source link

Locale problem #2

Closed thotmx closed 11 years ago

thotmx commented 11 years ago

Hi, How do you configure the locale option to another language. I've added to your code the spanish locale options, but I don't understand how change the configuration to use it. (My default locale is :es)

Thanks in advance.

yury commented 11 years ago

There are two places to add locale

  1. Server side https://github.com/anjlab/anjlab-widgets/blob/master/lib/anjlab-widgets.rb#L7
  2. Client side https://github.com/anjlab/anjlab-widgets/blob/master/app/assets/javascripts/anjlab/datepicker.js.coffee#L2

On client side we detect locale by <html lang> attribute. On server side by ::I18n.default_locale (and configured here https://github.com/anjlab/anjlab-widgets/blob/master/spec/dummy/config/application.rb#L35) in both cases we fallback to en

Right now it hardcoded. But any PR are welcome.

thotmx commented 11 years ago

I'm trying to add another translation to your gem, but I've some problems, I've changed the code that you show me, but don't use my locale.

I don't understand what I'm missing.

Thanks a lot for your response.

yury commented 11 years ago

Ok, I updated dummy app in your fork.

https://gist.github.com/yury/31db37c329bca7acd53e

go to spec/dummy and start rails app (rails s)

open /datepicker

check 4-th picker. It fallbacks to default location. http://cl.ly/image/0G1A0X3M3A1x

thotmx commented 11 years ago

Ok, Maybe I've another problem with my application where this change doesn't work. Thanks a lot for your support.

yury commented 11 years ago

Please be free to make PR with es locale. Thank you

thotmx commented 11 years ago

Of course, I'll make the PR when my app works. Thanks a lot for your hard work on this gem.