Multiple Language App

Hey, so I’m building a multi language app. Let’s say we have 2 languages, en and fr. I’m using the localeurls extension to implement the language key (en, fr) into the URL, and I also add UrlRules for each language. For example, I will have:

‘loginEN’ => ‘site/login’ - when the language is en

‘loginFR’ => ‘site/login’ - when the language is fr

My problem is, how do I make a widget for changing the language, redirecting to the current URL, but in the new language that was selected. If I am on, when building the link for fr language, I would get not . Why? Because createUrl creates my link based on current URL rules. But I have new rules for fr, that get inserted dynamically, and apply of course, only after the app reloads with the new language code in the URL.

So what I want to do, is create a link to the current URL, with the new language code, and using the ‘future’ UrlRules for that language. Is that possible ? I guess not … One way I could do this is when creating the URL, temporary ignore the UrlRules, and create a link having the controller/action in original form, no rules applied. Then the new rules would get applied when the link is clicked and the app refreshed. How do I do that ?

Thank you !

I wonder, why you want two different login URLs loginEN/loginFR. It’s the whole point of the extension to let it take care of language detection from the URL for you. No extra rules required. So why do you think, you need these two loginEN/loginFR URLs?

What’s wrong with these:



Well login is generic, works in both languages.

My languages are ro (romanian) and en (english). Let’s say I have a ski slope. In romanian, ski slopes = partii ski.

So, I would like to have : and in english One of the main reasons for this is SEO.

Anyways, this seems like impossible, so I’m gonna end up redirecting the user to the site index if he changes the language, and not the current page he was on.

PS : the extension is wonderful, I love it.