drilix.com

Freedom, Community & Sustainability

Seamless Drupal 7 multilingual site

November 7, 2011 -- William
Last modified on December 2018
Duration: +- 15 minutes

4 - Multilingual for developers

Writing code for multilingual sites
Keep in mind that Drupal's default language is english. It doesn't matter what is your site default language, all code you write must be in english to avoid problems. This is true even if your site has only one language (other than english). You should write all your code in english (using the t() function to make strings translatable) and translate it using the drupal interface. Drupal will always consider that whatever is in code is english.

Views + Features bug (modules)
When exporting a Views using Features you might see that translations may get lost. Actually, if you edit your Views, add a space to the end of the title and save it, the translations get back to where they belong. This is one of the few annoying bugs that can make you cry if you are not aware of.

 

Read more:
Documentation tutorial
More drupal documentation
The iCanLocalize site
Gabor Hojtsi (involved in the development of Drupal and multilanguage)
Jose Reyero (Drupal developer and consultant)

Pages

Comments

If you enable the i18n_redirect module (from the i18n module suite), then you can use language neutral nodes without penalty of having duplicate content on your site.

Submitted by William on
Hello Kristen, Thank you for pointing that out! I've added a note on the text about your comment. Thank you for mentioning this tutorial in your site! ;) I'll also take the opportunity to mention to other readers that you wrote a very good book about Drupal multilingual websites! http://www.packtpub.com/drupal-7-multilingual-sites/book

...only works for anonymous users when page caching is turned off. This is to prevent cached pages being served in the wrong language. For example if an Italian visitor has visited a page, and a french visitor comes next, the French visitor would be serves the page in Italian from the cache. This is bad, of course, since caching should almost always be turned on :-(

Submitted by William on
Hi Reinhard, Thank you for this information, I'm just wondering what is the detection method you are using in the URL? I think this is likely to happen when using the Session variable but not when using path prefix. Do you have also the Global Redirect module enabled? I haven't tested to check these issues but I was just wondering. Anyway, I've added a note about your comment in the text. Thanks again!

Submitted by Soulemane (not verified) on
Hi! I am about to develop a multilingual web site : english, french and arabic. I have been trying to find out how I will carry out this critical project, giving that it is my first one with multilingual site. After reading your article I felt a huge relief. I am therefore taking this opportunity to extend you my gratitude. You have done a good job. It has just saved me a lot of time. Keep it up. Thanks

Submitted by William on
Hi Soulemane, Thank you for your comment, I'm really glad it was helpful! I'd be curious to know how your multilingual project went!

Pages

Add new comment