Internationalization & Localization in Cakephp switching languages
Hello guys, I started to make a website in 3 different languages: French, English and Arabic. Therefore, I would like to know how to switch language and using a link in the view. I already extract PO file for French and configure the website for French (on the bootstrap file), but I want to know how to show the switching links. Thanks for everyone tries to help me with. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Internationalization Extract Comments
Hi, Can I make comments in my Code like: */// Comments for translatorecho __d('domain', 'Hello World');* Then in console: *cake i18n extract* So I get a POT-File like this: *#. Comments for translatormsgid "Hello World"msgstr ""* -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: CakePhp 2.x - Internationalization/Localization/Translate Behavior/i18n - How to use in 2.x?
Hi Kicaj and thanks for your post, I stumbled upon it before to start the internationalization of project. It was helpful but my main problem is that I can't save data with validation, I have to turn them off on my save($data,false) and I can't figure why it won't work! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: CakePhp 2.x - Internationalization/Localization/Translate Behavior/i18n - How to use in 2.x?
Read my article on bakery site: http://bakery.cakephp.org/articles/kicaj/2013/01/27/internationalization_with_static_and_dynamic_content_routing_and_switching W dniu wtorek, 2 kwietnia 2013 05:06:25 UTC+2 użytkownik Livin Inchina napisał: > > Hi everyone! > > I'm having a hard time making my website multilingual and I after going > through the net seeking for answers, I found out that I wasn't the first > one to have these issues with version 2.x. > > I'm trying to translate my blog. So I have a Post.php model, a > PostsController.php and a view admin_edit.ctp. > > Using the console, I've created the i18n table by hitting the command > > cake i18n. > > Following are my files: > > *bootstrap.php* > > Configure::write('Config.languages', array('fra','eng')); > Configure::write('Config.language','fra'); > * > * > *Post.php* > > class Post extends AppModel{ > > public $actsAs = array( > 'Translate' => array( > 'name'=> '_name', > 'slug'=> '_slug', > 'content' => '_content' > ) > ); > } > > *PostsController.php* > * > * > function admin_edit($id=null){ > > if (!empty($this->request->data)) { > > $this->Post->create(); > $this->Post->locale = Configure::read('Config.languages'); > > if (!empty($this->request->data['Post']['file']['name']) && > !empty($this->request->data['Post']['photo'])) { > $dir = IMAGES.'news'; > if (!file_exists($dir)) { > mkdir($dir,0777); > } > $photo = preg_replace('~[^\w-\.]~', '-', > strtolower($this->request->data['Post']['photo']['fra'])); > $f = explode('.',$this->request->data['Post']['file']['name']); > $ext = '.'.end($f); > $filename = $photo.date('-YmdHis'); > > move_uploaded_file($this->request->data['Post']['file']['tmp_name'], > $dir.DS.$filename.$ext); > } > > if ($this->Post->save($this->request->data, false)) { > debug($this->request->data); > // $this->redirect(array('action' => 'admin_index')); > } > > if ($id!=null) { > $this->Post->id = $id; > $this->request->data = $this->Post->readAll(); > } > } > } > > *admin_edit.ctp* > * > * > echo $this->Form->create('Post', array('type' => 'file')); > > echo $this->Form->input('file', array('type' => 'file')); > echo $this->Form->input('photo', array(); > > foreach (Configure::read('Config.languages') as $lang): > echo $this->Form->input('Post.name.'.$lang, array('div' => false, 'label' > => false)); > echo $this->Form->input('Post.slug.'.$lang, array('div' => false, 'label' > => false)); > echo $this->Form->textarea('Post.content.'.$lang, array('div' => false, > 'label' => false)); > endforeach; > > echo $this->Form->input('id'); > echo $this->Form->hidden('created'); > > echo $this->Form->end('done'); > ?> > > > -- > > You will notice that in my controller I use $this->Post->locale = > Configure::read('Config.languages'); to save all my languages at once. > To do that, I also loop my input in the view foreach > (Configure::read('Config.languages') as $lang): > > This code is working as it but it's not enough. As you can see I have a > picture and I would like to insert its name in the posts table. > Right now, if I want to save the name of the picture, I have to do like > that: my-image.jpg, meaning I have to manually format it in the form. > Also, I have a slug and to create it I would like to use the name field > and add "-" instead of the spaces to format my slug. > > With my code above, I just do a simple > $this->Post->save($this->request->data, false) but I cannot format my data. > What I'd like to do is something like that for example: > > $success = array( > 'name'=> $name, > 'slug'=> $slug, > 'photo' => $photo, > 'content' => $content, > 'id' => $id > ); > $this->Post->save($success,false); > > The problem when I do that is that it needs to be saved in as many > languages as I have because. When I loop it to save all the languages, > everything is save in the i18n table, > all the values are translated, the only problem is that the locale column > data are all the same, the locale that has been used when saved. > > By the way, you will notice that I disabled the validation in the second > parameter of the save. If I don't do that, nothing happens. > That's one of the problem I can't figure, why couldn't I do validations? > > So my questions are, how can I save my data in both tables i18n and posts > with the possibility to format the data before saving? > How come I have to disable the validation to make the saving work? > If you already done that on V2.x, how did you do it? > > I'm really stuck on this, the only solution I have right now is no > validations, and format data manually in the form. > This is really not convenient and not pro. > > I really hope somebody will help me, I've posted this problem in every > forum and group I know, and nobody answered me yet. > Help for a desperate guy... > > Thank you very very much for your help! > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP ---
CakePhp 2.x - Internationalization/Localization/Translate Behavior/i18n - How to use in 2.x?
Hi everyone! I'm having a hard time making my website multilingual and I after going through the net seeking for answers, I found out that I wasn't the first one to have these issues with version 2.x. I'm trying to translate my blog. So I have a Post.php model, a PostsController.php and a view admin_edit.ctp. Using the console, I've created the i18n table by hitting the command > cake i18n. Following are my files: *bootstrap.php* Configure::write('Config.languages', array('fra','eng')); Configure::write('Config.language','fra'); * * *Post.php* array( 'name'=> '_name', 'slug'=> '_slug', 'content' => '_content' ) ); } *PostsController.php* * * function admin_edit($id=null){ if (!empty($this->request->data)) { $this->Post->create(); $this->Post->locale = Configure::read('Config.languages'); if (!empty($this->request->data['Post']['file']['name']) && !empty($this->request->data['Post']['photo'])) { $dir = IMAGES.'news'; if (!file_exists($dir)) { mkdir($dir,0777); } $photo = preg_replace('~[^\w-\.]~', '-', strtolower($this->request->data['Post']['photo']['fra'])); $f = explode('.',$this->request->data['Post']['file']['name']); $ext = '.'.end($f); $filename = $photo.date('-YmdHis'); move_uploaded_file($this->request->data['Post']['file']['tmp_name'], $dir.DS.$filename.$ext); } if ($this->Post->save($this->request->data, false)) { debug($this->request->data); // $this->redirect(array('action' => 'admin_index')); } if ($id!=null) { $this->Post->id = $id; $this->request->data = $this->Post->readAll(); } } } *admin_edit.ctp* * * Form->create('Post', array('type' => 'file')); echo $this->Form->input('file', array('type' => 'file')); echo $this->Form->input('photo', array(); foreach (Configure::read('Config.languages') as $lang): echo $this->Form->input('Post.name.'.$lang, array('div' => false, 'label' => false)); echo $this->Form->input('Post.slug.'.$lang, array('div' => false, 'label' => false)); echo $this->Form->textarea('Post.content.'.$lang, array('div' => false, 'label' => false)); endforeach; echo $this->Form->input('id'); echo $this->Form->hidden('created'); echo $this->Form->end('done'); ?> -- You will notice that in my controller I use $this->Post->locale = Configure::read('Config.languages'); to save all my languages at once. To do that, I also loop my input in the view foreach (Configure::read('Config.languages') as $lang): This code is working as it but it's not enough. As you can see I have a picture and I would like to insert its name in the posts table. Right now, if I want to save the name of the picture, I have to do like that: my-image.jpg, meaning I have to manually format it in the form. Also, I have a slug and to create it I would like to use the name field and add "-" instead of the spaces to format my slug. With my code above, I just do a simple $this->Post->save($this->request->data, false) but I cannot format my data. What I'd like to do is something like that for example: $success = array( 'name'=> $name, 'slug'=> $slug, 'photo' => $photo, 'content' => $content, 'id' => $id ); $this->Post->save($success,false); The problem when I do that is that it needs to be saved in as many languages as I have because. When I loop it to save all the languages, everything is save in the i18n table, all the values are translated, the only problem is that the locale column data are all the same, the locale that has been used when saved. By the way, you will notice that I disabled the validation in the second parameter of the save. If I don't do that, nothing happens. That's one of the problem I can't figure, why couldn't I do validations? So my questions are, how can I save my data in both tables i18n and posts with the possibility to format the data before saving? How come I have to disable the validation to make the saving work? If you already done that on V2.x, how did you do it? I'm really stuck on this, the only solution I have right now is no validations, and format data manually in the form. This is really not convenient and not pro. I really hope somebody will help me, I've posted this problem in every forum and group I know, and nobody answered me yet. Help for a desperate guy... Thank you very very much for your help! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
TwigView and internationalization
Hi bakers, I'm using the TwigView plugin and I wanted to know if there is some kind of automated script to extract all the strings used with the trans filter. I have been googling it, but I have been frustrated. Thanks. Regards, Jorge -- 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: internationalization
If you are willing to pay for it, there is a company that translates .po files, among other frameworks: http://www.icanlocalize.com/site/ Cheers, - Johan On Mon, Jul 4, 2011 at 12:46 PM, Salines wrote: > > Try http://translate.umpirsky.com/ > > On 1 srp, 17:00, Mati wrote: > > Hi Guys. I'm having a problem internationalizing my app. > > > > I need the default.po file in spanish. For example all the errors > > Model, Controller, DB. But in spanish. > > > > Do you know if there is any group or blog who did this? > > If there isn't a translation is any way to do it automatically? like > > google translate? > > > > I apologize for my english xD Is not my native language! > > > > Thanks in advice! > > > > Mati. > > -- > 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 > -- 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: internationalization
Try http://translate.umpirsky.com/ On 1 srp, 17:00, Mati wrote: > Hi Guys. I'm having a problem internationalizing my app. > > I need the default.po file in spanish. For example all the errors > Model, Controller, DB. But in spanish. > > Do you know if there is any group or blog who did this? > If there isn't a translation is any way to do it automatically? like > google translate? > > I apologize for my english xD Is not my native language! > > Thanks in advice! > > Mati. -- 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: internationalization
hi.. you have to bake, your app, then,, you have your default .po,,, and you have to translate line per line. [off-topic] lo que te respondi arriba es como yo he trabajado antes, pero si hay otra manera no lo se. si tu ingles no es muy bueno te recomiendo que preguntes aqui http://groups.google.com/group/cakephp-esp?hl=es 2011/7/1 Mati > Hi Guys. I'm having a problem internationalizing my app. > > I need the default.po file in spanish. For example all the errors > Model, Controller, DB. But in spanish. > > Do you know if there is any group or blog who did this? > If there isn't a translation is any way to do it automatically? like > google translate? > > I apologize for my english xD Is not my native language! > > Thanks in advice! > > Mati. > > -- > 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 > -- 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
internationalization
Hi Guys. I'm having a problem internationalizing my app. I need the default.po file in spanish. For example all the errors Model, Controller, DB. But in spanish. Do you know if there is any group or blog who did this? If there isn't a translation is any way to do it automatically? like google translate? I apologize for my english xD Is not my native language! Thanks in advice! Mati. -- 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: USE Internationalization & Localization
thanks daniel On Apr 1, 6:45 pm, "Daniel S. Reichenbach" wrote: > Greetings, > > > i am new in cakephp,how can user choice language? > > As a primer, read this > one:http://book.cakephp.org/view/1228/Internationalization-Localization > > and this question has a nice summary of what to > do.http://ask.cakephp.org/questions/view/multilanguage_site_in_cakephp > > And if you are looking for a starters guide, then the Bakery has you > covered: > > http://bakery.cakephp.org/articles/sky_l3ppard/2010/01/05/smoothtrans... > > WkR, > Daniel -- 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: USE Internationalization & Localization
Greetings, i am new in cakephp,how can user choice language? As a primer, read this one: http://book.cakephp.org/view/1228/Internationalization-Localization and this question has a nice summary of what to do. http://ask.cakephp.org/questions/view/multilanguage_site_in_cakephp And if you are looking for a starters guide, then the Bakery has you covered: http://bakery.cakephp.org/articles/sky_l3ppard/2010/01/05/smoothtranslate-to-make-smooth-translations WkR, Daniel -- 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: USE Internationalization & Localization
i am new in cakephp,how can user choice language? if i have website with default language :English ; how can user choice another language for xample farsi? and how can i find out user language choice in controls and view and model? On Apr 1, 5:05 pm, Ryan Schmidt wrote: > On Apr 1, 2011, at 07:48, hoss7 wrote: > > > how can i call file from local folder from url? > > > for example i have : > > > /app/locale/eng/LC_MESSAGES/default.po (English) > > /app/locale/fa/LC_MESSAGES/default.po (farsi) > > > how can i create url for call other po files? > > What do you mean, URL? You're not going to be accessing .po files directly in > a browser. -- 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: USE Internationalization & Localization
On Apr 1, 2011, at 07:48, hoss7 wrote: > how can i call file from local folder from url? > > for example i have : > >/app/locale/eng/LC_MESSAGES/default.po (English) >/app/locale/fa/LC_MESSAGES/default.po (farsi) > > how can i create url for call other po files? What do you mean, URL? You're not going to be accessing .po files directly in a browser. -- 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
USE Internationalization & Localization
how can i call file from local folder from url? for example i have : /app/locale/eng/LC_MESSAGES/default.po (English) /app/locale/fa/LC_MESSAGES/default.po (farsi) how can i create url for call other po files? -- 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: Internationalization in Cake - not works for me
Please show the code in which you are using the __(...) function, so that we can see that you are using it correctly. Be aware, that passing true as the second parameter to the __(...) function will make it return the translation, not echo the translation! Also, have you tried reversing the translation requirement, so that you specify all text in english and have it translated into russian? Enjoy, John On 12 Dec., 01:31, Andrew Hodirevski wrote: > What am I doing wrong? > I've got the next part of View: > > __('Ваш логин', true), > > After that I've generated using cake 'cake i18n extract' neccessary > path and default.pot, which I copied to app/locale/eng/LC_MESSAGES/ > default.po and edited with PoEdit. > > The part of default.po for the previous string is: > msgid "Ваш логин" > msgstr "Your login" > > And: > "Plural-Forms: nplurals=2; plural=(n != 1);\n" > > The Debug level is 2, so I have no caching. > > So, what the problem is? 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
Internationalization in Cake - not works for me
What am I doing wrong? I've got the next part of View: __('Ваш логин', true), After that I've generated using cake 'cake i18n extract' neccessary path and default.pot, which I copied to app/locale/eng/LC_MESSAGES/ default.po and edited with PoEdit. The part of default.po for the previous string is: msgid "Ваш логин" msgstr "Your login" And: "Plural-Forms: nplurals=2; plural=(n != 1);\n" The Debug level is 2, so I have no caching. So, what the problem is? 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: editing *.po files - internationalization
Hello. What does the "Catalog/Configuration" window of your .po file speaks of "INTEGER" or "EXPRESSION" in its "Plural forms" input? Do you have the following line at the beginning of your .po file? "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" If yes, your plural forms are not configured and you need to take a look at this page: http://translate.sourceforge.net/wiki/l10n/pluralforms Anyway, telling what your fatal error exactly is would help… 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
editing *.po files - internationalization
I've been trying to translate the commom messages and words inside cakephp core to portuguese using the internationalization feature... i generated the default.pot file, put it in the right directory "/app/ locale/por/LC_MESSAGES/default.po" and then start translating the messages, with Poedit, but it seems to have a problem when translating words with plural form in the code for example: #: /cake/libs/view/helpers/time.php:450;455;459 msgid "week" msgid_plural "weeks" msgstr[0] "" msgstr[1] "" When I translate the word 'week' on Poedit and save the document it says it has a fatal error ... All other words work perfectly, except words that have singular and plural on the file generated by the i18n console task has it happened to anyone here? any ideas how can I make theses words translations work? ps. hope i was clear enough on this issue 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: Problem with internationalization
Its "fre" not "fr". Its always 3 letters. Also try: Configure::write('Config.language', 'fre'); On May 18, 8:35 am, thomaus wrote: > I just tried but it did not change anything... > > On May 18, 3:34 pm, "Dr. Loboto" wrote: > > > > > Not "fr", but "fre". > > > On May 18, 7:29 pm, thomaus wrote: > > > > Hi, > > > > I already made some multilingual websites with CakePHP but this time, > > > it doesn't work and I don't get it. > > > > What I did : > > > > 1) Wrote this function in my app_controller.php file > > > > function beforeFilter() > > > { > > > $this->Session->write('Config.language', 'fr'); > > > pr($this->Session->read()); > > > > } > > > > 2) Created my pot file : /locale/fr/LC_MESSAGES/default.po containing > > > this : > > > msgid "hello_world" > > > msgstr "Bonjour Monde!!!" > > > > 3) Echoed the "hello_world" word in my main view this way : > > > > > > > And this is what I get : > > > > Array > > > ( > > > [Config] => Array > > > ( > > > [userAgent] => a306901d9caa36b51a9be87069755367 > > > [time] => 1274221529 > > > [timeout] => 10 > > > [language] => fr > > > ) > > > > ) > > > > hello_world > > > > So it seems like the language is correctly set in the session, but the > > > __() doesn't work. I don't get it. Does anybody know why it is so? > > > > Thanks in advance. > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers > > > 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 > > > athttp://groups.google.com/group/cake-php?hl=en > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 > > athttp://groups.google.com/group/cake-php?hl=en > > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 > athttp://groups.google.com/group/cake-php?hl=en 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: Problem with internationalization
A stupid bug of mine. Sorry for bugging! On May 18, 5:35 pm, thomaus wrote: > I just tried but it did not change anything... > > On May 18, 3:34 pm, "Dr. Loboto" wrote: > > > > > Not "fr", but "fre". > > > On May 18, 7:29 pm, thomaus wrote: > > > > Hi, > > > > I already made some multilingual websites with CakePHP but this time, > > > it doesn't work and I don't get it. > > > > What I did : > > > > 1) Wrote this function in my app_controller.php file > > > > function beforeFilter() > > > { > > > $this->Session->write('Config.language', 'fr'); > > > pr($this->Session->read()); > > > > } > > > > 2) Created my pot file : /locale/fr/LC_MESSAGES/default.po containing > > > this : > > > msgid "hello_world" > > > msgstr "Bonjour Monde!!!" > > > > 3) Echoed the "hello_world" word in my main view this way : > > > > > > > And this is what I get : > > > > Array > > > ( > > > [Config] => Array > > > ( > > > [userAgent] => a306901d9caa36b51a9be87069755367 > > > [time] => 1274221529 > > > [timeout] => 10 > > > [language] => fr > > > ) > > > > ) > > > > hello_world > > > > So it seems like the language is correctly set in the session, but the > > > __() doesn't work. I don't get it. Does anybody know why it is so? > > > > Thanks in advance. > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers > > > 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 > > > athttp://groups.google.com/group/cake-php?hl=en > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 > > athttp://groups.google.com/group/cake-php?hl=en > > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 > athttp://groups.google.com/group/cake-php?hl=en 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: Problem with internationalization
I just tried but it did not change anything... On May 18, 3:34 pm, "Dr. Loboto" wrote: > Not "fr", but "fre". > > On May 18, 7:29 pm, thomaus wrote: > > > > > Hi, > > > I already made some multilingual websites with CakePHP but this time, > > it doesn't work and I don't get it. > > > What I did : > > > 1) Wrote this function in my app_controller.php file > > > function beforeFilter() > > { > > $this->Session->write('Config.language', 'fr'); > > pr($this->Session->read()); > > > } > > > 2) Created my pot file : /locale/fr/LC_MESSAGES/default.po containing > > this : > > msgid "hello_world" > > msgstr "Bonjour Monde!!!" > > > 3) Echoed the "hello_world" word in my main view this way : > > > > > And this is what I get : > > > Array > > ( > > [Config] => Array > > ( > > [userAgent] => a306901d9caa36b51a9be87069755367 > > [time] => 1274221529 > > [timeout] => 10 > > [language] => fr > > ) > > > ) > > > hello_world > > > So it seems like the language is correctly set in the session, but the > > __() doesn't work. I don't get it. Does anybody know why it is so? > > > Thanks in advance. > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 > > athttp://groups.google.com/group/cake-php?hl=en > > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 > athttp://groups.google.com/group/cake-php?hl=en 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: Problem with internationalization
Not "fr", but "fre". On May 18, 7:29 pm, thomaus wrote: > Hi, > > I already made some multilingual websites with CakePHP but this time, > it doesn't work and I don't get it. > > What I did : > > 1) Wrote this function in my app_controller.php file > > function beforeFilter() > { > $this->Session->write('Config.language', 'fr'); > pr($this->Session->read()); > > } > > 2) Created my pot file : /locale/fr/LC_MESSAGES/default.po containing > this : > msgid "hello_world" > msgstr "Bonjour Monde!!!" > > 3) Echoed the "hello_world" word in my main view this way : > > > And this is what I get : > > Array > ( > [Config] => Array > ( > [userAgent] => a306901d9caa36b51a9be87069755367 > [time] => 1274221529 > [timeout] => 10 > [language] => fr > ) > > ) > > hello_world > > So it seems like the language is correctly set in the session, but the > __() doesn't work. I don't get it. Does anybody know why it is so? > > Thanks in advance. > > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 > athttp://groups.google.com/group/cake-php?hl=en 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
Problem with internationalization
Hi, I already made some multilingual websites with CakePHP but this time, it doesn't work and I don't get it. What I did : 1) Wrote this function in my app_controller.php file function beforeFilter() { $this->Session->write('Config.language', 'fr'); pr($this->Session->read()); } 2) Created my pot file : /locale/fr/LC_MESSAGES/default.po containing this : msgid "hello_world" msgstr "Bonjour Monde!!!" 3) Echoed the "hello_world" word in my main view this way : And this is what I get : Array ( [Config] => Array ( [userAgent] => a306901d9caa36b51a9be87069755367 [time] => 1274221529 [timeout] => 10 [language] => fr ) ) hello_world So it seems like the language is correctly set in the session, but the __() doesn't work. I don't get it. Does anybody know why it is so? Thanks in advance. 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: custom Routing prefix internationalization - URL translated AND action name not ???
anybody pls? Thanks again. Tomas On Feb 1, 11:03 am, "toka...@gmail.com" wrote: > Hi, I need to set up 'member' prefix for my page with its > localization. > > So my address is now ... example.com/member/index > > BUT, how can I translate the word member to other language? Let say I > wish to use a spanish word 'miembro' in URL but english word 'member' > as action prefix in the controller. > > - New address would be ... example.com/miembro/index > - Controller's name: member_index() { ... } > > Is it possible?? ... that $html->link() will return always 'miembro' > in address instead of 'member'?? > > Thanks > Tomas 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
custom Routing prefix internationalization - URL translated AND action name not ???
Hi, I need to set up 'member' prefix for my page with its localization. So my address is now ... example.com/member/index BUT, how can I translate the word member to other language? Let say I wish to use a spanish word 'miembro' in URL but english word 'member' as action prefix in the controller. - New address would be ... example.com/miembro/index - Controller's name: member_index() { ... } Is it possible?? ... that $html->link() will return always 'miembro' in address instead of 'member'?? Thanks Tomas 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: Internationalization in Cakephp help( for a newbie)
Hi, Ur mail helped me alot Thanx a lot I have to do like this IM implementing German Language msgid "Delete" msgstr "Löschen" msgid "Add New Post" msgstr "Fügen Sie Neuen Posten hinzu" Both words missing But when I tried with Below one It worked msgid "Delete" msgstr "Loschen" msgid "Add New Post" msgstr "Fugen Sie Neuen Posten hinzu" Obviously problem is with ö and ü in Löschen and Fügen... Im using wordPad... How to get the desired words. Jay 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: Internationalization in Cakephp help( for a newbie)
Hi, when I tried to create po file. I am getting the following error message xgettext: waring: file`' extension `' is unknown; will try C updation failed. click >>> more I have given path controllers views/posts . and keyword as __ But updation is failing.. Please guide.. Thanks in advance Jay 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: Internationalization in Cakephp help( for a newbie)
What kind of sample code? All you need to do is , and then define it in the .po files. // default.po msgid "This string will be translated" msgstr "" 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: Internationalization in Cakephp help( for a newbie)
Hi Marcelo, Thanks for ur reply. Can I get a sample code for internationalization? I cant find it in google... Thanks, Jayanand Bhushi 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: Internationalization in Cakephp help( for a newbie)
On Wed, Dec 9, 2009 at 3:27 AM, Jayanand Bhushi wrote: > Hi all, > > Im newbie to cakephp. But have implemented so many cakephp concept. > Now I want to implement internationalization to my application. > I dont know wat to use. i18n, p28n or l10n. > I even dont the difference between them. Internacionalization: an "i", eighteen letters and a "n", i18n. Localization: an "l", ten letters and a "n", l10n. What's the difference? http://www.google.com.br/search?q=define%3Ai18n http://www.google.com.br/search?q=define%3Al10n p28n is name of a user component to change the language of a CakePHP application based on parameters in the URL. It's described here[1]. > Please give me one sample so that I can continue with it for my modules. Start with the basics [2]. Best regards. [1] http://bakery.cakephp.org/articles/view/p28n-the-top-to-bottom-persistent-internationalization-tutorial [2] http://book.cakephp.org/view/162/Internationalizing-Your-Application -- MARCELO DE F. ANDRADE Belem, PA, Amazonia, Brazil Linux User #221105 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
Internationalization in Cakephp help( for a newbie)
Hi all, Im newbie to cakephp. But have implemented so many cakephp concept. Now I want to implement internationalization to my application. I dont know wat to use. i18n, p28n or l10n. I even dont the difference between them. Please give me one sample so that I can continue with it for my modules. Thanks in advance. Regards, Jayanand Bhushi 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
Migrate content to the i18n Database Table (internationalization)
I spent a long time googling for a solution, now I have to ask you guys... In my application I have an articles table with some entries. Now I would like to internationalize my application, so I need to translate two fields in my articles-table (content and title). Is there a possibilty to migrate my existing (monolingual) content to the i18n database table? Best Mathias --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Prefix for Internationalization
Hi, I want to internationalize a cake website. My intention was to use prefixes like /eng/posts/index /fra/posts/index /deu/posts/index to differentiate the languages for the user, search machines and the app itself. Whit the routing I do something like that: Router::connect('/:language/posts/:action/*', array('controller' => 'posts'), array('language' => '[a-z]{3}')); This works fine. Now what I don't get to work is the url generating with the html helper function. I tried to overwrite the url Method with the AppHelper class, so that the current, selected language will automtically added to the url to match the above url layout: function url($url = null, $full = false) { if(!is_array($url)) { $urlString = $url; unset($url); $url[] = $urlString; } if(isset($this->params['language'])) { $url['prefix'] = $this->params['language']; } else { $url['prefix'] = Configure::read('App.defaultLang'); } $result = parent::url($url, $full); return $result; } I tried some other ideas with $url['bare'] = '/fra'.$urlString; but nothing works properly. Do you have any ideas? --~--~-~--~~~---~--~~ 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: Internationalization
Thanks Larry, thats the trick. On Aug 17, 4:59 pm, "Larry E. Masters aka PhpNut" wrote: > It is __(); notice the double underscore. > > -- > /** > * @author Larry E. Masters > * @var string $userName > * @param string $realName > * @returns string aka PhpNut > * @access public > */ > > On Mon, Aug 17, 2009 at 3:52 PM, RhythmicDevil wrote: > > > > > Hi, > > I am trying to understand how to get internationalization to work in > > CakePHP. After reading the docs and searching around, looking at > > Teknoid and some other place this is what I am left with. > > > CakePHP has a class I18n that handles the loading of the correct > > string from a .po file based upon the language locale setting. > > > CakePHP has a console app that supposedly will read all the strings in > > your view files and create language files for you. > > > I wrap my string ids in _() which will return the msg for that id. > > > I can use POEdit to create my files. > > > Given that. I created one message and placed it in the default.po file > > for English. I then used the translator function for the heading on my > > login page. However when I start the app it simply fails and tells me > > that _() is an undefined function. > > > Here is the content of my controller: > > > class SubscribersController extends Controller > > { > > public $helpers = array ('Form', 'Html', 'Javascript'); > > public $components = array ('DataPrep'); > > > public $SubscriberId = null; > > > public function login() > > { > > $this->pageTitle = 'Please Login'; > > $this->layout = 'login'; > > $this->SubscriberId = $this->params['data']['Subscriber'] > > ['SubscriberId']; > > $this->log('Login attempt with SubscriberId: '.$this- > > >SubscriberId, Configure::read('APP_LOG')); > > $subscriber = $this->Subscriber->QuerySub($this- > > >SubscriberId); > > if ($subscriber->resultCode == 0) > > { > > $this->Session->write('Subscriber', $subscriber- > > >querySubRsp); > > //debug($this->Session->read('Subscriber')); > > $this->redirect( array ('controller'=>'subscribers', > > 'action'=>'basics')); > > } > > > } > > > > > Here is the content of my View file: > > > > > > > > _("Please > > Login"); ?> > > > > > > echo $form->create($options = array('action' => > > 'login')); > > echo $form->input('Subscriber.SubscriberId'); > > echo $form->button('Login', array('type'=>'submit', > > 'class'=>'button')); > > echo $form->end(); > > ?> > > > > > > > > > Here is the content of my default.po file that is in the directory / > > app/locale/eng/LC_MESSAGES/ > > > msgid "" > > msgstr "" > > "Project-Id-Version: \n" > > "POT-Creation-Date: \n" > > "PO-Revision-Date: \n" > > "Last-Translator: Steven Wright \n" > > "Language-Team: \n" > > "MIME-Version: 1.0\n" > > "Content-Type: text/plain; charset=iso-8859-1\n" > > "Content-Transfer-Encoding: 8bit\n" > > > msgid "Please Login" > > msgstr "Please Login" > > > 1) I am assuming I need to tell Cake to use I18n. But how? Is it a > > component, a helper? > > 2) Does my .po file look correct? > > 3) Am I on the right path? > > > Thanks --~--~-~--~~~---~--~~ 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: Internationalization
Hahaha I am such a dummy. Thanks. On Aug 17, 4:59 pm, "Larry E. Masters aka PhpNut" wrote: > It is __(); notice the double underscore. > > -- > /** > * @author Larry E. Masters > * @var string $userName > * @param string $realName > * @returns string aka PhpNut > * @access public > */ > > On Mon, Aug 17, 2009 at 3:52 PM, RhythmicDevil wrote: > > > > > Hi, > > I am trying to understand how to get internationalization to work in > > CakePHP. After reading the docs and searching around, looking at > > Teknoid and some other place this is what I am left with. > > > CakePHP has a class I18n that handles the loading of the correct > > string from a .po file based upon the language locale setting. > > > CakePHP has a console app that supposedly will read all the strings in > > your view files and create language files for you. > > > I wrap my string ids in _() which will return the msg for that id. > > > I can use POEdit to create my files. > > > Given that. I created one message and placed it in the default.po file > > for English. I then used the translator function for the heading on my > > login page. However when I start the app it simply fails and tells me > > that _() is an undefined function. > > > Here is the content of my controller: > > > class SubscribersController extends Controller > > { > > public $helpers = array ('Form', 'Html', 'Javascript'); > > public $components = array ('DataPrep'); > > > public $SubscriberId = null; > > > public function login() > > { > > $this->pageTitle = 'Please Login'; > > $this->layout = 'login'; > > $this->SubscriberId = $this->params['data']['Subscriber'] > > ['SubscriberId']; > > $this->log('Login attempt with SubscriberId: '.$this- > > >SubscriberId, Configure::read('APP_LOG')); > > $subscriber = $this->Subscriber->QuerySub($this- > > >SubscriberId); > > if ($subscriber->resultCode == 0) > > { > > $this->Session->write('Subscriber', $subscriber- > > >querySubRsp); > > //debug($this->Session->read('Subscriber')); > > $this->redirect( array ('controller'=>'subscribers', > > 'action'=>'basics')); > > } > > > } > > > > > Here is the content of my View file: > > > > > > > > _("Please > > Login"); ?> > > > > > > echo $form->create($options = array('action' => > > 'login')); > > echo $form->input('Subscriber.SubscriberId'); > > echo $form->button('Login', array('type'=>'submit', > > 'class'=>'button')); > > echo $form->end(); > > ?> > > > > > > > > > Here is the content of my default.po file that is in the directory / > > app/locale/eng/LC_MESSAGES/ > > > msgid "" > > msgstr "" > > "Project-Id-Version: \n" > > "POT-Creation-Date: \n" > > "PO-Revision-Date: \n" > > "Last-Translator: Steven Wright \n" > > "Language-Team: \n" > > "MIME-Version: 1.0\n" > > "Content-Type: text/plain; charset=iso-8859-1\n" > > "Content-Transfer-Encoding: 8bit\n" > > > msgid "Please Login" > > msgstr "Please Login" > > > 1) I am assuming I need to tell Cake to use I18n. But how? Is it a > > component, a helper? > > 2) Does my .po file look correct? > > 3) Am I on the right path? > > > Thanks --~--~-~--~~~---~--~~ 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: Internationalization
Ok problem solved is that my PHP was not compiled with gettext. So thats done. The page loads but there is not message being displayed. On Aug 17, 4:52 pm, RhythmicDevil wrote: > Hi, > I am trying to understand how to get internationalization to work in > CakePHP. After reading the docs and searching around, looking at > Teknoid and some other place this is what I am left with. > > CakePHP has a class I18n that handles the loading of the correct > string from a .po file based upon the language locale setting. > > CakePHP has a console app that supposedly will read all the strings in > your view files and create language files for you. > > I wrap my string ids in _() which will return the msg for that id. > > I can use POEdit to create my files. > > Given that. I created one message and placed it in the default.po file > for English. I then used the translator function for the heading on my > login page. However when I start the app it simply fails and tells me > that _() is an undefined function. > > Here is the content of my controller: > > class SubscribersController extends Controller > { > public $helpers = array ('Form', 'Html', 'Javascript'); > public $components = array ('DataPrep'); > > public $SubscriberId = null; > > public function login() > { > $this->pageTitle = 'Please Login'; > $this->layout = 'login'; > $this->SubscriberId = $this->params['data']['Subscriber'] > ['SubscriberId']; > $this->log('Login attempt with SubscriberId: '.$this->SubscriberId, > Configure::read('APP_LOG')); > > $subscriber = $this->Subscriber->QuerySub($this->SubscriberId); > > if ($subscriber->resultCode == 0) > { > $this->Session->write('Subscriber', $subscriber->querySubRsp); > > //debug($this->Session->read('Subscriber')); > $this->redirect( array ('controller'=>'subscribers', > 'action'=>'basics')); > } > > } > > > Here is the content of my View file: > > > > _("Please > Login"); ?> > > > echo $form->create($options = array('action' => > 'login')); > echo $form->input('Subscriber.SubscriberId'); > echo $form->button('Login', array('type'=>'submit', > 'class'=>'button')); > echo $form->end(); > ?> > > > > > Here is the content of my default.po file that is in the directory / > app/locale/eng/LC_MESSAGES/ > > msgid "" > msgstr "" > "Project-Id-Version: \n" > "POT-Creation-Date: \n" > "PO-Revision-Date: \n" > "Last-Translator: Steven Wright \n" > "Language-Team: \n" > "MIME-Version: 1.0\n" > "Content-Type: text/plain; charset=iso-8859-1\n" > "Content-Transfer-Encoding: 8bit\n" > > msgid "Please Login" > msgstr "Please Login" > > 1) I am assuming I need to tell Cake to use I18n. But how? Is it a > component, a helper? > 2) Does my .po file look correct? > 3) Am I on the right path? > > Thanks --~--~-~--~~~---~--~~ 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: Internationalization
It is __(); notice the double underscore. -- /** * @author Larry E. Masters * @var string $userName * @param string $realName * @returns string aka PhpNut * @access public */ On Mon, Aug 17, 2009 at 3:52 PM, RhythmicDevil wrote: > > Hi, > I am trying to understand how to get internationalization to work in > CakePHP. After reading the docs and searching around, looking at > Teknoid and some other place this is what I am left with. > > CakePHP has a class I18n that handles the loading of the correct > string from a .po file based upon the language locale setting. > > CakePHP has a console app that supposedly will read all the strings in > your view files and create language files for you. > > I wrap my string ids in _() which will return the msg for that id. > > I can use POEdit to create my files. > > > Given that. I created one message and placed it in the default.po file > for English. I then used the translator function for the heading on my > login page. However when I start the app it simply fails and tells me > that _() is an undefined function. > > Here is the content of my controller: > > class SubscribersController extends Controller > { >public $helpers = array ('Form', 'Html', 'Javascript'); >public $components = array ('DataPrep'); > >public $SubscriberId = null; > >public function login() >{ >$this->pageTitle = 'Please Login'; >$this->layout = 'login'; >$this->SubscriberId = $this->params['data']['Subscriber'] > ['SubscriberId']; >$this->log('Login attempt with SubscriberId: '.$this- > >SubscriberId, Configure::read('APP_LOG')); >$subscriber = $this->Subscriber->QuerySub($this- > >SubscriberId); >if ($subscriber->resultCode == 0) >{ >$this->Session->write('Subscriber', $subscriber- > >querySubRsp); >//debug($this->Session->read('Subscriber')); >$this->redirect( array ('controller'=>'subscribers', > 'action'=>'basics')); >} > >} > > > Here is the content of my View file: > > > > _("Please > Login"); ?> > > >echo $form->create($options = array('action' => > 'login')); >echo $form->input('Subscriber.SubscriberId'); >echo $form->button('Login', array('type'=>'submit', > 'class'=>'button')); >echo $form->end(); >?> > > > > > > Here is the content of my default.po file that is in the directory / > app/locale/eng/LC_MESSAGES/ > > msgid "" > msgstr "" > "Project-Id-Version: \n" > "POT-Creation-Date: \n" > "PO-Revision-Date: \n" > "Last-Translator: Steven Wright \n" > "Language-Team: \n" > "MIME-Version: 1.0\n" > "Content-Type: text/plain; charset=iso-8859-1\n" > "Content-Transfer-Encoding: 8bit\n" > > msgid "Please Login" > msgstr "Please Login" > > > > 1) I am assuming I need to tell Cake to use I18n. But how? Is it a > component, a helper? > 2) Does my .po file look correct? > 3) Am I on the right path? > > Thanks > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Internationalization
Hi, I am trying to understand how to get internationalization to work in CakePHP. After reading the docs and searching around, looking at Teknoid and some other place this is what I am left with. CakePHP has a class I18n that handles the loading of the correct string from a .po file based upon the language locale setting. CakePHP has a console app that supposedly will read all the strings in your view files and create language files for you. I wrap my string ids in _() which will return the msg for that id. I can use POEdit to create my files. Given that. I created one message and placed it in the default.po file for English. I then used the translator function for the heading on my login page. However when I start the app it simply fails and tells me that _() is an undefined function. Here is the content of my controller: class SubscribersController extends Controller { public $helpers = array ('Form', 'Html', 'Javascript'); public $components = array ('DataPrep'); public $SubscriberId = null; public function login() { $this->pageTitle = 'Please Login'; $this->layout = 'login'; $this->SubscriberId = $this->params['data']['Subscriber'] ['SubscriberId']; $this->log('Login attempt with SubscriberId: '.$this- >SubscriberId, Configure::read('APP_LOG')); $subscriber = $this->Subscriber->QuerySub($this- >SubscriberId); if ($subscriber->resultCode == 0) { $this->Session->write('Subscriber', $subscriber- >querySubRsp); //debug($this->Session->read('Subscriber')); $this->redirect( array ('controller'=>'subscribers', 'action'=>'basics')); } } Here is the content of my View file: create($options = array('action' => 'login')); echo $form->input('Subscriber.SubscriberId'); echo $form->button('Login', array('type'=>'submit', 'class'=>'button')); echo $form->end(); ?> Here is the content of my default.po file that is in the directory / app/locale/eng/LC_MESSAGES/ msgid "" msgstr "" "Project-Id-Version: \n" "POT-Creation-Date: \n" "PO-Revision-Date: \n" "Last-Translator: Steven Wright \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" msgid "Please Login" msgstr "Please Login" 1) I am assuming I need to tell Cake to use I18n. But how? Is it a component, a helper? 2) Does my .po file look correct? 3) Am I on the right path? Thanks --~--~-~--~~~---~--~~ 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: internationalization in model
On 8/11/2009 10:16 PM, tobi_one wrote: > Hi, > > for future reference, this is IMHO the most elegant solution for this > problem: > > http://cake.eizoku.com/blog/?p=30#comment-8 > > Cheers, > tobi_one > > On Jul 29, 4:07 am, "Dr. Loboto" wrote: > >> With Model::invalidate() method reload you do not have such problems >> at all. >> >> On Jul 29, 12:17 am,tobi_one wrote: >> >> >>> Hi, >>> >> >> >>> It works great, but there is one problem. I set the language of the >>> app in the beforefilter of the app_controller. Apparently the models >>> are loaded before this and so the models always return the default >>> language. >>> >> >>> Where do you guys set the language of the app? Especially if you are >>> using the __contruct method as mentioned in the post from above. >>> > Why not use 'error' in the input() option array? http://api.cakephp.org/class/form-helper#method-FormHelperinput I believe it was designed for this purpose. Perhaps a cake developer can confirm/infirm this. --~--~-~--~~~---~--~~ 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: internationalization in model
Hi, for future reference, this is IMHO the most elegant solution for this problem: http://cake.eizoku.com/blog/?p=30#comment-8 Cheers, tobi_one On Jul 29, 4:07 am, "Dr. Loboto" wrote: > With Model::invalidate() method reload you do not have such problems > at all. > > On Jul 29, 12:17 am,tobi_one wrote: > > > Hi, > > > I am using __() internationalization in my model as described here: > > >http://groups.google.com/group/cake-php/browse_thread/thread/fa32c81a... > > > It works great, but there is one problem. I set the language of the > > app in the beforefilter of the app_controller. Apparently the models > > are loaded before this and so the models always return the default > > language. > > > Where do you guys set the language of the app? Especially if you are > > using the __contruct method as mentioned in the post from above. > > > Thanks! > > > Cheers, > >tobi_one > > --~--~-~--~~~---~--~~ 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: internationalization in model
With Model::invalidate() method reload you do not have such problems at all. On Jul 29, 12:17 am, tobi_one wrote: > Hi, > > I am using __() internationalization in my model as described here: > > http://groups.google.com/group/cake-php/browse_thread/thread/fa32c81a... > > It works great, but there is one problem. I set the language of the > app in the beforefilter of the app_controller. Apparently the models > are loaded before this and so the models always return the default > language. > > Where do you guys set the language of the app? Especially if you are > using the __contruct method as mentioned in the post from above. > > Thanks! > > Cheers, > tobi_one --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
internationalization in model
Hi, I am using __() internationalization in my model as described here: http://groups.google.com/group/cake-php/browse_thread/thread/fa32c81acc043eef/6a49c6d9fdc6f158?lnk=st&q=#6a49c6d9fdc6f158 It works great, but there is one problem. I set the language of the app in the beforefilter of the app_controller. Apparently the models are loaded before this and so the models always return the default language. Where do you guys set the language of the app? Especially if you are using the __contruct method as mentioned in the post from above. Thanks! Cheers, tobi_one --~--~-~--~~~---~--~~ 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: Internationalization in find results
Thanks Marcelo, I wasn't using the correct approach for this. Cheers --~--~-~--~~~---~--~~ 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: Internationalization in find results
On Thu, Apr 16, 2009 at 2:54 PM, Stu wrote: > > basically what I want to do is, get a list result from find while > still being able to translate the resulting data with : __('word') You seen the TranslationBehavior? http://book.cakephp.org/pt/view/794/Attaching-the-Translate-Behavior-to-your-Models Best regards. -- MARCELO DE F. ANDRADE Belem, PA, Amazonia, Brazil Linux User #221105 http://mfandrade.wordpress.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Internationalization in find results
Hey guys, I would be surprised to find a solution to this, but here it goes. basically what I want to do is, get a list result from find while still being able to translate the resulting data with : __('word') Didn't catch that now did you? I don't blame you.. here's some code to clear it up: In my Holiday Controller: -- // Simple, just populating an array with holiday names then sending it to my view // $oneHolidays = $this->OneIvrHoliday->OneHoliday->find('list'); $this->set(compact('oneHolidays')); -- In my add.ctp -- //I'm populating my dropdown list with the array I got from my controller, but I my Internationalization to translate them echo $form->select('holiday_id', $oneHolidays, null, null, false); -- Is this even possible? Does anyone have any better advice? I'm pretty sure I'm just complicating things Thanks in advance for any help provided --~--~-~--~~~---~--~~ 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: need Help on Internationalization in CakePHP
Elianora, This is a French tutorial for Internationalization, have a read of this. This should help you with the basics http://www.formation-cakephp.com/41/multilingue-18n-l10n As for database content, I wouldn't suggest using the I18n in CakePHP with database queries as it is quite difficult to use. I read this tutorial and used the behavior model from this website. It is a lot simpler and cleaner to use. http://www.palivoda.eu/2008/04/i18n-in-cakephp-12-database-content-translation-part-2/ Hope this helps. On Feb 6, 5:05 pm, Elianora wrote: > here is my test file, located in "app/locale/fre/LC_MESSAGES/ > default.po" : > > msgid "welcome_text" > msgstr "Bienvenue sur le site de test de" > > msgid "test_by" > msgstr "Les tests ici présents sont réalisés par" > > msgid "user_mgt" > msgstr "Gestion des utilisateurs" > > I tried to name the language dir "fr", "fr_FR", "fra" but it does > nothing... --~--~-~--~~~---~--~~ 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: need Help on Internationalization in CakePHP
Try placing this in your bootstrap.php or your AppController beforeFilter(): App::import('Core', 'l10n'); $l10n = new L10n(); $l10n->get('fre'); --~--~-~--~~~---~--~~ 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: need Help on Internationalization in CakePHP
here is my test file, located in "app/locale/fre/LC_MESSAGES/ default.po" : msgid "welcome_text" msgstr "Bienvenue sur le site de test de" msgid "test_by" msgstr "Les tests ici présents sont réalisés par" msgid "user_mgt" msgstr "Gestion des utilisateurs" I tried to name the language dir "fr", "fr_FR", "fra" but it does nothing... --~--~-~--~~~---~--~~ 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: need Help on Internationalization in CakePHP
They are .po files. Can I see an example of your file? Should look like: msgid "signup" msgstr "Sign Up" msgid "signout" msgstr "Sign Out" --~--~-~--~~~---~--~~ 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: need Help on Internationalization in CakePHP
How could it print anything without a echo before the gettext alias ? if I use this, it print nothing, and if I add echo before, it print the msgid instead of msgstr does cake generate .mo files ? should I do it myself ? if yes, how must I name those files ? --~--~-~--~~~---~--~~ 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: need Help on Internationalization in CakePHP
Hopefully this will shed some light on the things that are not covered in the manual: http://teknoid.wordpress.com/2008/11/28/cakephp-url-based-language-switching-for-i18n-and-l10n-internationalization-and-localization/ On Feb 4, 9:50 am, Elianora wrote: > Hi ! > > I'm new with Cake and with gettext. > > I read [1] and [2] but I'm still lost ^^ > > I don't understand how to choose the default language used in whole > application. > I name my locale dirs with the tree letter convention, I have eng and > fre at the moment. > The application doesn't require "live" language change, so I want to > set the default language in a config file if possible, and just change > it when installing the application in another language. > > I don't understand how cake "parses" the default.po files (I tested > gettext with .mo files), is there anything in cache ? > my app/tmp/cache dir contains 3 dirs only containing an "Empty" file; > I think cake doesn't cache anything for me > (chmod on app/tmp are set to 777) > > In [1], we could find this : > $this->L10n = new L10n(); > $this->L10n->get("eng"); > > but I don't know where to write those lines in my controller class. > > In [1], there's this line : > App::import('Core', 'l10n'); > > and in this group, I also find this : > uses('L10n'); > > is it the same (for different version of cakephp) or have I to use > both ? > > hope someone could help me to understand and sorry for my bad english > > [1] :http://book.cakephp.org/view/161/Localization-Internationalization > [2] :http://bakery.cakephp.org/articles/view/p28n-the-top-to-bottom-persis... --~--~-~--~~~---~--~~ 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: need Help on Internationalization in CakePHP
Hi ! I'm new with Cake and with gettext. I read [1] and [2] but I'm still lost ^^ I don't understand how to choose the default language used in whole application. I name my locale dirs with the tree letter convention, I have eng and fre at the moment. The application doesn't require "live" language change, so I want to set the default language in a config file if possible, and just change it when installing the application in another language. I don't understand how cake "parses" the default.po files (I tested gettext with .mo files), is there anything in cache ? my app/tmp/cache dir contains 3 dirs only containing an "Empty" file; I think cake doesn't cache anything for me (chmod on app/tmp are set to 777) In [1], we could find this : $this->L10n = new L10n(); $this->L10n->get("eng"); but I don't know where to write those lines in my controller class. In [1], there's this line : App::import('Core', 'l10n'); and in this group, I also find this : uses('L10n'); is it the same (for different version of cakephp) or have I to use both ? hope someone could help me to understand and sorry for my bad english [1] : http://book.cakephp.org/view/161/Localization-Internationalization [2] : http://bakery.cakephp.org/articles/view/p28n-the-top-to-bottom-persistent-internationalization-tutorial --~--~-~--~~~---~--~~ 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: need Help on Internationalization in CakePHP
It is not as hard as you may think at first. The hard part about this is figuring out what your language is called. :) There is an ISO standard for this which can be a bit confusing. Swedish (my native language) can be called up using: swe - 3-letter version sv - 2-letter version for standard Swedish sv-fi - 2+2-letter version for Swedish in parts of Finland English, for example has a bunch of these for Brittish, Australian, American and so on. When naming your folder you will probably use the 3-letter name: app/ locale/swe/ I think you can also use the 2+2 version to support various dialects. Selecting a language: The simplest way I have found of setting the language is by setting a configure value in the bootstrap. Configure::write('Config.language', 'sv'); // loads Swedish Configure::write('Config.language', 'swe'); // also loads Swedish Now everything in this request will be translated into Swedish. the value you set can be fetched from a cookie, or the url or anywhere you like. The thing to remember is that this will work as long at you set the language before any translations are attempted. Configure::write('Config.language', 'sv'); // loads Swedish __('welcome'); Configure::write('Config.language', 'eng'); // will not switch to English (last I checked) You only need to worry about the translation classes if you have to switch back and forth during a request as above. I have a translated application with no reference to any l10n or i18n classes anywhere... all Cake magic. The po file is just a textfile. it has a tricky header that will look different for each language: "Plural-Forms: nplurals=2; plural=n != 1;\n" The above is valid for Swedish and a number of other languages. Setting it the wrong way can be fatal (to the translation, not to you). To learn more: Look at http://book.cakephp.org/view/162/Localizing-Your-Application Download PoEdit Google for anything you don't understand and add the word gettext to the search. Gettext is the "name" of the translation used. /Martin On Feb 2, 4:01 pm, vikas wrote: > Hello all.. > > I want to convert my site in multilingual site. > > I have read the tutorial of Internationalization in CakePHP > athttp://book.cakephp.org/view/163/Internationalization-in-CakePHP. But > not so much helpful, also no idea about what url have to use... > > So if somebody has a example file of ".po" or good tutorial link on > Localizing Your Application and Internationalization in CakePHP, then > plz help me.. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
need Help on Internationalization in CakePHP
Hello all.. I want to convert my site in multilingual site. I have read the tutorial of Internationalization in CakePHP at http://book.cakephp.org/view/163/Internationalization-in-CakePHP. But not so much helpful, also no idea about what url have to use... So if somebody has a example file of ".po" or good tutorial link on Localizing Your Application and Internationalization in CakePHP, then plz help me.. --~--~-~--~~~---~--~~ 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: Can't use internationalization on input label
Thanks! On Nov 15, 11:38 pm, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > echo $form->input('names', array( 'label' => __('Names', true))); > > On 16 Nov 2008, at 13:15, Mateo San Román wrote: > > > > > Hello > > > When I try to use the __() function on > > > echo $form->input('names', array( 'label' => __('Names'))); > > > on a view, the output shows both default table field name AND its > > internationalization. > > > Thanks in advance. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Can't use internationalization on input label
echo $form->input('names', array( 'label' => __('Names', true))); On 16 Nov 2008, at 13:15, Mateo San Román wrote: > > Hello > > When I try to use the __() function on > > echo $form->input('names', array( 'label' => __('Names'))); > > on a view, the output shows both default table field name AND its > internationalization. > > > Thanks in advance. > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Can't use internationalization on input label
Hello When I try to use the __() function on echo $form->input('names', array( 'label' => __('Names'))); on a view, the output shows both default table field name AND its internationalization. Thanks in advance. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Localization and Internationalization: Can't switch languages
Sorry, but it wasn't deliberate :) For some reason this post appeared like an hour after it was posted, making me think it failed to send. Could be caching I don't know. For people facing the same problem, refer to this link on internationalization: http://groups.google.com/group/cake-php/browse_thread/thread/fc0444e17ee03a94# On Jun 21, 6:50 am, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > On Fri, Jun 20, 2008 at 1:21 PM, deltawing <[EMAIL PROTECTED]> wrote: > > > I followed the CakePHP 1.2 tutorial and was able to set the language > > in beforeFilter(). > > > The problem is I want users to be able to switch the language at any > > time, by clicking on a link. How can I do that? I've tried many things > > but I still can't get it to work. > > > Any takers? > > > Thanks in advance. > > Please don't double post. People will respond if they have an answer. > > -- > Chris Hartjes > Internet Loudmouth > Motto for 2008: "Moving from herding elephants to handling snakes..." > @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: internationalization - switching languages
There is something there that might help you : http://www.cakephpforum.net/index.php?showtopic=179 On Jun 20, 7:57 pm, deltawing <[EMAIL PROTECTED]> wrote: > Help please I'm getting really desperate with this one. The problem is > very typical of a multilingual site - the user needs to be able to > switch between several languages. > > Following the CakePHP 1.2 Cookbook, I can a the language in the > beforeFilter() and that seems to work. But I have no idea how to let > the user click on a link and change the language. > > Can somebody help? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Localization and Internationalization: Can't switch languages
On Fri, Jun 20, 2008 at 1:21 PM, deltawing <[EMAIL PROTECTED]> wrote: > > I followed the CakePHP 1.2 tutorial and was able to set the language > in beforeFilter(). > > The problem is I want users to be able to switch the language at any > time, by clicking on a link. How can I do that? I've tried many things > but I still can't get it to work. > > Any takers? > > Thanks in advance. Please don't double post. People will respond if they have an answer. -- Chris Hartjes Internet Loudmouth Motto for 2008: "Moving from herding elephants to handling snakes..." @TheKeyBoard: http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Localization and Internationalization: Can't switch languages
I followed the CakePHP 1.2 tutorial and was able to set the language in beforeFilter(). The problem is I want users to be able to switch the language at any time, by clicking on a link. How can I do that? I've tried many things but I still can't get it to work. Any takers? Thanks in advance. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
internationalization - switching languages
Help please I'm getting really desperate with this one. The problem is very typical of a multilingual site - the user needs to be able to switch between several languages. Following the CakePHP 1.2 Cookbook, I can a the language in the beforeFilter() and that seems to work. But I have no idea how to let the user click on a link and change the language. Can somebody help? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP 1.2 Internationalization
Have a look at Jason Chow's P28N tutorial: http://bakery.cakephp.org/articles/view/p28n-the-top-to-bottom-persistent-internationalization-tutorial He uses both a component and a controller fr switching. I haven't implemented everything quite the same way but this part works like a charm. On Fri, May 16, 2008 at 4:23 AM, Kukuda <[EMAIL PROTECTED]> wrote: > > Hi. > > I have tried to implement a multi-language website using the official > internationalization guide (http://book.cakephp.org/view/161/ > localization-internationalizat), but it only works if I change the > DEFAULT_LANGUAGE in the bootstrap. I have created a language switching > class > > > uses('L10n'); print_r($this); > class LangsController extends AppController > { >var $name = 'Langs'; >var $uses = array(); > >function index() {} > >function switchto($lang) { >if($lang == "eng") { >$this->L10n = new L10n(); >$this->L10n->get("eng"); >Configure::write('Config.language', "eng"); >} >if($lang == "hrv") { >$this->L10n = new L10n(); >$this->L10n->get("hrv"); >Configure::write('Config.language', "hrv"); >} >$this->redirect(Controller::referer('/', true)); >} > } > > but id doesn't do anything :( > > Any ideas? > > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: 1.2 Internationalization
Hi, It is in reality a bit different from what the maunal currently states. Both simpler and more complicated :) Try this: http://groups.google.com/group/cake-php/browse_thread/thread/3ada672bf5a86b6b/37046b1cc949ddb8?lnk=gst&q=i18n#37046b1cc949ddb8 And search fir i18n, l10n or p28n for more. There is also a bakery article with some ideas about the persistance part of localizing. I would suggest switching off all caching when trying this out since language-data is caches and you may notget the result you expect until the cache expires a while later. :) I would also suggest starting with a "common" language like "eng" just to get basic setup right before trying some crazy sub-dialect of something like Spanish (there are many different versions of Spannish which can trip you up at first.) /Martin On May 16, 12:42 pm, Kukuda <[EMAIL PROTECTED]> wrote: > Hi. > > I have tried to implement a multi-language website using the official > internationalization guide (http://book.cakephp.org/view/161/ > localization-internationalizat), but it only works if I change the > DEFAULT_LANGUAGE in the bootstrap. I have created a language switching > class > > uses('L10n'); print_r($this); > class LangsController extends AppController > { > var $name = 'Langs'; > var $uses = array(); > > function index() {} > > function switchto($lang) { > if($lang == "eng") { > $this->L10n = new L10n(); > $this->L10n->get("eng"); > Configure::write('Config.language', "eng"); > } > if($lang == "hrv") { > $this->L10n = new L10n(); > $this->L10n->get("hrv"); > Configure::write('Config.language', "hrv"); > } > $this->redirect(Controller::referer('/', true)); > } > > } > > but id doesn't do anything :( > > Any ideas? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
1.2 Internationalization
Hi. I have tried to implement a multi-language website using the official internationalization guide (http://book.cakephp.org/view/161/ localization-internationalizat), but it only works if I change the DEFAULT_LANGUAGE in the bootstrap. I have created a language switching class uses('L10n'); print_r($this); class LangsController extends AppController { var $name = 'Langs'; var $uses = array(); function index() {} function switchto($lang) { if($lang == "eng") { $this->L10n = new L10n(); $this->L10n->get("eng"); Configure::write('Config.language', "eng"); } if($lang == "hrv") { $this->L10n = new L10n(); $this->L10n->get("hrv"); Configure::write('Config.language', "hrv"); } $this->redirect(Controller::referer('/', true)); } } but id doesn't do anything :( Any ideas? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
CakePHP 1.2 Internationalization
Hi. I have tried to implement a multi-language website using the official internationalization guide (http://book.cakephp.org/view/161/ localization-internationalizat), but it only works if I change the DEFAULT_LANGUAGE in the bootstrap. I have created a language switching class uses('L10n'); print_r($this); class LangsController extends AppController { var $name = 'Langs'; var $uses = array(); function index() {} function switchto($lang) { if($lang == "eng") { $this->L10n = new L10n(); $this->L10n->get("eng"); Configure::write('Config.language', "eng"); } if($lang == "hrv") { $this->L10n = new L10n(); $this->L10n->get("hrv"); Configure::write('Config.language', "hrv"); } $this->redirect(Controller::referer('/', true)); } } but id doesn't do anything :( Any ideas? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: I don't understand how internationalization works in CakePHP.
Thanks for the offer. I couldn't resist; sliv's suggestion seemed pretty funny to me. I'd been forced to put aside the Cake stuff I'd been working on for a while but will be taking another stab at i18n for complete pages stored in the DB. I'm just reviewing Rostislav's i18n behavior now, actually. It looks very good to me. http://www.palivoda.eu/2008/04/i18n-in-cakephp-12-database-content-translation-part-2/ A big problem with i18n is that nobody seemed to have (officially) documented it very well and, meanwhile, several people have come up with various solutions but have only partially explained what it is they did. All of the links on the GG FAQ page, for instance, raise more questions than they answer. That makes it difficult to decide if it's a good solution for one's own project. After carefully going through Rostislav's beavior, I think this is the way I'll be going. But, given that it relies on a 3rd party behavior, I doubt that it would be welcome in the official docs. On Mon, May 5, 2008 at 6:08 PM, John David Anderson <[EMAIL PROTECTED]> wrote: > > > On May 5, 2008, at 4:05 PM, b logica wrote: > > > > > You're suggesting i write the documentation for something i do not > > understand? > > I do. > > It's the best way to learn, and it's the best way for us to get docs > that are targeted to new people. > > If you need help reviewing it, I'm available. :) > > -- John > Docs Monkey > > > > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: I don't understand how internationalization works in CakePHP.
On May 5, 2008, at 4:05 PM, b logica wrote: > > You're suggesting i write the documentation for something i do not > understand? I do. It's the best way to learn, and it's the best way for us to get docs that are targeted to new people. If you need help reviewing it, I'm available. :) -- John Docs Monkey --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: I don't understand how internationalization works in CakePHP.
You're suggesting i write the documentation for something i do not understand? On Mon, May 5, 2008 at 3:19 PM, Sliv <[EMAIL PROTECTED]> wrote: > > I could, but then again, so could you: > > http://manual.cakephp.org > click on 'edit this section' ;) > > > > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: I don't understand how internationalization works in CakePHP.
I could, but then again, so could you: http://manual.cakephp.org click on 'edit this section' ;) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: I don't understand how internationalization works in CakePHP.
OK, missed that. Could you change the docs to better describe how i18n is supposed to work in cake, too ;-) On Mon, May 5, 2008 at 3:05 PM, Sliv <[EMAIL PROTECTED]> wrote: > > I changed the topic to more appropriately describe the OP and the > subsequent answer. > > > On May 5, 2:50 pm, "b logica" <[EMAIL PROTECTED]> wrote: > > Er, what? Were you just thinking out loud? > > > > I don't understand how i18n is supposed to work in Cake either, FWIW. > > > > > > On Mon, May 5, 2008 at 12:13 PM, Sliv <[EMAIL PROTECTED]> wrote: > > > > > Better. > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: I don't understand how internationalization works in CakePHP.
I changed the topic to more appropriately describe the OP and the subsequent answer. On May 5, 2:50 pm, "b logica" <[EMAIL PROTECTED]> wrote: > Er, what? Were you just thinking out loud? > > I don't understand how i18n is supposed to work in Cake either, FWIW. > > On Mon, May 5, 2008 at 12:13 PM, Sliv <[EMAIL PROTECTED]> wrote: > > > Better. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: I don't understand how internationalization works in CakePHP.
Er, what? Were you just thinking out loud? I don't understand how i18n is supposed to work in Cake either, FWIW. On Mon, May 5, 2008 at 12:13 PM, Sliv <[EMAIL PROTECTED]> wrote: > > Better. > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
I don't understand how internationalization works in CakePHP.
Better. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: I'm very confused by your approach to internationalization.
Sorry should have been... sprintf(__('User with e-mail address %s already exists in our database. Please try to use another e-mail address.', true), $value); -- /** * @author Larry E. Masters * @var string $userName * @param string $realName * @returns string aka PhpNut * @access public */ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: I'm very confused by your approach to internationalization.
-- /** * @author Larry E. Masters * @var string $userName * @param string $realName * @returns string aka PhpNut * @access public */ On Sat, May 3, 2008 at 1:07 PM, Ivans <[EMAIL PROTECTED]> wrote: > > Consider flash message you need show to your visitor during > registration process because user with that e-mail address already > exists in your users table. > > "User with e-mail address "[EMAIL PROTECTED]" already exists in our > database. Please try to use another e-mail address". > > YOU CAN'T, because __() function is very primitive. It doesn't take > additional parameters which could replace some placeholders like %s in > msgstr. You can just append some echo at the end of returned (echoed) > string comming from __() function and your message than looks like > machine translated. > > > > Crazy. > > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
I'm very confused by your approach to internationalization.
Consider flash message you need show to your visitor during registration process because user with that e-mail address already exists in your users table. "User with e-mail address "[EMAIL PROTECTED]" already exists in our database. Please try to use another e-mail address". YOU CAN'T, because __() function is very primitive. It doesn't take additional parameters which could replace some placeholders like %s in msgstr. You can just append some echo at the end of returned (echoed) string comming from __() function and your message than looks like machine translated. Crazy. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: internationalization in validation
i18n extract console wont extract from models, the error messages is supposed to be put in the form at the frontend, not at the model level. $form->input('field', array('error' => array('validationName' => __('your validation error string here', true))); or $form->error('field', array('validationName' =>__('Your validation error string here', true))); On 15 Apr., 19:46, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > You could build the variable into a __construct() function : > $this->validate = __('must be alphanumeric') > > On 15 avr, 18:04, gino pilotino <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > i was wondering... when setting custom messages in validation arrays > > for Models > > how can i useinternationalization? > > > i.e. > > > var $validate = array( > > 'item' => > > array( > > 'rule' => 'alphaNumeric', > > 'message' => 'must be alphanumeric' > > ), > > > i want the message to be translated eventually. > > i cannot use __() because it's an in class initialization of a member > > variable > > ($validate) so it only accepts constant inizialization (a simple > > string). > > > I cannot either find documentation for the translate behaviour, > > can somebody please post a link ? can it be useful in this case ? > > > thanks in advance, > > -d.- Skjul tekst i anførselstegn - > > - Vis tekst i anførselstegn - --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: internationalization in validation
You could build the variable into a __construct() function : $this->validate = __('must be alphanumeric') On 15 avr, 18:04, gino pilotino <[EMAIL PROTECTED]> wrote: > Hello, > i was wondering... when setting custom messages in validation arrays > for Models > how can i use internationalization ? > > i.e. > > var $validate = array( > 'item' => > array( > 'rule' => 'alphaNumeric', > 'message' => 'must be alphanumeric' > ), > > i want the message to be translated eventually. > i cannot use __() because it's an in class initialization of a member > variable > ($validate) so it only accepts constant inizialization (a simple > string). > > I cannot either find documentation for the translate behaviour, > can somebody please post a link ? can it be useful in this case ? > > thanks in advance, > -d. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
internationalization in validation
Hello, i was wondering... when setting custom messages in validation arrays for Models how can i use internationalization ? i.e. var $validate = array( 'item' => array( 'rule' => 'alphaNumeric', 'message' => 'must be alphanumeric' ), i want the message to be translated eventually. i cannot use __() because it's an in class initialization of a member variable ($validate) so it only accepts constant inizialization (a simple string). I cannot either find documentation for the translate behaviour, can somebody please post a link ? can it be useful in this case ? thanks in advance, -d. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: url internationalization
I think what you need to do is add something to your AppController to look for $this->params['lang'] and $this->Session->write('Config.language', $lang); I'm really not sure but this is what I had in mind. I'll need to do this same thing very shortly. If you figure it out, please post your solution. BTW, I think you need to use the 3-letter code. I prefer 2-letter myself but it seems Cake needs the 3-letter version. Correct me if I'm wrong (the information on I18N, L10N, etc. is very confusing). On Thu, Mar 6, 2008 at 6:19 AM, TriLLi <[EMAIL PROTECTED]> wrote: > > I need help > How can I tell cake that first paramter in routing is language > Router:Connect('/en/products/index/', Array('lang' =>'en', > 'controller'=>'products', 'action'=>'index')); > > so it can rewrite links in my views > $html->link(__('New Product', true), array('action'=>'add')); > so link can be > http://www.example.com/en/products/add > > this is because I have dozen languages on web site... > npr for bosnian link should be > > http://www.example.com/ba/proizvodi/dodaj > > I have routing file filled with all routes > like > Router:Connect('/ba/products/pocetna/', Array('lang' =>'ba', > 'controller'=>'products', 'action'=>'index')); > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
url internationalization
I need help How can I tell cake that first paramter in routing is language Router:Connect('/en/products/index/', Array('lang' =>'en', 'controller'=>'products', 'action'=>'index')); so it can rewrite links in my views $html->link(__('New Product', true), array('action'=>'add')); so link can be http://www.example.com/en/products/add this is because I have dozen languages on web site... npr for bosnian link should be http://www.example.com/ba/proizvodi/dodaj I have routing file filled with all routes like Router:Connect('/ba/products/pocetna/', Array('lang' =>'ba', 'controller'=>'products', 'action'=>'index')); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
fixed: re. bakery article 'p28n, the top to bottom persistent internationalization tutorial.'
Woops, I found a space after a ?> ... got to watch out for those blighters. On 15 Feb, 13:37, leo <[EMAIL PROTECTED]> wrote: > I've been trying to implement this in 1.2, but I always get a headers > already sent error. Has anyone had any success with it? Does anyone > know the answer to my problem? > > I've already spent the morning picking it to pieces and now I have to > move on to something else. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
re. bakery article 'p28n, the top to bottom persistent internationalization tutorial.'
I've been trying to implement this in 1.2, but I always get a headers already sent error. Has anyone had any success with it? Does anyone know the answer to my problem? I've already spent the morning picking it to pieces and now I have to move on to something else. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: What is the speed of internationalization with __() ?
> I know that we want to add flexibility but when using databases > (especially mysql), the advantages are not little and i think we > should consider an internationalization system with db support. > > What do you think? > Thanks, Cristian /signed Now I use both ways: - "system" strings like "Error", "Erreur", "Fehler" or "Ошибка" stored in .po files and used by __(). It easy to develope, but only specialist (me for example :) ) can change them. - "content" strings like "Description of photo in English", "Description de la photo en français", "Beschreibung des Fotos in deutscher Sprache" and "Описание фотографии на русском" stored in DB and used by my library. User (admin of site, not IT specialist) can change them in CMS, it easy. Sometime user want to change translation of system strings (some of them translated by Google Translate :-) ) and call me, but I don't like it. It would be good that he can change translation of system strings. Of course, I can change CMS for working with .po files too (not sure) or change my code for using DB only, but I think standard class of framework with transparent using both, db and .po files would be better for all :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: What is the speed of internationalization with __() ?
it sounds like a "in DB we trust" pattern. On Oct 27, 9:02 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hey everybody, > i was just checking the new features in 1.2.x and noticed how > internationalization was implemented. I was wondering how reading from > file behaves? Isn't loading a file that sometimes might be really big > at every page access slow? Is there any caching (maybe using shared > memory)? > > I usually keep my translations in database. This allows me several > things: > - create a cms for translations (the usual case is that a site-builder > won't handle the translation, but the client will, and a nice cms is > always appreciated) > - organize the words/phrases in categories and add meta data like the > date of last change, which adds flexibility (you don't have to scroll > 1000 not ordered words to find one, and maybe add tracking and > rollback for donkey clients - belive me there are many) > - speed things up significantly with a little trick: create a mirror > table for translations (of type MEMORY) that will contain all the > words/phrases in the normal table and will be used for queries. > Because MEMORY type tables only handle fixed length columns, i > fragment the words in peaces of fixed length (let's say 32char), but > my benchmarks showed me that even with the reconstruction of the > fragments, on heavily loaded sites, this is way way faster than normal > reads from db or file. To keep database integrity and not loose it in > case the server crashes cms makes modifications on both tables. But > this doesn't affect anything because 99.999% of the operations on this > table will be read. > > I know that we want to add flexibility but when using databases > (especially mysql), the advantages are not little and i think we > should consider an internationalization system with db support. > > What do you think? > Thanks, Cristian --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: What is the speed of internationalization with __() ?
> I know that we want to add flexibility but when using databases > (especially mysql), the advantages are not little and i think we > should consider an internationalization system with db support. > Ive yet to use it, but I was under the impression that internationalization via the DB was supported via the Tranlsate Modle Behaviour... Is that what you´re looking for? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
What is the speed of internationalization with __() ?
Hey everybody, i was just checking the new features in 1.2.x and noticed how internationalization was implemented. I was wondering how reading from file behaves? Isn't loading a file that sometimes might be really big at every page access slow? Is there any caching (maybe using shared memory)? I usually keep my translations in database. This allows me several things: - create a cms for translations (the usual case is that a site-builder won't handle the translation, but the client will, and a nice cms is always appreciated) - organize the words/phrases in categories and add meta data like the date of last change, which adds flexibility (you don't have to scroll 1000 not ordered words to find one, and maybe add tracking and rollback for donkey clients - belive me there are many) - speed things up significantly with a little trick: create a mirror table for translations (of type MEMORY) that will contain all the words/phrases in the normal table and will be used for queries. Because MEMORY type tables only handle fixed length columns, i fragment the words in peaces of fixed length (let's say 32char), but my benchmarks showed me that even with the reconstruction of the fragments, on heavily loaded sites, this is way way faster than normal reads from db or file. To keep database integrity and not loose it in case the server crashes cms makes modifications on both tables. But this doesn't affect anything because 99.999% of the operations on this table will be read. I know that we want to add flexibility but when using databases (especially mysql), the advantages are not little and i think we should consider an internationalization system with db support. What do you think? Thanks, Cristian --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: dynamic internationalization -->multilanguage website
Cheers guys, I also found the new P28n behavior tutorial and code very usefull for static translation/lang switch. http://bakery.cakephp.org/articles/view/p28n-the-top-to-bottom-persistent-internationalization-tutorial dan On 11 Set, 08:25, the_woodsman <[EMAIL PROTECTED]> wrote: > Unless I've misunderstood, I think what you are looking for is the > Model Translate behaviour, a related part of the new > internationalisation features of 1.2. > > On Sep 10, 6:11 pm, francky06l <[EMAIL PROTECTED]> wrote: > > > Well you can use the current language ('Config.language') to set it in > > your DB and then use the current language as a condition when > > querying. In anyway that will force the user to enter his post in the > > language he decided to display the page ...Unless you can detect the > > language from the fields in the post ...but that's another story. > > > On Sep 10, 8:56 pm, cakeFreak <[EMAIL PROTECTED]> wrote: > > > > hey guys, sorry for my late replay, and cheers for your help. > > > > I'll try to be less cryptic. > > > > Let's take a multilingual website with a specular section in language > > > 1 (italian), and language 2 (english). When in other circumstances I > > > was in this kind of situation I used to add an extra "language field" > > > in the DB, that was "it" when I was posting in Italian, and "en" when > > > posting in English. > > > > When an user was surfing the API in english, the system was retrieving > > > posts marked with the language field "en", while it was retrieving > > > posts marked with "it" when the user was broasing the API clicking the > > > italian flag. > > > > Has the "i18n" library been set in order to handle the problem I > > > described above? > > > > cheers Dan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: dynamic internationalization -->multilanguage website
Unless I've misunderstood, I think what you are looking for is the Model Translate behaviour, a related part of the new internationalisation features of 1.2. On Sep 10, 6:11 pm, francky06l <[EMAIL PROTECTED]> wrote: > Well you can use the current language ('Config.language') to set it in > your DB and then use the current language as a condition when > querying. In anyway that will force the user to enter his post in the > language he decided to display the page ...Unless you can detect the > language from the fields in the post ...but that's another story. > > On Sep 10, 8:56 pm, cakeFreak <[EMAIL PROTECTED]> wrote: > > > hey guys, sorry for my late replay, and cheers for your help. > > > I'll try to be less cryptic. > > > Let's take a multilingual website with a specular section in language > > 1 (italian), and language 2 (english). When in other circumstances I > > was in this kind of situation I used to add an extra "language field" > > in the DB, that was "it" when I was posting in Italian, and "en" when > > posting in English. > > > When an user was surfing the API in english, the system was retrieving > > posts marked with the language field "en", while it was retrieving > > posts marked with "it" when the user was broasing the API clicking the > > italian flag. > > > Has the "i18n" library been set in order to handle the problem I > > described above? > > > cheers Dan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: dynamic internationalization -->multilanguage website
Well you can use the current language ('Config.language') to set it in your DB and then use the current language as a condition when querying. In anyway that will force the user to enter his post in the language he decided to display the page ...Unless you can detect the language from the fields in the post ...but that's another story. On Sep 10, 8:56 pm, cakeFreak <[EMAIL PROTECTED]> wrote: > hey guys, sorry for my late replay, and cheers for your help. > > I'll try to be less cryptic. > > Let's take a multilingual website with a specular section in language > 1 (italian), and language 2 (english). When in other circumstances I > was in this kind of situation I used to add an extra "language field" > in the DB, that was "it" when I was posting in Italian, and "en" when > posting in English. > > When an user was surfing the API in english, the system was retrieving > posts marked with the language field "en", while it was retrieving > posts marked with "it" when the user was broasing the API clicking the > italian flag. > > Has the "i18n" library been set in order to handle the problem I > described above? > > cheers Dan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: dynamic internationalization -->multilanguage website
hey guys, sorry for my late replay, and cheers for your help. I'll try to be less cryptic. Let's take a multilingual website with a specular section in language 1 (italian), and language 2 (english). When in other circumstances I was in this kind of situation I used to add an extra "language field" in the DB, that was "it" when I was posting in Italian, and "en" when posting in English. When an user was surfing the API in english, the system was retrieving posts marked with the language field "en", while it was retrieving posts marked with "it" when the user was broasing the API clicking the italian flag. Has the "i18n" library been set in order to handle the problem I described above? cheers Dan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: dynamic internationalization -->multilanguage website
Look at the "How to add i18n support?" section. in http://groups.google.com/group/cake-php/web/frequent-discussions . On Sep 7, 1:46 pm, francky06l <[EMAIL PROTECTED]> wrote: > I do not really understand "I mean for example retrieving/storing a > post content in English or > another language depending on the stored locale in sessions. ".. If > the post is entered only once you'll have one occurrence of it. > > i18n will not translate your captured data in cake. The user can > choose the Spanish language and enter the data in English for example. > Concerning the database itself, I always use UTF-8 as encoding, that > permit to store all languages. > > hope this helps > > On Sep 7, 4:01 pm, cakeFreak <[EMAIL PROTECTED]> wrote: > > > Hey guys, > > > cheers for the clues on how to use l10n (http://groups.google.com/ > > group/cake-php/browse_frm/thread/1edcbbaed20657b9/13afbe9841b91314? > > #13afbe9841b91314). This will be super in order to handle static > > language messages. > > > But what about retrieving content in database for different languages? > > I mean for example retrieving/storing a post content in english or > > another language depending on the stored locale in sessions. > > How does i18n works? > > > Cheers > > > Dan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: dynamic internationalization -->multilanguage website
I do not really understand "I mean for example retrieving/storing a post content in English or another language depending on the stored locale in sessions. ".. If the post is entered only once you'll have one occurrence of it. i18n will not translate your captured data in cake. The user can choose the Spanish language and enter the data in English for example. Concerning the database itself, I always use UTF-8 as encoding, that permit to store all languages. hope this helps On Sep 7, 4:01 pm, cakeFreak <[EMAIL PROTECTED]> wrote: > Hey guys, > > cheers for the clues on how to use l10n (http://groups.google.com/ > group/cake-php/browse_frm/thread/1edcbbaed20657b9/13afbe9841b91314? > #13afbe9841b91314). This will be super in order to handle static > language messages. > > But what about retrieving content in database for different languages? > I mean for example retrieving/storing a post content in english or > another language depending on the stored locale in sessions. > How does i18n works? > > Cheers > > Dan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
dynamic internationalization -->multilanguage website
Hey guys, cheers for the clues on how to use l10n (http://groups.google.com/ group/cake-php/browse_frm/thread/1edcbbaed20657b9/13afbe9841b91314? #13afbe9841b91314). This will be super in order to handle static language messages. But what about retrieving content in database for different languages? I mean for example retrieving/storing a post content in english or another language depending on the stored locale in sessions. How does i18n works? Cheers Dan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: About internationalization (i18n)
The locale code isn't in the nightly, it's here: https://trac.cakephp.org/browser/whiteboard/proposals/bundt/1.x.x.x/ However, there are several complete implementations which are being used in production settings, most notably Andy Dawson's (AD7six) implementation, which I believe you can find on CakeForge. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
About internationalization (i18n)
I am starting a new web project, and I want to give Cake a try. But there's a caveat: I have to create a multilanguage site. After searching this group and the Cake docs, I have found only a couple of "hand made" solutions, and the promise to have i18n in version 2 of CakePHP, but with a mention of it being "almost done" (https://trac.cakephp.org/wiki/Proposals/2.0ToDoList). If this is true, is there any information or source code of the current progress? I have searched a nightly build for "locale", "language", "i18n" with no success... Before coding my own solution, I would like to have an idea of the proposed "official" one. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---