2

Is there any way to setup multilingual labels in views' fields.

Let´s say I have the ´title´ field and it shows the label ´My Title:´. Then as my site is bilingual (english-spanish) I need to have that label to ´Mi Titulo´ depending on user language.

How can I solve this? Any module to expand views module?

4 Answers 4

3

You want to look into Internationalization Views, which allows you to translate labels and such in a view.

2
  • thanks berdir, I just enabled the i18nviews module. I was expecting to see language options in field´s settings but nothing... where do I find the place to translate my labels.
    – chefnelone
    Commented Jun 16, 2011 at 14:03
  • 1
    I come almost 6 years late to this thread but maybe this will help someone: It's in the dropdown menu at top right of the Views admin page (the one that has 'edit view name/description' as first option). There is an item that says 'Translate view'. There you will will translation for every field and field label on the view. Commented Aug 23, 2016 at 15:27
0

All the standard module care about printing title, labels and string and keep them translatable using t().

I think Translation Interface (example.com/admin/build/translate/search) can help you to search strings and define their translations.

5
  • thanks shoaib, but I am a drupal beginner, can you show how to use t() please?
    – chefnelone
    Commented Jun 16, 2011 at 13:52
  • I am not recommending you to use it but I am guessing standard module developer always use it to make sting translatable. e.g. If it is to print 'Title' then they use print t('Title'). t() function will first check for available translation of string 'Title' for the selected language in current session. If not found the original string is returned. What you need to do is to search your desired string via Translation Interface and then edit it for translation(s) and check if this works in your view? Commented Jun 16, 2011 at 13:59
  • ok, don't know where to write the t() function inside views. I tried with "Rewrite the output of this field" but didn´t work. I have the module 'Php filter' enabled. Take a look a this picture: img850.imageshack.us/img850/2947/screenshot01t.jpg
    – chefnelone
    Commented Jun 17, 2011 at 7:14
  • I think you had not tried Translation Interface :( Commented Jun 17, 2011 at 12:40
  • solved. I saved the label as 'Custom'. Then the label is available for translation.
    – chefnelone
    Commented Jun 18, 2011 at 8:14
0

If I understand you correctly, what you want is done by the Field Translation module, which is part of the Internationalization (i18n) package. Once enabled, there will be a translate tab when you edit a field (from manage fields). You will also have to enable more languages, so they are offered as translation targets.

-1

I used this method which is probably bad practice, but I couldn't find another solution.

With your file manager/FTP go to core language file: Example is for the installed German language [mysite]\profiles\standard\translations\drupal-7.0.de.po

Open in a utf-8 reader. You will be able to see a list of all English strings and their German counterparts: Example msgid "Countries" msgstr "Lände"

Add your labels (strings) and their translations and save. [-all good but this library must now be reread in-]

Using your web interface go to www.mysite.com/admin/config/regional/language Delete the language you are editing. This will clear the DB of the translations but the edited file will remain untouched. Now select "Add Language" and select your language again. The system will now read-in your updated list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.