Can Spree support multiple locale concurrently?

79 views
Skip to first unread message

femto Zheng

unread,
Mar 21, 2012, 11:22:46 AM3/21/12
to spree...@googlegroups.com
Hello guys, I've seen the spree i18n doc 
it refers to user locale(in currency formating section:)
Currency formatting is therefore dictated by the current user locale (if locale is allowed to change) or the default locale (as above) if locale is fixed

so can spree support concurrently multiple locale
like 
like mentioned in agile web development with rails book,
it seemed from documentation you just set 
Spree::Config.default_locale, so at any time,
the final site will have one locale, can't be switched by user,
(what does user locale mean anyway? I can't find in spree documentation).

besides, setting Spree::Config.default_locale = "zh-CN",
then I18n.locale still equals :en which is confused, do I need to setting I18n.locale as well?

besides, and even if the sites supports two locale concurrently, from documentation
says it will be considered in later releases, how is it current status? Because
changing locale in more site of course relate problem to counrrency exchange.

Best Regards.

Ryan Bigg

unread,
Mar 21, 2012, 11:37:56 AM3/21/12
to spree...@googlegroups.com
Hi,

Spree doesn't currently support the locale routing like that, but with the upcoming https://github.com/jipiboily/spree_multi_lingual gem it will. 

Spree::Config.default_locale is setting the *default* locale for people. This determines what locale Spree will display in when they visit it without any locale scoping what so ever. This setting does not change I18n.locale. You would need to set this in a before_filter of your controller some how.

We're currently working on adding better language support to Spree. It's not quite there yet.
--
You received this message because you are subscribed to the Google Groups "Spree" group.
To post to this group, send email to spree...@googlegroups.com.
To unsubscribe from this group, send email to spree-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.

Jean-Philippe Boily

unread,
Mar 21, 2012, 12:03:12 PM3/21/12
to spree...@googlegroups.com
Hi,
   just like Ryan just told you, I started work on a gem but had no time to put on that recently. Luckily, sbounmy did work on his fork (https://github.com/sbounmy/spree_multi_lingual). I just updated my repo with his great work. I encourage you to take a look at it, try it and if you need some more features you are encouraged to add them and make a pull request! :)

As Ryan said, you will have to take care of I18n.locale with a before_filter, nothing major here. You will also have to handle make a language switching nav on your own as it is not yet part of spree_multi_lingual.

Good luck! :)

Cheers,

Jean-Philippe Boily |            j...@jipi.ca

femto Zheng

unread,
Mar 22, 2012, 12:49:02 PM3/22/12
to spree...@googlegroups.com
Hello, thanks.
I understand now.
will check the project you mentioned:)
Reply all
Reply to author
Forward
0 new messages