By ss54 on
I have built views with two languages. I can display the English view normally but when I click on the language switcher the view only switches direction to the right without changing to the translated view. All the needed core modules enabled, I also installed the i18n module. As for normal pages, everything works perfect. I have tried using the filter (content language) with no results. I have googled the issue and got similar actions as I did but nothing has given fruitful results. I would appreciate any help. Thanks
Comments
Add language filter
You can add language filter in views Contextual Filters. For this filter I didn't see any option like current user's language or language from url etc. But I tried providing default argument with php code type. Added below code in it.
global $language;
return $language->language;
It worked. Please try the same on your site.
Thanks
Thank you so much. I did what you said but have not got the requisite results. I will briefly explain what design I have as this might reveal some fault that I could have made: I have a content type called Activities and I have classified it into three parts by taxonomy terms (English and translated Arabic terms) these terms are seminar, Conference, Supply. Regularly I created content and classified it by the term seminar and I translated this node. I also created two separate views one for English (seminars_en) and another for arabic seminars_ar. I used the taxonomy filter to show the relevant language. I did as in the picture as you advised
http://novalifeiraq.com/sites/default/files/images/contexlang.png
I have put the php code in both views and I skipped the default URL (set the box). Can you help further please.
My URL is http://novalifeiraq.com
Use Content: Language filter
Use Content: Language filter in view.
I think you should do something like this =>
1. You have taxonomy terms for your content type.
2. Create node having 1 of your taxonomy term selected. (English)
3. Translate this node to Arabic (using translate tab)
4. Create view for seminar
5. Add filter in this view: taxonomy = seminar content_type = your_created_content_type
6. Add contextual filter: CONTENT:LANGUAGE. For this filter give default PHP value as I told in previous post
This will create a seminar view for you. When you switch language using language switcher, you will get this view output in selected language.
If you don't want to create separate view for each taxonomy term then either you can skip adding taxonomy filter in view or just add and expose it. Finally its all up to you how you want to display.
Sorry for being Late
@pramod_patil
Many thanks for your attempt to help me and sorry for my belated reply. I had found a very good solution for this problem by using a module called (I18n page views) which gives you the options to specify a path for each language. However, I would prefer to try your solution because I am always afraid from using too many modules for fear of having clashes among them. Again I thank you and wish you the best.