Hi all,

Relatively new to CakePHP although I have most of the basics down pat.
I am creating a website using i18n and there don't seem to be many
solutions out there that I can really use. I found this
http://www.formation-cakephp.com/41/multilingue-18n-l10n about
Internationlization. It is in French though so I use Google
Translation to translate it for me.

The problem is that the site only suggests using one po file and this
is not a good idea for me as:

1) There are a lot of pages that is being ported from the old website
2) The person I work with is not a programmer so I have to make it as
simple as possible

Thus the solution is to create multiple po files and use them to
display each page which ends up being easier to maintain and update
for the other person.

I have gone through the coding that is suggested within the site and
it works. The problem is that like previously said this only works for
1 po (default.po) being used.

Through another tutorial
http://bakery.cakephp.org/articles/view/p28n-the-top-to-bottom-persistent-internationalization-tutorial
on bakery.cakephp.org The last comment on the very bottom of the page
suggests the following code to use if you wanted to use multiple po
files.

CODE
app/app_controller.php :
---
class AppController extends Controller {
...
var $domain = 'default';
...
function beforeFilter() {
...
$this->domain = 'default';

}

function beforeRender(){
...
$this->set('domain', $this->domain);

}
}

In app/controllers/xxx_controller.php :
class XxxController extends AppController {

function yyy($index = 0) {
...
$this->set('domain', '-views-xxxs-yyy');
...

}
}

In app/views/xxxs/yyy.ctp :
...
__d($domain, "SENTENCE_TO_TRANSLATE");
...

In app/locale/eng/LC_MESSAGES/-views-xxxs-yyy.po :
...
msgid "SENTENCE_TO_TRANSLATE"
msgstr "sentence translated"
...

In app/locale/fre/LC_MESSAGES/-views-xxxs-yyy.po :
...
msgid "SENTENCE_TO_TRANSLATE"
msgstr "phrase traduite"
...


I got this to work but the problem is that it only loads the default
layout's po file and when I try to put it in the default
pages_controller or any other controller it does not work. I get it to
work on individual controllers if I put the $this->set('domain', '-
views-xxxs-yyy'); bit of each individual controller in the
beforeFilter(). But when I do this the default layout's translations
does not work and reverts to the original text.

I'm been trying to fix this for the last 2 days and since i18n help
online is so limited it's really hard for me to try to sort the
problem. Any suggestions on how to get this to work?

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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to