Hi,
i am having problem with building multilingual views. I have a view for each node that displays some of the node content and other content related to that node. I have installed chinese language pkg and added the language. I have translated the node content so i can switch between english and chinese when I am on the node page. when i do the url prefix and the node id changes like this: node/5 <-> zh-hans/node/6. but when I am on my views page, i.e. view/5, for the corresponding node and click chinese it goes to zh-hans/view/5 and of course does not return the translated content because the translated content has node id of 6 not 5. what is best way to deal with this?? and i don't understand why translated content has a its own node id??

possible solutions:
1. let chinese content reside on view/zh-hans/6 and english on view/5.
problem: can't use language switcher from views page, so would have to hide it. could leave it on views pages that don't use the node id as an argument. but this is not ideal as i would like to be able to switch between languages anywhere on the site.

2. redirect url for chinese content at zh-hans/node/6 -to-> zh-hans/node/5 so that it may be possible to get translated content at zh-hans/view/5.
problem: can't get this to work and not sure why the node id is unique to begin with so maybe bad practice.

thanks

Comments

ardnet’s picture

Me too, i also got the same problem with this.
Any help from the pros would be appreciated please. :)

Thanks

parkerjdru’s picture

i'm still stuck. launching site very soon so I will instruct translator to enter a redirect for every node(view). would love for someone who knows what they are talking about to point me in the right direction if this a mistake.

jdench’s picture

I find it works fine using URL aliases (not redirect).

Go to "add alias", select one language (say, Chinese, from example above), enter the URL of the other language (5) and the path alias that you want to go to in your selected language (6).

The form is a bit misleading as it gives you the language prefix of the default language, but just ignore that.

Now when you are in English view/5 and hit the language switcher, you should get to Chinese view/6. And vice versa.

++++

On further investigation - I am not sure this works. It seems like you end up with the wrong view. Sorry about that.

mths’s picture

It is a bit hard to say since I don't know how you configured your view. It is normal behavior to have different node id's for translations of a node. I have a multilanguage site and it works fine with views in blocks and pages.

First thing that comes to my mind: Did you configure the view to be language aware? Meaning, did you filter on language?

Also, what exactly do you mean with ' a view page', since this does not typically have a 'node id', since a view is not a node.

ardnet’s picture

I found the so-called solution for this :)

Just create custom CCK field say... "Custom flag".
Put the same value for this in all different languages of node.
In the Views, just filter by this CCK field, but of course u still need to choose Node tranlastion to Current translation.

This works for me, at least :)
Cheers.

kla2t’s picture

The solution is very simple: replace the "Node: NID" argument type in your views by "Node translation: Translation set node ID". This will fetch either the source node or its translation, depending on the context, with the same query.
+++Edit+++
I should mention that this approach will only work on nodes which actually have a translation and are not language neutral. Taken this for granted, you still have to filter by "Node translation: Language" - "Current user's language".

parkerjdru’s picture

i knew i must be missing something. Thank you kla2t!

drtrueblue’s picture

What about the use case where there node does not yet have a translation? Is there a solution?

mudasirweb’s picture

Thank you this worked for me.