Hi to all,
i’m starting to use Yii and I’m trying to adapt some default behaviors. One of them is the way Yii manage languages in URL.
The objective is get this kind of URLs for example:
subdomain.domain.com/search -> Language: en; Controller: search
subdomain.domain.com/es/buscar -> Language: es, Controller: search
subdomain.domain.com/fr/rechercher -> Language: fr, Controller: search
subdomain.domain.com/en -> Error 404. Default language do not require language code in url
subdomain.domain.com/es/search -> Error 404. Translated controller not found for language code ‘es’
So, I would like to translate controllers in URL and make that all controller translations point to same controller.
I’m investigating this extension: yiiframework.com/wiki/55/i18n-subdomains-and-url-rules that fits pretty well on what I want to get. The problem where i’m now is that this regular expression of this extension:
"/^(?<protocol>(http|https):\/\/)(((?<languageCode>[a-z]{2})\.)*)((.*\.)*(?<domain>.+\.[a-z]+))$/"
is based on language code in subdomain and I want language code as a path and I’m trying this but it fails getting it:
"/^(?<protocol>(http|https):\/\/)(((?<subdomain>[a-z]+)\.)*)((.*\.)*(?<domain>.+\.[a-z]+))(((?<languageCode>[a-z]{2})\.)*)$/"
I would appreciate if someone could detect the error on this regular expression.
Also if you know some other solution for getting URLs this way it would be very useful otherwise I will try to publish an extension with this kind of URLs.
Thank you!