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 <vikas...@gmail.com> 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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment