Feature request: set site language on a page-basis
Permalink
I'm going to publich a website with multiple languages.
The root language will be English, and other languages are published under language-specific "folders". What I mean is:
/ => English home
/... => English pages
/es => Spanish home
/es/... => Spanish pages
/it => Italian home
/it/... => Italian pages
and so on
concrete5 version 5.4.2 has redefined the way the language is defined, and now it's more flexible.
To implement my website I've followed these steps:
1) I defined a page attribute called "language", of type "Select" with the following values: "en_US", "es_ES", "it_IT".
2) I added this "language" attribute to the "/", "/es" and "/it" pages, each one with the appropriate value
3) I've modified the /concrete/dispatcher.php file adding, before the line "## Localization ##" the following lines:
## Localization - Custom ##
if (file_exists(DIR_BASE . '/config/site_locale.php')) {
require(DIR_BASE . '/config/site_locale.php');
}
4) I've created the file "/config/site_locale.php" that reads the current page language and sets the SITE_LOCALE define (you can see it attached to this message).
It would be nice if concrete5 would include my edit at 3) by default, since maybe other users may want to do the same thing I've done... And this approach is consistent with concrete5 (see for example the inclusion of /config/site_post.php and /config/site_process.php).
Thank you
Michele
The root language will be English, and other languages are published under language-specific "folders". What I mean is:
/ => English home
/... => English pages
/es => Spanish home
/es/... => Spanish pages
/it => Italian home
/it/... => Italian pages
and so on
concrete5 version 5.4.2 has redefined the way the language is defined, and now it's more flexible.
To implement my website I've followed these steps:
1) I defined a page attribute called "language", of type "Select" with the following values: "en_US", "es_ES", "it_IT".
2) I added this "language" attribute to the "/", "/es" and "/it" pages, each one with the appropriate value
3) I've modified the /concrete/dispatcher.php file adding, before the line "## Localization ##" the following lines:
## Localization - Custom ##
if (file_exists(DIR_BASE . '/config/site_locale.php')) {
require(DIR_BASE . '/config/site_locale.php');
}
4) I've created the file "/config/site_locale.php" that reads the current page language and sets the SITE_LOCALE define (you can see it attached to this message).
It would be nice if concrete5 would include my edit at 3) by default, since maybe other users may want to do the same thing I've done... And this approach is consistent with concrete5 (see for example the inclusion of /config/site_post.php and /config/site_process.php).
Thank you
Michele
http://www.concrete5.org/marketplace/addons/internationalization/...