Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Advanced translation tutorial English to Arabic using i18n and Drupal 7

Parent Feed: 

In this tutorial we will

1. Configure Views to show nodes with only the current language.

2. Translate  strings in views that cant be translated via admin UI.

3. Translate menu items.

1. On each views (pages, blocks etc) we need to add filter criteria ‘Content: Language’ and choose ‘Current user’s language’ – https://screencast.com/t/hvRR4XmL8DQZ After this you the view will only show nodes that contain your current language on site.

2. Sometimes we have views with a difficult structure and fields with a lot of HTML tags, tokens and strings. These can’t be translated via Drupal admin UI. For example this global custom field – https://screencast.com/t/S0U6Zibb0p54 a method for translating something irregular like this is as follows.  Create a .tpl file for this field and wrap strings and links in t() and l() functions.  https://screencast.com/t/3Dj1gGjEe after this we Then these can easily found and translated in admin UI.

The Same method can be used for other views templates and nodes if there are links

3. To translate the menu we need to enable ‘Menu translation’ module (from i18n). Now we go to edit menu and enable translation mode – https://screencast.com/t/JRw0ngrBa8  Now we can translate any menu item – https://screencast.com/t/s6maX10qk

Then add (or edit) the Arabic variant  – https://screencast.com/t/LGoewMdCo

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web