Hi all, I test a modif to have a multi- lang frontend. I know ... it's not multi-lang content, but I think that it's important to understand the front end if you want to buy products for which there are pics instead of explanation in your native language.
I show you the hack. All expert comments are welcome !
In index.php you add just after extract( $_GET );
----------------------------------- if( !function_exists( 'detect_language' ) ){ function detect_language() {
// compute language choice $ltu = detect_language(); if (file_exists(DIR_LANG.$ltu.'.php')) { // include the right language file require_once DIR_LANG.$ltu.'.php'; } else { require_once DIR_LANG.LANGUAGE.'.php'; // default language file to config } -----------------------------------
In index.php you delete the line require_once DIR_LANG.LANGUAGE.'.php';
So you can : - detect the prefered language of your browser and check with the languages you choose in $available_languages array - look at your cookie - accept index.php?l=xx
Have fun
Senior Security Network Consultant
gmcms
2005-09-12 22:48
I ask a question to myself : is it possible to do the same thing in plugin ? I don't know how to transform this hack in plugin. It seems to be difficult without changing anything in the core code.
Senior Security Network Consultant
re-aktor
2006-09-13 16:51
doesnt work for me... just
Error: Warning: require_once(DIR_LANGLANGUAGE.php) [function.require-once]: failed to open stream: No such file or directory in /srv/www/htdocs/web211/html/shoptest/index.php on line 78
Fatal error: require_once() [function.require]: Failed opening required 'DIR_LANGLANGUAGE.php' (include_path='.:/usr/local/php5/lib/php:/srv/www/htdocs/confixx/html:/srv/www/htdocs/confixx/html/include') in /srv/www/htdocs/web211/html/shoptest/index.php on line 78
mhh i would like to get an english one too.....
bron
2006-09-13 23:53
require_once(DIR_LANG. LANGUAGE.php) will probably working
re-aktor
2006-09-14 05:14
mhh no that doesnt work but ive got an idea which works for me! i have to copy the snippet of gmcms to another place (where normaly the require_once DIR_LANG.LANGUAGE.'.php'; is) and then it works!!!
// compute language choice $ltu = detect_language(); if (file_exists(DIR_LANG.$ltu.'.php')) { // include the right language file require_once DIR_LANG.$ltu.'.php'; } else { require_once(DIR_LANG. LANGUAGE.php); // default language file to config }