Re: cakephp multilingual + route
YES THIS IS THE SOLUTION that i want! Thank you Zaky. You really help me lot. Regards, Jason On Apr 5, 12:21 pm, Zaky Katalan-Ezra procsh...@gmail.com wrote: http://stackoverflow.com/questions/1794412/adding-a-prefix-to-every-u... -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: cakephp multilingual + route
http://stackoverflow.com/questions/1794412/adding-a-prefix-to-every-url-in-cakephp -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: cakephp multilingual site
There is a section in the cookbook about localization: http://book.cakephp.org/view/163/Localization-in-CakePHP This is a function from one of my apps that should do the trick: /* * Sets the language */ private function _setLanguage($lang = null) { if ($this-Cookie-read('lang') !$this-Session- check('Config.language')) { $this-Session-write('Config.language', $this-Cookie- read('lang')); } else if (isset($lang) ($lang != $this-Session- read('Config.language'))) { $this-Session-write('Config.language', $lang); $this-Cookie-write('lang', $lang, null, '20 days'); } $this-set('currentLanguage', $lang); } On Jul 7, 9:29 am, Yasir Arafat Hasib arafa...@gmail.com wrote: Please help me in cakephp multilingual site. If you have any tutorial about this please send -- Thanks regards. Yasir Arafat (Hasib) Software Engineer Epsilon Consulting and Development Services (ECDS) Contact Information: Cell : +8801816536901 Web:http://arafats.info Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: cakephp multilingual site
http://bakery.cakephp.org/articles/view/p28n-the-top-to-bottom-persistent-internationalization-tutorial Also use this in your layout echo $this-Html-css('default'); if($this-Session-read('Config.language') == 'he_IL') { echo $this-Html-css('default_rtl'); } when default_rtl only override values like this #container { text-align: right; direction:rtl; } On Wed, Jul 7, 2010 at 10:29 AM, Yasir Arafat Hasib arafa...@gmail.comwrote: Please help me in cakephp multilingual site. If you have any tutorial about this please send -- Thanks regards. Yasir Arafat (Hasib) Software Engineer Epsilon Consulting and Development Services (ECDS) Contact Information: Cell : +8801816536901 Web: http://arafats.info Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en -- Regards, Zaky Katalan-Ezra QA Administrator www.IGeneriX.com Sites.IGeneriX.com 054-7762312 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Cakephp multilingual
Yannis, I think you are using the translate behavior. Try this everytime user changes language: if (!class_exists('L10n')) { App::import('Core', 'L10n'); } $l10n = new L10n(); $l10n-get($lang); On Jul 29, 8:37 am, Yannis ikasso...@gmail.com wrote: I can see from the debug output that when I click on the code you have given me for changing language there is no change on the database request. I have tried different language codes but nothing. The only thing that can bring a change to the database is if I change the Configure::wite ('Config.language'... on the core.php or if I set the locale on the articles_controller.php like this $this-Article-locale = 'gre'; I cannot find other way to change the language of the database query. The code you've provided for changing language: - ?php $currLang = Configure::read('Config.language'); if ($currLangca $currLangspa) { $currLang = ca; Configure::write('Config.language',$currLang); } ? li?php echo ($currLangca) ? 'a href='.router::url (/).'lang/ caCatalagrave;/a' : 'Catalagrave;' ; ?/li li?php echo ($currLangspa) ? 'a href='.router::url (/).'lang/ spaCastellano/a' : 'Castellano' ; ?/li - Does not work 100%. It can change the i10n language to greek but then it does not change currLang L On Jul 28, 5:17 pm, leop ponton@gmail.com wrote: Do I have to add something else to change the database locale? No, I don't think so. That's all I have! I can only suggest that you look carefully at the folder names and the two or three letter acronyms to ensure that you have the correct ones in the correct places. Start with just two languages that have standard acronyms, e.g. en / eng es / spa. That way you can be certain which goes where. This page might help (it takes a while to load):http://www.sil.org/iso639-3/codes.asp?order=scopeletter=%25 L --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cakephp multilingual
Thank you guys, Djogo, what exactly do you mean here?? - check if the locale is installed in your system. sometimes it's lang.encoding, like pt_BR.UTF-8 instead of pt_BR Where do I check that? On Jul 28, 2:33 pm, djogo djogopat...@gmail.com wrote: Hey I spent many time trying to figure out how to make i18n work... I'm not following this topic realtime, but I'd like to post some tips that would really had helped me back then: - always use utf-8, no matter what's the language you're i18ng - check if the locale is installed in your system. sometimes it's lang.encoding, like pt_BR.UTF-8 instead of pt_BR - do not use non-ascii (?) characters in the source code messages. like, _(Tá certo) won't work with gettext. You'll probably want to use _(Ta certo) - for that reason, if your main language is not english or something that doesn't use non-ascii characters, you'll need to translate it if you want to display the correct words - it's frustrating to try to change the .mo files real-time, as you'll need to reload apache (or whatever) everytime. the reason is that apache likes to keep .mo files cached, and won't reload it unless you shut it down and start it again. that's all I remember for now. hope it helps. fell free to contact me pvtly. dfcp On Jul 28, 5:37 am, leop ponton@gmail.com wrote: I can't see what is causing the problem, but it is a warning rather than an error. It seems to indicate that the code executed okay, but the headers had already been sent. If you have copied pasted the code, you may have picked up a space after the ? in p28n.php (I see by swiping the code that there is one in my fragment). L On Jul 28, 7:29 am, Yannis ikasso...@gmail.com wrote: Hi leop, Thanks for the code. I've used it but I get the following error: Warning (2): Cannot modify header information - headers already sent by (output started at .../config/routes.php:49) [CORE/cake/libs/ controller/components/cookie.php, line 364] If that rings any bell?!?! Looks like the line that is causing this is the p28n.php: $this-change(($this-Cookie-read('lang') ? $this-Cookie-read ('lang') : 'eng')); Have you had that? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cakephp multilingual
I can see from the debug output that when I click on the code you have given me for changing language there is no change on the database request. I have tried different language codes but nothing. The only thing that can bring a change to the database is if I change the Configure::wite ('Config.language'... on the core.php or if I set the locale on the articles_controller.php like this $this-Article-locale = 'gre'; I cannot find other way to change the language of the database query. The code you've provided for changing language: - ?php $currLang = Configure::read('Config.language'); if ($currLangca $currLangspa) { $currLang = ca; Configure::write('Config.language',$currLang); } ? li?php echo ($currLangca) ? 'a href='.router::url (/).'lang/ caCatalagrave;/a' : 'Catalagrave;' ; ?/li li?php echo ($currLangspa) ? 'a href='.router::url (/).'lang/ spaCastellano/a' : 'Castellano' ; ?/li - Does not work 100%. It can change the i10n language to greek but then it does not change currLang L On Jul 28, 5:17 pm, leop ponton@gmail.com wrote: Do I have to add something else to change the database locale? No, I don't think so. That's all I have! I can only suggest that you look carefully at the folder names and the two or three letter acronyms to ensure that you have the correct ones in the correct places. Start with just two languages that have standard acronyms, e.g. en / eng es / spa. That way you can be certain which goes where. This page might help (it takes a while to load):http://www.sil.org/iso639-3/codes.asp?order=scopeletter=%25 L --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cakephp multilingual
I'm not sure I fully understand you here. The $currLang routine is just there to switch the language between link text. It's really just aesthetic. I don't do any language switching on the database. This just pulls messages out of the po files in the required language. Leo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cakephp multilingual
Hello Yannis Your system must have the specified locale installed, or else the setlocale function won't work. You can check whether it's working or not by doing this: $l = 'es_ES'; echo trying to set locale to $l...; $x = setlocale( LC_ALL, $l ); echo $x ? locale successfully setbr : couldn't set localebr; In linux, you can check the installed locales by typing, in the terminal # locale -a or by listing the contents from /usr/share/locale/locale.alias (ubuntu) (Don't know how to do it on Windows ou OSX, sorry). The $l variable in the example above should be _exactly_ as listed in the command above, or else setlocale will fail. Hope that helps, dfcp On Jul 29, 7:34 am, Yannis ikasso...@gmail.com wrote: Thank you guys, Djogo, what exactly do you mean here?? - check if the locale is installed in your system. sometimes it's lang.encoding, like pt_BR.UTF-8 instead of pt_BR Where do I check that? On Jul 28, 2:33 pm, djogo djogopat...@gmail.com wrote: Hey I spent many time trying to figure out how to make i18n work... I'm not following this topic realtime, but I'd like to post some tips that would really had helped me back then: - always use utf-8, no matter what's the language you're i18ng - check if the locale is installed in your system. sometimes it's lang.encoding, like pt_BR.UTF-8 instead of pt_BR - do not use non-ascii (?) characters in the source code messages. like, _(Tá certo) won't work with gettext. You'll probably want to use _(Ta certo) - for that reason, if your main language is not english or something that doesn't use non-ascii characters, you'll need to translate it if you want to display the correct words - it's frustrating to try to change the .mo files real-time, as you'll need to reload apache (or whatever) everytime. the reason is that apache likes to keep .mo files cached, and won't reload it unless you shut it down and start it again. that's all I remember for now. hope it helps. fell free to contact me pvtly. dfcp On Jul 28, 5:37 am, leop ponton@gmail.com wrote: I can't see what is causing the problem, but it is a warning rather than an error. It seems to indicate that the code executed okay, but the headers had already been sent. If you have copied pasted the code, you may have picked up a space after the ? in p28n.php (I see by swiping the code that there is one in my fragment). L On Jul 28, 7:29 am, Yannis ikasso...@gmail.com wrote: Hi leop, Thanks for the code. I've used it but I get the following error: Warning (2): Cannot modify header information - headers already sent by (output started at .../config/routes.php:49) [CORE/cake/libs/ controller/components/cookie.php, line 364] If that rings any bell?!?! Looks like the line that is causing this is the p28n.php: $this-change(($this-Cookie-read('lang') ? $this-Cookie-read ('lang') : 'eng')); Have you had that? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cakephp multilingual
Hi leop, Thanks for the code. I've used it but I get the following error: Warning (2): Cannot modify header information - headers already sent by (output started at .../config/routes.php:49) [CORE/cake/libs/ controller/components/cookie.php, line 364] If that rings any bell?!?! Looks like the line that is causing this is the p28n.php: $this-change(($this-Cookie-read('lang') ? $this-Cookie-read ('lang') : 'eng')); Have you had that? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cakephp multilingual
I can't see what is causing the problem, but it is a warning rather than an error. It seems to indicate that the code executed okay, but the headers had already been sent. If you have copied pasted the code, you may have picked up a space after the ? in p28n.php (I see by swiping the code that there is one in my fragment). L On Jul 28, 7:29 am, Yannis ikasso...@gmail.com wrote: Hi leop, Thanks for the code. I've used it but I get the following error: Warning (2): Cannot modify header information - headers already sent by (output started at .../config/routes.php:49) [CORE/cake/libs/ controller/components/cookie.php, line 364] If that rings any bell?!?! Looks like the line that is causing this is the p28n.php: $this-change(($this-Cookie-read('lang') ? $this-Cookie-read ('lang') : 'eng')); Have you had that? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cakephp multilingual
OK you were right! There was a space after the ? in routes. - However: i10n works / i18n doesn't work. Meaning the po messages change but the database locale is always eng. -Your code for language change stays the same, meaning that english is always the chosen lang Do I have to add something else to change the database locale? thanks On Jul 28, 11:37 am, leop ponton@gmail.com wrote: I can't see what is causing the problem, but it is a warning rather than an error. It seems to indicate that the code executed okay, but the headers had already been sent. If you have copied pasted the code, you may have picked up a space after the ? in p28n.php (I see by swiping the code that there is one in my fragment). L On Jul 28, 7:29 am, Yannis ikasso...@gmail.com wrote: Hi leop, Thanks for the code. I've used it but I get the following error: Warning (2): Cannot modify header information - headers already sent by (output started at .../config/routes.php:49) [CORE/cake/libs/ controller/components/cookie.php, line 364] If that rings any bell?!?! Looks like the line that is causing this is the p28n.php: $this-change(($this-Cookie-read('lang') ? $this-Cookie-read ('lang') : 'eng')); Have you had that? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cakephp multilingual
Do I have to add something else to change the database locale? No, I don't think so. That's all I have! I can only suggest that you look carefully at the folder names and the two or three letter acronyms to ensure that you have the correct ones in the correct places. Start with just two languages that have standard acronyms, e.g. en / eng es / spa. That way you can be certain which goes where. This page might help (it takes a while to load): http://www.sil.org/iso639-3/codes.asp?order=scopeletter=%25 L --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cakephp multilingual
Hey I spent many time trying to figure out how to make i18n work... I'm not following this topic realtime, but I'd like to post some tips that would really had helped me back then: - always use utf-8, no matter what's the language you're i18ng - check if the locale is installed in your system. sometimes it's lang.encoding, like pt_BR.UTF-8 instead of pt_BR - do not use non-ascii (?) characters in the source code messages. like, _(Tá certo) won't work with gettext. You'll probably want to use _(Ta certo) - for that reason, if your main language is not english or something that doesn't use non-ascii characters, you'll need to translate it if you want to display the correct words - it's frustrating to try to change the .mo files real-time, as you'll need to reload apache (or whatever) everytime. the reason is that apache likes to keep .mo files cached, and won't reload it unless you shut it down and start it again. that's all I remember for now. hope it helps. fell free to contact me pvtly. dfcp On Jul 28, 5:37 am, leop ponton@gmail.com wrote: I can't see what is causing the problem, but it is a warning rather than an error. It seems to indicate that the code executed okay, but the headers had already been sent. If you have copied pasted the code, you may have picked up a space after the ? in p28n.php (I see by swiping the code that there is one in my fragment). L On Jul 28, 7:29 am, Yannis ikasso...@gmail.com wrote: Hi leop, Thanks for the code. I've used it but I get the following error: Warning (2): Cannot modify header information - headers already sent by (output started at .../config/routes.php:49) [CORE/cake/libs/ controller/components/cookie.php, line 364] If that rings any bell?!?! Looks like the line that is causing this is the p28n.php: $this-change(($this-Cookie-read('lang') ? $this-Cookie-read ('lang') : 'eng')); Have you had that? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cakephp multilingual
Try this link: http://tinyurl.com/4w3d49 (p28n, the top to bottom persistent internationalization tutorial.) That's what I used. Switching languages can be awkward, depending on how and where you're doing it. I'm looking out some examples for you - might be a little while though as I'm working on something else. The po error rings a bell. Are you using poedit? It was over a year ago, but I had a similar problem and I think I had to trawl through the file and clean it up by hand. Have a look at http://univerd.com for a working example. If you then have any specific questions I can then give you some sanitized code fragments. L On 27 July, 11:42, Yannis ikasso...@gmail.com wrote: Hi guys, I have been struggling to make my small cakephp cms multilingual. I have been reading loads of articles on the net but nothing seems to work 100% Could someone please direct me to a correct study path, a book, an article a tutorial, a hint or a clue that could generate some results. - I have set up my database with an i18n table and I have managed to set the default language on the core.php. - I have also managed to switch the url to include the language extension at the beginning (although I'm still trying to make it redirect to the current page when changed) - I'm lacking a method to change languages so that the database can fetch the direct translations and also I cannot properly set up cakephp to read the po file (the po generates an error when saving as well although it seems to keep the changes) Anyone please help. I'm willing to buy any book that may contain the solution (although I think I have all 3? books that have been written for cakephp) Thanks Yannis --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cakephp multilingual
Thank you very much leop! The article you're referring to was actually one of the last ones I read this morning. Still cannot make it work with my app. However it is quite informative. I am having a look right now on the second link and will get back here if I get more specific. respectfully Yannis --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cakephp multilingual
Is that your site .. multilingual works great. Well done! OK let's try and follow this step by step. If you have the time I would appreciate it. Otherwise no worries maybe someone else can help on the way. ** A ** So I have a table with articles and a table with i18n I set the core.php: Configure::write('Config.language', 'eng'); so that when I add an article it gets saved on the i18n table as well. ** B ** I guess the next step is to set up the po files. I am using 3 languages: Greek, Russian, English The way I see it since there are no final standards for language code I could use any format (however stick to it) So for greek: gre / english: eng / russian: rus I create 3 directories under locale named: gre, eng, rus then on each directory I create LC_MESSAGES Then I go to console and have cake i18n extract a single file (all merged) and copy this file to all 3 directories. ** After this step poedit still generates an error [:6: invalid nplurals value / :6: field `Language-Team' still has initial default value ] ** However the file is saved and data exists when re-opened I Tried changing the core default language to gre (my only method at the moment) but the translations from the po file do not apply It seems that the method for the po construction used in the http://tinyurl.com/4w3d49 differs from mine. He merges all translations into 1 file as I see it. And uses variable names on the cakephp files and gives the actual text from the po files. How can I do that ?? ** C ** Step 3 would be to set a way to change the language and reflect that to the database queries as well on the correct po-file read. This is where I get stuck. I have stored a few articles using distinct locale values on the databases but don't know where to go to. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cakephp multilingual
The site is one I did a while back. I will have access to the code when I get home - about 3-4 hours from the timestamp on this comment. I used poedit to do the extraction, not the console as, like you, I found it very buggy. The rest I'll check later and get back to you. L --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cakephp multilingual
I have managed to make the po files work. All I did was rename them to default.po and it worked. I'm still changing the language through core.php though. thank you very much leop Y --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---