Multilanguage Site
Permalink 3 users found helpful
Hi!
Internationalization and Localization is ready since August 25, 2009.
I've posted the code to the C5 Team, but they had not much time, due to the eCommerce block and the C5 5.3.3 Update.
However it'll hopefully go into the source in the next version.
If you need it asap, contact me.
Features:
- automatic country detection
- automatic locale detection
- one startpage that acts as any language automatically
- tld forwarding (.jp .de .us)
- subdomain forwarding de.example.org
- temporal forwarding (example.org/?lang=en)
- cookie remembers guests choice
- language switching by the hit of a flag
- works in the back- and frontend
TODO:
- multilang sitemap template
- automatic recognition of installed backend languages and offering an option to switch
- make switching the language in the backend look cooler
- plan an enterprise ready integration into the concrete5 back- and frontend
The information below is obsolete.
-----------------------------------------
Hi!
* Empty all content Blocks of your root document.
* Create a page called de_DE
* Create a page called en_US
* Now add Pages under those languages.
Example:
Home (root)
* de_DE (shorten url to "localhost/de")
- Home
- About
- Contact
* en_US (shorten url to "localhost/en")
- Home
- About
- Contact
Real world Example:
http://bit.ly/8BfqM (DE has one more entry, because the site has an interim page)
The ovious problem is that you get directed to the Home (root) first, when you visit localhost.
The solution is to add php code to geo-locate the IP (this is not always accurate), sniff for the browser language (you get >90% correct results) and if doesn't work for some reason , jump to your default language's path immediately.
If you're lazy you could simply add
to Home (root) which will automatically display your entry page in German.
It's clear that switching languages should always be possible, after the language detection. That's why you should add two flags on your site, which direct tohttp://localhost/de/home andhttp://localhost/en/home.
Don't forget to add a
to the de_DE page container in the Sitemap.
Do the same for the en_US page container but with /en/home in the meta url.
I hope this helps, the reason I didn't provide any code examples is that I'm just doing what I said :)
EDIT: It's much better to use something like instead of a meta refresh
If you need a great tutorial on howto realize a language detection, you should consider Stephanie's Blog athttp://bit.ly/oaol7
Best regards
Fernandos
Internationalization and Localization is ready since August 25, 2009.
I've posted the code to the C5 Team, but they had not much time, due to the eCommerce block and the C5 5.3.3 Update.
However it'll hopefully go into the source in the next version.
If you need it asap, contact me.
Features:
- automatic country detection
- automatic locale detection
- one startpage that acts as any language automatically
- tld forwarding (.jp .de .us)
- subdomain forwarding de.example.org
- temporal forwarding (example.org/?lang=en)
- cookie remembers guests choice
- language switching by the hit of a flag
- works in the back- and frontend
TODO:
- multilang sitemap template
- automatic recognition of installed backend languages and offering an option to switch
- make switching the language in the backend look cooler
- plan an enterprise ready integration into the concrete5 back- and frontend
The information below is obsolete.
-----------------------------------------
Hi!
* Empty all content Blocks of your root document.
* Create a page called de_DE
* Create a page called en_US
* Now add Pages under those languages.
Example:
Home (root)
* de_DE (shorten url to "localhost/de")
- Home
- About
- Contact
* en_US (shorten url to "localhost/en")
- Home
- About
- Contact
Real world Example:
http://bit.ly/8BfqM (DE has one more entry, because the site has an interim page)
The ovious problem is that you get directed to the Home (root) first, when you visit localhost.
The solution is to add php code to geo-locate the IP (this is not always accurate), sniff for the browser language (you get >90% correct results) and if doesn't work for some reason , jump to your default language's path immediately.
If you're lazy you could simply add
<meta http-equiv="refresh" content="http://localhost/de/home">
to Home (root) which will automatically display your entry page in German.
It's clear that switching languages should always be possible, after the language detection. That's why you should add two flags on your site, which direct tohttp://localhost/de/home andhttp://localhost/en/home.
Don't forget to add a
<meta http-equiv="refresh" content="http://localhost/de/home">
to the de_DE page container in the Sitemap.
Do the same for the en_US page container but with /en/home in the meta url.
I hope this helps, the reason I didn't provide any code examples is that I'm just doing what I said :)
EDIT: It's much better to use something like
header("Location:".BASEURL."/de/");
If you need a great tutorial on howto realize a language detection, you should consider Stephanie's Blog athttp://bit.ly/oaol7
Best regards
Fernandos
Can't I just use:
header("Location:".BASEURL."/de/");
but by doing this, you generate a second request which isn't necessary.. If your site has just a few hundred visitors per day you won't care, but if there are a few more it's a good thing to reduce everything you can.
It also doesn't change the url which some people might prefer.. Others not so much because you can have different pages by calling the same address. (an english one and a spanish or german one)
It also doesn't change the url which some people might prefer.. Others not so much because you can have different pages by calling the same address. (an english one and a spanish or german one)
Hey Remo,
we build some multi language sites and had to use this ugly meta redirects to change the first shown page. This way doesn't feel right.. it would be very nice if you could be a bit more explicit about your solution for this by setting the PATH_INFO..
we build some multi language sites and had to use this ugly meta redirects to change the first shown page. This way doesn't feel right.. it would be very nice if you could be a bit more explicit about your solution for this by setting the PATH_INFO..
open index.php an add something like this:
if you add this line before the dispatcher gets included you'll only see one page because .htaccess won't be able to set PATH_INFO (you would override it all the time).
Add some if's and else's and you're done (:
$_SERVER['PATH_INFO'] = '/my-sub-home';
if you add this line before the dispatcher gets included you'll only see one page because .htaccess won't be able to set PATH_INFO (you would override it all the time).
Add some if's and else's and you're done (:
Hi Remo,
thanks for your answer.. we tried to set the PATH_Info as you said, but we ran into the problem that we can't open the edit-mode anymore...
thanks for your answer.. we tried to set the PATH_Info as you said, but we ran into the problem that we can't open the edit-mode anymore...
this is not helping me either. with or without nice URLs turned on, /index.php/ part appears in some of the css and js locations, and they are not loaded. otherwise - yes, it finds the right page. maybe it has to do with theme?
OK. Here is how I've fixed it:
I'll try to do geoip stuff and hopefully post that as well.
if($_SERVER['REQUEST_URI'] == '/'){ //i.e. only if we're requesting homepage $_SERVER['PATH_INFO'] = '/defaultlanghome'; }
I'll try to do geoip stuff and hopefully post that as well.
http://www.js-vault.us/iscripts/004.html
Hi, Dutchwave and Remo!
I finished my work, it's not Javascript, but PHP which is more reliable.
I've currently a hacky setup, and have never written a C5 Block, but it shouldn't be hard. So I'll release a block for language-detection and redirection soon, as I finish my corp. project here.
Should be next week.
Cheers
Fernandos
EDIT: haha next week :D a corp project finishes never.. I shoulda know that :P
It's not a block! But a couple of php files and libraries.
I finished my work, it's not Javascript, but PHP which is more reliable.
I've currently a hacky setup, and have never written a C5 Block, but it shouldn't be hard. So I'll release a block for language-detection and redirection soon, as I finish my corp. project here.
Should be next week.
Cheers
Fernandos
EDIT: haha next week :D a corp project finishes never.. I shoulda know that :P
It's not a block! But a couple of php files and libraries.
I have a bilingual site - English and Japanese. espmasia.com. (Japanese pages are not linked yet - add /index.php/jp
At the moment the links in footer.php are in English and point to the English pages. I need to have a different footer for the japanese pages only. How/where do I write the code so that the correct footer links are displayed for the corresponding languages?
Yoroshiku! Danii
At the moment the links in footer.php are in English and point to the English pages. I need to have a different footer for the japanese pages only. How/where do I write the code so that the correct footer links are displayed for the corresponding languages?
Yoroshiku! Danii
I'm thinking I need to create another file called footer_jpns.php
Then create a new set of page types for the Japanese site, renamed with a "_jpns" extension and change the footer include at the bottom of each page type.
Will try this anyway. If there's a guru way, let me know!
Then create a new set of page types for the Japanese site, renamed with a "_jpns" extension and change the footer include at the bottom of each page type.
Will try this anyway. If there's a guru way, let me know!
you might consider keeping your page types functional, and have a US/JP theme instead. You could basically take all the files from one and copy them to the other.. you could even have core elements you included in both.
This should make it really easy to extend what your site can do by adding page types, and then just make sure you translate the interface from one theme to the other.
Once you pick a different part of your theme for an area on the site, all the pages below it will follow that theme. If you set things up right from the get go, this should all be pretty simple to manage.
This should make it really easy to extend what your site can do by adding page types, and then just make sure you translate the interface from one theme to the other.
Once you pick a different part of your theme for an area on the site, all the pages below it will follow that theme. If you set things up right from the get go, this should all be pretty simple to manage.
no, It's pretty easy.
just compare a session variable's content and do something.
just compare a session variable's content and do something.
hi fernandos
have you finished this block now? would be interested in using it.
thanks
have you finished this block now? would be interested in using it.
thanks
hi alemao!
It's not a block, because it a bit more complex. However usage is easy, if you understand how it works.
If you need it asap, you can contact me and I'll try to help you.
It's not a block, because it a bit more complex. However usage is easy, if you understand how it works.
If you need it asap, you can contact me and I'll try to help you.
hi fernandos,
i'm also very intersted in the multi-language detection. could you please post your final solution here? would be very nice.. thanks!
i'm also very intersted in the multi-language detection. could you please post your final solution here? would be very nice.. thanks!
I am very curious about this solution aswell. Any chance to get your examplecode?
What's been going on is a lot of alpha ideas and different approaches that have up sides and down sides.. There isn't really a shrinkwrapped solution that would work for everyone in sight yet..
-frz
-frz
Yes ! please Fernando would you send me the code of your multi-language system. You can't imagine how much I really need that for my job at the moment.
Thank you very much for the great work ;-)
Best'
--phazerz
Thank you very much for the great work ;-)
Best'
--phazerz
I'm sorry, but as Franz stated before, the code I've written is not ready for the public and so not production ready.
But I can try to help you, if you want to.
pm me your e-mail^
But I can try to help you, if you want to.
pm me your e-mail^
Hi @all,
i visit this post every few weeks, but it seems to be dead.
Has anybody found a real production ready solution for the mulit-language approach with concrete5?
thanks in advance... Sebastian
i visit this post every few weeks, but it seems to be dead.
Has anybody found a real production ready solution for the mulit-language approach with concrete5?
thanks in advance... Sebastian
there's a lot of stuff going on in the subversion. It uses a completely different approach (compared to what Fernandos did) but I prefer it because it's simpler..
Probably in 5.4 (but I'm not a core team member, no promises from my side possible)
Probably in 5.4 (but I'm not a core team member, no promises from my side possible)
Hi,
C5 really really rocks! I've just got it and I'm loving it!
However, multilingual stuff is makings things hectic for me.
Remo: Is there any documentation about the stuff in SVN you mentioned?
Thanks
C5 really really rocks! I've just got it and I'm loving it!
However, multilingual stuff is makings things hectic for me.
Remo: Is there any documentation about the stuff in SVN you mentioned?
Thanks
I had problem with multilanguage site, but I solved it this way:
I had to do website in 4 languages.
I created 4 main directories:
Home
|--eng
|---about
|---offer
|---news
|---contact
|--de
|--pl
|--ru
In every lang. directory it's the same subpages (about, offer, etc.).
For main directories I added new attribute, which allows to display image menu.
This menu displays the flags and redirects to the appropriate languages.
On every pages are header nav too, but display second level.
And when I go to the site in some main directory (eg. offer in english version), the flag is highlighted.
Problem with the Home, I solved in .htaccess.
I add DirectoryIndex index.php/eng and my default site is eng.
And everything works very well.
I had to do website in 4 languages.
I created 4 main directories:
Home
|--eng
|---about
|---offer
|---news
|---contact
|--de
|--pl
|--ru
In every lang. directory it's the same subpages (about, offer, etc.).
For main directories I added new attribute, which allows to display image menu.
This menu displays the flags and redirects to the appropriate languages.
On every pages are header nav too, but display second level.
And when I go to the site in some main directory (eg. offer in english version), the flag is highlighted.
Problem with the Home, I solved in .htaccess.
I add DirectoryIndex index.php/eng and my default site is eng.
And everything works very well.
hi CSSNinja!
Btw I like ya nick, especially because I like css much.
However your approch might work, but it's causing an additional request on every page view, via htaccess. htaccess files are generally performance eaters, that's why you shouldn't use htaccess where possible and copy the configuration into your httpd.conf or a subconfiguration file instead.
An easy and decent way of creating a multilanguage site, as I did is using condidtional content areas in your theme.
And you need to create and hook a language_detection file, which you migh copy into your tools (not concrete/tools) folder. After that you have to call that file on_before_render in example. Though it's easier to create a custom navigation and load that file from there.
I just didn't release my script, because c5 will bring out it's own multilanguage support and supporting two different approaches is bad. Though it's available for those who are in the beta team (beware, it's probably the longest thread in this forum).
;)
Btw I like ya nick, especially because I like css much.
However your approch might work, but it's causing an additional request on every page view, via htaccess. htaccess files are generally performance eaters, that's why you shouldn't use htaccess where possible and copy the configuration into your httpd.conf or a subconfiguration file instead.
An easy and decent way of creating a multilanguage site, as I did is using condidtional content areas in your theme.
And you need to create and hook a language_detection file, which you migh copy into your tools (not concrete/tools) folder. After that you have to call that file on_before_render in example. Though it's easier to create a custom navigation and load that file from there.
I just didn't release my script, because c5 will bring out it's own multilanguage support and supporting two different approaches is bad. Though it's available for those who are in the beta team (beware, it's probably the longest thread in this forum).
;)
This is what I did for
http://www.jffla.org/2010/
http://www.jffla.org/2010/
<?php // get current cPath and replace /ja to /en $jfflapagevieworiginal = View::getViewPath(); $jfflapageviewreplaced = str_replace ('/en', '/ja', $jfflapagevieworiginal); ?> <p align="center"> <a href="<?php echo BASE_URL . DIR_REL . $jfflapageviewreplaced ?>/">Japanese</a></p>
Did this ever get released?
Yes, it's been in the beta forums available for a long time now.
But you should usehttp://www.concrete5.org/marketplace/addons/internationalization/... to get basic multilanguage features working. If you need more than that there is an expensive addon made by the core Team. You don't neccessarily need it though.
But you should usehttp://www.concrete5.org/marketplace/addons/internationalization/... to get basic multilanguage features working. If you need more than that there is an expensive addon made by the core Team. You don't neccessarily need it though.
hi!i have a question.
in the option multilingual shows me this:"You don't have any interface languages installed. You must run concrete5 in English."
maybe i do something wrong...where i have to put my multilingual folder?in the folder"languages",right? i would appreciate an answer from you because i am really confused.thanks
in the option multilingual shows me this:"You don't have any interface languages installed. You must run concrete5 in English."
maybe i do something wrong...where i have to put my multilingual folder?in the folder"languages",right? i would appreciate an answer from you because i am really confused.thanks
You can add some code to index.php that checks geoip or browser language and set PATH_INFO to the url you want to display.