Re: How to correctly use l10n and i18n in Cake 1.2?

2008-02-21 Thread leo

I've been working on something similar. You don't say whether the
select options are dynamic - from a db - or static. I haven't tried it
yet, but can't you just pass the message names wrapped in __(),
possibly with the true parameter, into the options?

On Feb 20, 5:55 pm, Alan Ford [EMAIL PROTECTED] wrote:
 I am trying to find out the usage of i10n and i18n with Cake 1.2.

 Let's try a simple example: I want to develop an app with
 multilanguage support. For simplicity let's say we have it in English
 and German.

 Now, let's pretend we have a form where you are supposed to select
 your gender from a select box. In the desired language, I will need to
 1) display the label for the select box
 2) populate the select box with the possible options

 Part 1 I will do via l10n and .po files as specified 
 inhttp://tempdocs.cakephp.org/#TOC135299
 This is pretty straight forward and works nicely.

 But how do I implement part 2 automagically with the correct gender in
 the desired language?
 How to make Cake retrieve the right content and save it with the
 correct id?

 I've taken a look at the proposed i18n table structure but cannot
 figure out how to implement it. From the i18n class description I also
 cannot really learn anything.
 From what I've understood, I will use the l10n class for any content
 that is not database-related, e.g. labels for form elements, error
 messages, titles etc. I'd use i18n as soon as I have data that needs
 to be displayed in different languages AND saved in the database.

 Any help, pointers, simple solution would be greatly appreciated!

 Thx in advance.
--~--~-~--~~~---~--~~
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: How to correctly use l10n and i18n in Cake 1.2?

2008-02-21 Thread Werschinger

The data is dynamic, it is stored in the DB.

Loosely speaking, I have data like

in English:
id: 1
desc: male
id: 2
desc: female

in German
id: 1
desc: männlich
id: 2
desc: weiblich

When somebody choose a gender (or a country or some other data) the ID
will be stored as a foreign key.

Now...I could, of course, store the English string in the DB and pull
them via __() when German or some other language is required. However,
in that case, I'd have to recreate a data array as one string at a
time is returned by __(). Doesn't seem like an elegant solution to me.

I'm just curious if this problem is supposed to be solved via the i18n
table as proposed in Cake 1.2. At this point, I just don't know how to
use the proposed table structure as found in app/config/sql/i18n.sql.

In other posts, I have read that other tables in the form model_i18n
need to be generated. I just have not found a step by step example of
how to use i18n.

Does anybody know?

Thx again.
--~--~-~--~~~---~--~~
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: How to correctly use l10n and i18n in Cake 1.2?

2008-02-21 Thread b logica

I'll be facing this same issue very soon. I've had a look at the I18N
table structure and I'm also unsure how to proceed (or that it even
suits my needs).

One trick I was thinking about is something I've already done fr years
building English/French sites. Where I have a lookup table with values
for select lists, I have fields ID, name_en, and name_fr. With Cake,
one can set the display field before doing a find('list'). Here's an
example from my MembersController, where I want populate a select list
with region names:

$this-Member-Region-displayField = name_${lang};
$this-set('regions', $this-Member-Region-find('list'));

Then $regions can be passed in the view to create your select list and
will contain only the english region names. ($lang is gotten from the
session but has a default to avoid problems).

Now, how to deal with other content i haven't figured out yet.

On Thu, Feb 21, 2008 at 9:16 AM, Werschinger [EMAIL PROTECTED] wrote:

  The data is dynamic, it is stored in the DB.

  Loosely speaking, I have data like

  in English:
  id: 1
  desc: male
  id: 2
  desc: female

  in German
  id: 1
  desc: männlich
  id: 2
  desc: weiblich

  When somebody choose a gender (or a country or some other data) the ID
  will be stored as a foreign key.

  Now...I could, of course, store the English string in the DB and pull
  them via __() when German or some other language is required. However,
  in that case, I'd have to recreate a data array as one string at a
  time is returned by __(). Doesn't seem like an elegant solution to me.

  I'm just curious if this problem is supposed to be solved via the i18n
  table as proposed in Cake 1.2. At this point, I just don't know how to
  use the proposed table structure as found in app/config/sql/i18n.sql.

  In other posts, I have read that other tables in the form model_i18n
  need to be generated. I just have not found a step by step example of
  how to use i18n.

  Does anybody know?

  Thx again.


 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---