Spree Commerce

Try It Now

Spree’s Plans for Improving Internationalization Support

Posted on January 17, 2013 by Ryan Bigg

When launching an international e-commerce store there are three areas you need to think through:

  • Translation – How to translate the site’s static text and database stored text to the consumer’s local language
  • Currency – How to charge the consumer in their local currency
  • Product Offerings – Determine if you want to offer different products to consumers in different locations.

Spree addresses the static text translation aspect of internationalizing an e-commerce store through our i18n project.

What is the origin of i18n?

i18n is a neuronym for the word “Internationalization.” A neuronym is a word where a number is used to form an abbreviation. i18n stands for the 18 letters in between the first letter “I” and the last letter “N.”

It’s rumored that the i18n neuronym derived its origin from a Digital Equipment Corporation (DEC) employee named Jan Scherpenhuizen. The system administrator at DEC shortened Jan’s last name to “s12n” because it was too long to be an account name. Shortly thereafter Jan’s co-workers began calling him “s12n” and neuronyms became a part of the DEC culture.

How does Spree approach i18n?

Spree leverages the Rails approach to internationalization. We store all of the translation information for static text like “add to cart” and “checkout” in a separate GitHub project known as spree_i18n. This is basically the same approach followed by the Rails project which keeps their localizations in rails-i18n. The Spree i18n project is actually a Spree extension. This extension contains translations only. The rest of code needed to support the i18n features is part of the Spree core. Translation for non-static text stored in the database like product names and product descriptions are addressed by the spree_multi_lingual gem.

What is working well in the Spree i18n extension?

Like most Spree features, the i18n functionality is 100% open source, ready to use, and easy to customize. Cristian Livadaru from LCX.at, a web development firm based in Austria, and Cezar Halmagean built the site Lifestyle4fun.com using the Spree i18n extension. Cristian explains “Spree is great because it provides code to address internationalization for e-commerce sites out-of-the-box.”

How can Spree’s i18n functionality be improved?

While the i18n extension provided a great framework for Cristian to translate the static text for the Lifestyle4fun.com site, he ran into some challenges keeping the translations up-to-date. “If a new piece of static text is introduced into the Spree core that has not yet been translated in the i18n extension, then I have to translate it myself. I’ve tried using a translation service, but the translations that are returned are often times inaccurate because they were translated by a non-technical person or by someone that didn’t understand the context of the text,” Cristian says.

The team at d:evolute also faced a challenge translating the database stored text for their e-commerce site — text like product names and product descriptions. Daniel Spaude and Andreas Woerle from d:evolute explain “The Spree i18n extension only translates the non-static text. We were able to use the spree_multi_lingual gem to translate the database text. But we ran into some issues keeping the Spree i18n extension and the spree_multi_lingual gem in synch when updates were released to one or the other. It would be great if the spree_multi_lingual gem functionality was part of the Sree i18n extension so we don’t have to worry about compatibility issues.”

The Spree team hears these concerns and has plans for better internationalization support in Spree 2.0, which is on the horizon. Below are three of the improvement areas we are working on.

Namespacing

The first improvement area is isn’t so much of a technical concern as it is a general inconvenience. The problem is that the translations within Spree are not namespaced. This is an issue for translations that use common words like “orders” or “actions” which may conflict with those translations coming from a parent application that contains the Spree engines.

To fix this, we will be namespacing all the translations in Spree 2.0 to be underneath a “spree” key. Translations that would have previously used something such as I18n.t(:orders) will use a new helper — Spree.t(:orders) — which would effectively do I18n.t(:orders, :scope => :spree). Doing this would allow us to avoid conflicts with translations that already exist within the base Rails application.

Keeping it up-to-date

The second improvement area is of greater concern. As Cristian mentioned, it’s really, really hard to keep the translations up-to-date in this project with what’s going on in the different branches over on the main Spree repository. While we may use a translatable piece of text within Spree’s core, the translation for that text may not reach spree_i18n until some time later. Even then, that would only be for some particular languages.

To fix this, we’ll be looking at using LocaleApp, which will allow us to store the translations in an easy-to-edit way, so that people looking to assist with translations can do so without having to open a pull request on the spree_i18n project. The translations from LocaleApp will be periodically synced with the spree_i18n project, meaning that if you would like to use them you can just add the spree_i18n gem to your application’s Gemfile:


gem ‘spree_i18n’, :github => spree/spree_i18n", :branch => “2-0-stable”

And your translations will be up to date.

Multi-lingual support

Currently in Spree, you are able to specify a single name and a single description for a product. If you want to translate this name or description into another language, you can use the spree_multi_lingual gem. We are looking at ways in which we can improve the multi-lingual support in Spree by building on the features already in this gem, perhaps even going as far as to include this functionality within the Spree core as requested by the folks at d:evolute.

  • Join the discussion: What i18n improvements would you like to see?
blog comments powered by Disqus