The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
|
COMPLETE Theme I18N (HERE'S THE CODE) - Printable Version +- GetSimple Support Forum (http://get-simple.info/forums) +-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3) +--- Forum: Developer Discussions (http://get-simple.info/forums/forumdisplay.php?fid=8) +--- Thread: COMPLETE Theme I18N (HERE'S THE CODE) (/showthread.php?tid=2460) |
COMPLETE Theme I18N (HERE'S THE CODE) - lacroixca - 2011-12-04 I would need one thing to get along with GetSimple: theme localization. You can check out a working example of how I did it: http://http:getsimple.mechantdesign.com/ Look at how I've worked it out: 1) Define localization variable in gsconfig.php: Code: define('GSTHEMEI18N', 'true'); /* Expected urls have now the following form: http://example.com/fr_FR/ */ ********** 2) Changing the .htaccess rewrite rule to: Code: RewriteRule ^(.*)$ index.php?id=$1 [QSA,L] /* This will send the whole query string to index.php. This can be helpful for many other things too. */ ********** 3) Do a little bit more parsing in index.php: Code: if (isset($_GET['id'])) { /* We now have a very informative array that we'll break down differently depending on if the the theme I18L is true */ Code: if (GSTHEMEI18N) { /* Another function should be use to associate .../fr/ to .../fr_FR/ */ Code: # define page, spit out 404 if it doesn't exist ********** 4) Create a language hierarchy in the data/pages folder, so that we would have both of these pages: en_US/i-love-get-simple.xml & fr_FR/i-love-get-simple.xml ********** 5) Modify the "get_navigation" function in admin/inc/theme_functions.php to change "$path": /* At the very top of the function... */ Code: //right here ********** 6) Modify the "find_url" function in admin/inc/basic.php to change output: /* At the top of the function... */ Code: if ($type == 'full') { ********** 6) Create a special function, ressembling the "find_url" function in admin/inc/basic.php to change output the same page in other languages: Code: function find_local_current_url($link_lang) { /* This function is a quick fix... a lot needs to be done to make it more versatile */ **************************************** ON THE SIDE: I would also suggest to redirect url without trailing slashe to a with-slash url using the following .htaccess rule, as some search engine may consider these 2 pages as distinct (yet identical) and mark them as duplicated content. Code: RewriteCond %{REQUEST_FILENAME} !-f **************************************** Please let me know what you think of the code! I haven't check for all the admin stuff, but I don't think it will be very complicated. It's really all I need to choose GetSimple as my CMS for my next project Please, I need feedback! Thank you! COMPLETE Theme I18N (HERE'S THE CODE) - ccagle8 - 2011-12-05 I feel like this would be a great addition if we ever add mvcek's plugin to the core... This would be a great starting point to add it in. Thanks for the tutorial... i'm sure it will help many people here! COMPLETE Theme I18N (HERE'S THE CODE) - lacroixca - 2011-12-05 Hi Chris, Thanks for the reply ! Can you tell me what exactly do you refer to when you write mvcek's plugin? COMPLETE Theme I18N (HERE'S THE CODE) - mvlcek - 2011-12-06 lacroixca Wrote:Hi Chris, The I18N plugin does all this and more without patching the GetSimple core. |