Hi all,
I would like to ask your suggestions about an issue on which I am working:
Imagine a website which has been prepared in a few languages, such as english (en), German (de), Italian (it) etc.
By the way, English is the main/base one.
If I set up the base url for the domain like mywebsite.com, there is no problem to switch to other languages such as : mywebsite.com/de or mywebsite.com/it. Because the site works for English as the base : mywebsite.com/about-us, mywebsite.com/blog-detail etc.
But if I set up the base url for
/en , then how can I route for the other languages?
Because my pages are like these:
Code:
$routes->get('en', 'SiteEn::index_en');
$routes->get('en/products', 'SiteEn::product_categories_en');
$routes->get('en/product-detail/(:segment)', 'SiteEn::product_detail_en/$1');
$routes->get('en/contact', 'SiteEn::contact_en');;
$routes->get('en/(:segment)', 'SiteEn::other_pages_en');
//For Other Languages
???
As I don't know which language can the site owner sets in admin panel, I cannot fix it like :
PHP Code:
$routes->get('it/prodotti', 'SiteIt::categori_dei_prodotti_it');
On the contrary it must be aranged automaticaly: (What I want and need):
PHP Code:
$routes->get('-any-language-/-any-segment-', 'SiteOtherLangs::products_other_lang');
As I said if I set the base url for
"/en" , it works like: mywebsite.com/en/it,
not like mywebsite.com/it
What would you suggest for this kind of problem and how do you handle this kind of problem?
Regards