Re: Multilingual dynamic content
I had the same problem in my last project, a multilanguage product katalog: http://www.shop.werit.eu My solution was like langdon proposed: a table called languages which keeps all translated strings and hold a reference to the related record: - id - object_id (foreign object) - lang (de/en/fr) - type (product / category /page .. of the foreign object) - name (holding product name) - description (product description) the selected language is kept in the session, and the strings for buttons / static texts are in php language files within constant defines. the downside of this pattern is that when using internal cake relations there is a big overhead in sql calls, so i wrote custom finder methods for each related model (products/categories/..) to findAllWithLanguage in one sql call. --~--~-~--~~~---~--~~ 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: Multilingual dynamic content
There are many paths to the same goal :-) Hope you find your solution. Langdon peper wrote: > Well. Your idea looks good. > For me caching and language selection is done in flash. On the other > hand, this solution looks hard to put into our CMS. I'll think about > it. > > Thank you for your help. --~--~-~--~~~---~--~~ 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: Multilingual dynamic content
Well. Your idea looks good. For me caching and language selection is done in flash. On the other hand, this solution looks hard to put into our CMS. I'll think about it. Thank you for your help. On Feb 17, 2:42 am, Langdon Stevenson <[EMAIL PROTECTED]> wrote: > Hi majna > > As you say, this isn't about Cake, its just a PHP design patern. > > What you suggested is pretty much what I do, except that I get the > language setting from the browser. To allow me to cache views though I > will need to do as you are suggesting and add the language to the URL. > > Langdon > > majna wrote: > > products table: add language_id. > > > for language detection add lang in URl, > > like: products/view/en/123... or somethin else.(so page could be > > linked) > > grab this "lang", find language id and select from products where > > language:id > > put language_id in session etc. > > > This is not CAKE feature, but general web app design i think?! --~--~-~--~~~---~--~~ 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: Multilingual dynamic content
Hi majna As you say, this isn't about Cake, its just a PHP design patern. What you suggested is pretty much what I do, except that I get the language setting from the browser. To allow me to cache views though I will need to do as you are suggesting and add the language to the URL. Langdon majna wrote: > products table: add language_id. > > for language detection add lang in URl, > like: products/view/en/123... or somethin else.(so page could be > linked) > grab this "lang", find language id and select from products where > language:id > put language_id in session etc. > > This is not CAKE feature, but general web app design i think?! --~--~-~--~~~---~--~~ 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: Multilingual dynamic content
Hi peper Your situation is similar to mine. My solution is for a product would be, store a reference to the appropriate text string instead of a field of text in the product record. So you have one "description" field that holds a key for the string (and all of its translations) Store the translated text in on table that has four fields: - id - key - language reference - text string Combine the reference with the language identifier and select the appropriate text string from the i18n table. This means that I have: - One table to store all of the text - Can implement as many languages as you like - Don't have a bloated product table. The down side of course is performance, however view caching can eliminate that. Regards, Langdon > I read about i18n and PEAR::Translation2 packages, and I even found a > cake component to use it. But it's not what I need. --~--~-~--~~~---~--~~ 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: Multilingual dynamic content
products table: add language_id. for language detection add lang in URl, like: products/view/en/123... or somethin else.(so page could be linked) grab this "lang", find language id and select from products where language:id put language_id in session etc. This is not CAKE feature, but general web app design i think?! On Feb 16, 4:38 pm, "peper" <[EMAIL PROTECTED]> wrote: > Thanks. > I read about i18n and PEAR::Translation2 packages, and I even found a > cake component to use it. But it's not what I need. > This all is about static content like menus, titles etc. For static > content I can use built-in flash mechanism and this is not a problem. > The problem is for dynamic content - f.e. products. I want to simply > switch beetwen getting English products descriptions and Polish > descriptions. I want to have one database, without duplicate Polish > and English tables. > > I want to make something like I would make it in SQL: > Once: > SELECT name, descriptionEN AS description FROM products > > other time > SELECT name, descriptionPL AS description FROM products > > Both times I've got the same product with 'name' and 'description'. > > Is something like this possible to make in Cake without using SQL > statements? > > On Feb 15, 11:07 pm, Langdon Stevenson <[EMAIL PROTECTED]> > wrote: > > > Hi peper > > > > Hi. I'm developing a Flash site using CakePHP+AMFPHP as a server back- > > > end. The site will be multilingual. What would You suggest to do this? > > > I am working on a site with this requirement too. My solution: > > > I Googled PHP i18n solutions. I now have a function that is similar to > > the Cake i18n component, except that it keeps the translated text in a > > database, rather than in translation files. > > > This means that the piece/s of text retrieved from the database are set > > according to the user's web browser's default language. I implemented > > this about 11 months ago, so didn't have the benefit of recent Cake > > development. > > > If I were you I would have a look at i18n. This stuff has all been done > > before, so no need to re-invent the wheel. > > > Regards, > > Langdon --~--~-~--~~~---~--~~ 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: Multilingual dynamic content
Thanks. I read about i18n and PEAR::Translation2 packages, and I even found a cake component to use it. But it's not what I need. This all is about static content like menus, titles etc. For static content I can use built-in flash mechanism and this is not a problem. The problem is for dynamic content - f.e. products. I want to simply switch beetwen getting English products descriptions and Polish descriptions. I want to have one database, without duplicate Polish and English tables. I want to make something like I would make it in SQL: Once: SELECT name, descriptionEN AS description FROM products other time SELECT name, descriptionPL AS description FROM products Both times I've got the same product with 'name' and 'description'. Is something like this possible to make in Cake without using SQL statements? On Feb 15, 11:07 pm, Langdon Stevenson <[EMAIL PROTECTED]> wrote: > Hi peper > > > Hi. I'm developing a Flash site using CakePHP+AMFPHP as a server back- > > end. The site will be multilingual. What would You suggest to do this? > > I am working on a site with this requirement too. My solution: > > I Googled PHP i18n solutions. I now have a function that is similar to > the Cake i18n component, except that it keeps the translated text in a > database, rather than in translation files. > > This means that the piece/s of text retrieved from the database are set > according to the user's web browser's default language. I implemented > this about 11 months ago, so didn't have the benefit of recent Cake > development. > > If I were you I would have a look at i18n. This stuff has all been done > before, so no need to re-invent the wheel. > > Regards, > Langdon --~--~-~--~~~---~--~~ 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: Multilingual dynamic content
Hi peper > Hi. I'm developing a Flash site using CakePHP+AMFPHP as a server back- > end. The site will be multilingual. What would You suggest to do this? I am working on a site with this requirement too. My solution: I Googled PHP i18n solutions. I now have a function that is similar to the Cake i18n component, except that it keeps the translated text in a database, rather than in translation files. This means that the piece/s of text retrieved from the database are set according to the user's web browser's default language. I implemented this about 11 months ago, so didn't have the benefit of recent Cake development. If I were you I would have a look at i18n. This stuff has all been done before, so no need to re-invent the wheel. Regards, Langdon --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Multilingual dynamic content
Hi. I'm developing a Flash site using CakePHP+AMFPHP as a server back- end. The site will be multilingual. What would You suggest to do this? I think of making DB like that, for example Product (id, name, descriptionEN, descriptionFR, descriptionPL, image) it is easy to manage for web admin. But is there a possibility to make a model, wich will have one field - "description" - which will be bound to one of the fields descriptionEN, descriptionFR, descriptionPL id db? Or maybe It is possible to easily map descriptionEN, descriptionFR or descriptionPL to "description" field name while doing findAll ?? I think making tables like ProductEN, ProductFR, ProductPL isn't a good idea. Making a 1-1 association from Product to DescriptionEN, DescriptionFR, DescriptionPL table looks hard to manage. Products have to be easily added/removed in CMS system. What do You think? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---