Reputation: 109
I'm working on a project with CodeIgniter. I am using the specific language class to show the content in different languages. Now I need to translate the URL in the selected language.
For example: www.domain.com/book/category
to www.domain.com/buch/kategorie
How can I do it?
Upvotes: 0
Views: 561
Reputation: 912
You will have to create different controllers showing the same views (that should be translated themselves)
then links will make call to relevent controller language.
this will work only if you decide to make your urls like
host/lang/something
like
www.domain.com/en/book/category
towww.domain.com/de/buch/kategorie
if your controllers are nameden
andde
Controllers' and functions' names should be saved in languge files
You can search here on stackoverflow for methods about setting language from cookies or session if are not already doing this
If you find any better suggesstion please share
Upvotes: 0
Reputation: 26153
I think, you can use route fo this, as:
route['buch/kategorie'] = 'book/category';
The second aspect of the problem - the generation of links in different languages for view. You should write some code for this
Upvotes: 2