Jump to content
Sign in to follow this  
mjut

One URL for multiple languages

Recommended Posts

Hi forum,

I have got a question for a multi-language page: English and Danish.
I want to give away URLs, no matter if the users language is.

www.url.com/en/title1  (default language)
www.url.com/dk/title1

If I type www.url.com/title1 the page is being redirected to the default language – even if I previously did chose Danish as my language.

Is it possible, that the users prefered language is the redirct? Say, if I choose to view the page in Danish and type www.url.com/title1 I want the redirect to www.url.com/dk/title1 not to the default language.

Thanks for suggestions and help
Stephan

Share this post


Link to post
Share on other sites

@mjut Please don't place your question in more than one place.

I read both of your posts, but I'm still not sure about the whole scenario.

On 3/19/2020 at 3:39 PM, mjut said:

If I type www.url.com/title1 the page is being redirected to the default language – even if I previously did chose Danish as my language.

Please define what "even if I previously did chose Danish" actually means. Where and how did that choice happen? Did you create a link that stores language preference in a cookie or session?

On 3/19/2020 at 3:39 PM, mjut said:

Is it possible, that the users prefered language is the redirct? Say, if I choose to view the page in Danish and type www.url.com/title1 I want the redirect to www.url.com/dk/title1 not to the default language.

In your other post, you mentioned that visitors are coming to your site via QR codes. If you want people to see your Danish language content, then simply use your Danish language URL for the QR code, not the default one.

There are many different strategies how to tackle such things, e.g. detect the user's browser default language and (if necessary) do a redirect. Or make the user click somewhere and store his/her preference in a cookie or session.

From a usability point of view, you would create your landing page in a way that the users can quickly and intuitively switch language versions, if needed. The default PW multilang site profile has a nice commented working example (how to dynamically switch languages).

Bottomline: If you did your homework re: information architecture / UX, no special technical "trickery" is needed. Just make sure your navigation and everything else (breadcrumbs...) in your site setup takes ML into account, and once the visitor is on "his/her" language version, they know how to get their respective language content.

Share this post


Link to post
Share on other sites
@dragan thank you for answering!

I 100% agree with everything you wrote. (including the multiple posting. that was due to me searching the forum and collectiong information).
Usually, I don't need a differnt way of handling a multi-lang site. The processwire way just works and is fine and is straight forward for me.

This project I am working on is different. Processwire is providing and delivering the content. But there wont be any UX and no navigation. 
 
We will have lots of texts in the museum, each text is accompanied by a QR-Code for the translation into 2–3 languages. (so, QR-Codes all over the museum)
 
The visitors need to scan a QR-Code to get to the specific page containing the translation. To clarify this procedure, I can think of two versions to achieve this.
The first one is the usual processwire-way (like in the provided multi-lang-profile). The second one is my desired one, that I need help with. 

1. simple solution
  • for each language, there will be one QR-Code (each text in the musuem is accompanied with multiple QR-Codes to choose from)
  • the Visitor scans one of them and the language specific url will be opened
  • conclusion: Each text needs more QR-Codes … one for each language. Thats ugly, and if there will be more language later on, I’d need to add even more QR-Codes…
 
2. wanted solution
  • there will be only one QR-Code to scan for the visitors, no matter what language  - thats much nicer than several QR-Codes
  • the visitor scans that one QR-Code, and will be send to the default language. 
  • there will be a lnaguage-switch. So, the visitor can set the desired language.
  • the visitor scans the QR-Code for the next text, the visitor will be directed to the previously set language. (without need to set the language switch again)
            - if there will be the need to add more languages later on, I can add these in processwire without managing more QR-Codes
 
I hope, this explains the whole project… 😉
 
@dragan I like both of your suggestions – the detection of the browsers language and the cookie storage.
I did look into the API to set a cookie (session storage?) but I did not understand the techniques described there. No luck for me there… I am going to look into the browser-language detection now.
 
 
Cheers
Stephan

Share this post


Link to post
Share on other sites

Oh, I wasnt aware, that there's a module. I am sure, this will lead me to a solution.

Thanks a lot, this is very helpful!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...