0

Wondering what solutions people might have for mapping urls in multilingual sites. Our structure is basically:

en/template/english_article

Where each channel has the custom fields for each language set in this way:

field1_en, field1_es, field1_de - field2_en, field2_es

All fine but the nav is primarily by a language drop down. So someone on the page: en/template/english_article would select, say, Spanish from the menu and be taken to the equivalent Spanish page in the ES template group: es/template/english_article

This would show the Spanish content fine but the 'english article' part of the url should map to a Spanish equivalent...but this seem not so easy to do with the structure of nav by drop down - basically because the url_title will always be the same.

Has anyone run into this issue? Any workarounds or plugins to resolve it? Cheers!

1

There's a comment on EE Insider that may be useful to you. It has been contributed by ignitesystemsltd. Thanks for that!

Our client wanted a multi language URL_TITLE which would at first seem to be impossible out of the box with the built in URI handling. BUT we overcame this by a simple mechanism:

On the page template that renders the singular item (the details page for a property listing in our case), the client want different URLS for the same item, we created a new field with naming convention {language}_url_title and then the url title could be set for each language.

On details page we switched on PHP parsing and used:

$outvar = ""; $langvar = "{language}";

if ($langvar == "en") { $outvar = $outvar . 'search:en_url_title="{last_segment}" '; }

if ($langvar == "de") { $outvar = $outvar . 'search:de_url_title="{last_segment}" '; }

if ($langvar == "swe") { $outvar = $outvar . 'search:swe_url_title="{last_segment}" '; }

This php builds up the search for the URL title.

Then the entries tag looks something like this:

{exp:channel:entries channel="property" [php echo $outvar] limit="1"}

I had to use square brackets in line above but you should put proper notation of opening and closing php tag, this window didnt allow it.

The {last_segment} tag dynamically returns the url title from the current URL. You must simple ensure that you render the correct language url from wherever you want to link from. We are doing this from a search result and rendering the correct link with:

{{language}_url_title}

Hope this makes sense.

0

You really want to consider the Transcribe add-on by EEHarbor. It offers URL translation routing and much more. It will 100% solve the problem you have now. Plus, you don't need separate channel fields for each language.

If you have any questions about implementing Transcribe, don't hesitate to ask here on StackExchange.

For your reference: I built this hotel website with Transcribe and you can see the different URLs for the Dutch version

0

As well as the conventional multi-language add-ons such as Transcribe you could achieve this using Structure, the Pages module or perhaps even the new template routing in EE 2.8.

I have done something like this with structure where each language's "home" page was given a url based on their country code. For instance /en or /de.

The entries/pages for the different translations were then placed under these pages. This means each entry/page can have it's own language specific URL.

Obviously this means you have to create different entries for each language but that may not be a bad thing and really depends on the nature of your site and how you want it to be managed.

It might also be possible to use the first url segment (the language code) and feed that into your field tags to make things a bit easier for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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