i18n paths & views

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
penyaskito's picture

Hi,

I'm wondering what people use for using different paths in a view for each language.

In the past, we approached this issue by creating nodes with the desired url, and embedding a view on it, but it doesn't seem like the best option.

I also heard of people that duplicate each view for each language, but doesn't seem to me like an scalable approach in big sites.

Recently we participated on developing i18_page_views module (yep, it lacks an 'n'), that makes possible putting different paths for each language.

I'd like to learn from others experience on this issue, and it there are any improvements on Drupal 7 or if this is something considered on the
Drupal 8 Multilingual Initiative.

Thanks in advance for your thoughts.

Comments

Different approaches

Kristen Pol's picture

I looked into this recently and here are the ways I see to handle it:

1) create a completely different view per language - this is most useful if you indeed will be having different data shown

2) use the i18_page_views module - this is most useful when the views are exactly the same but you want a different path per language - what I don't like about this option is that you have to use the "i18n page" display rather than the "page" display so it is not easy to add it in after the fact unless your "default" display configuration exactly matches your "page" display configuration - would be nice if this just altered the "page" display path options

3) use one view but filter based on interface language - this is most useful when the views are exactly the same and you want the paths to be the same for all

Kristen

Path translation

Kristen Pol's picture

For #1, you can use the Path translation module (in i18n) to maintain your translation set.

Kristen

Thanks Kristen, didn't knew

penyaskito's picture

Thanks Kristen, didn't knew about it. It seems that it was included in D7.

--
Christian López Espínola (@penyaskito)

D7 goodies

Kristen Pol's picture

Ya, lots of good stuff in D7! I'm digging into it all in detail for the D7 i18n book I'm writing... hopefully out in March.

Kristen

Create one view for all

webflo's picture

Create one view for all languages. Use i18nviews and create a path alias for every language for nice localized urls ;)

Path translation is pretty clever too.

i18nviews and menu

no2e's picture

Create one view for all languages. Use i18nviews and create a path alias for every language for nice localized urls ;)

I think this will not work if you want to link the Views pages in a menu with translation mode "Translate and Localize". Because the menu needs the real system path (and not a path alias), the path is the same for those menu items. So all translated links show up on all languages. At least that's the case for me.

/edit: But I have the same problem with http://drupal.org/project/i18_page_views – so the only way that works for me is creating nodes, adding them to the menu and displaying Views blocks inside of the nodes.

/edit: Hm, now it seems to work with http://drupal.org/project/i18_page_views

Thanks

Kristen Pol's picture

Thanks for the tip... I was wondering if the path aliases were a good idea or not and now I'm thinking maybe not...

Kristen

Title?

mErilainen's picture

What about the title? If I can set a different path, the title should be different also...

Check this

Too complicated to be Drupal-way

moniuch's picture

Setting up a multilingual site is more difficult than Drupal era deserves, esp. when the paths and views go. i18_page_views should generate not only paths but also menu items, bind them into a path translation set, do that all automatically.
I also find it cumbersome to print urls in custom PHP (using url or l functions) so that they are looked up automatically. If, for instance, my view produces path "news", I would like to be able to put PHP one-liner as in : "print url('news')" and get proper links "/en/news", "/es/noticias", "/fr/nouvelles", etc. Currently my links are cross-rendered, as in "es/news" or absolute as is "/news".

And many many other nuisances.

So cloning a view is the only

pwiniacki's picture

So cloning a view is the only option for proper path to other language ?

Check

penyaskito's picture

Check https://www.drupal.org/project/i18_page_views, maybe it works for your usecase.

--
Christian López Espínola (@penyaskito)

Any solution for Drupal 8?

aaronsssp's picture

Any solution for Drupal 8?