Our Blog

Advanced translation tutorial English to Arabic using i18n and Drupal 7

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

Comments ( 0 )

    Leave A Comment

    Your email address will not be published. Required fields are marked *