This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » legacy support » symfony 1.1 » No translation of i18n text
icon8.gif  No translation of i18n text [message #99316] Tue, 18 May 2010 17:46 Go to next message
ljpumas  is currently offline ljpumas
Messages: 40
Registered: October 2007
Member
Hi volks,

I have funny problem with i18n text.
In my action I define it like this:
...
$i18n = $this->getContext()->getI18N();
$this->form->bind($request->getParameter('profile'), $request->getFiles('profile'));
if ($this->form->isValid())
{
  $this->form->save();
  MyClass::myMethod($i18n->__('Text to translate')); # <<<===  No translation inside of the method
...


This does not work, too:

...
$i18n = $this->getContext()->getI18N();
$this->form->bind($request->getParameter('profile'), $request->getFiles('profile'));
if ($this->form->isValid())
{
  $this->form->save();
  $text = $i18n->__('Text to translate'); # <<<===
  MyClass::myMethod($text); # <<<=== No translation inside of the method
...


But this works:

...
$i18n = $this->getContext()->getI18N();
$text = $i18n->__('Text to translate');  # <<<=== !!!
$this->form->bind($request->getParameter('profile'), $request->getFiles('profile'));
if ($this->form->isValid())
{
  $this->form->save();
  MyClass::myMethod($text); # <<<=== Translation works fine
...



And I don't have any idea why.

I hope you can help me.


[SOLVED] Re: No translation of i18n text [message #99381 is a reply to message #99316 ] Wed, 19 May 2010 14:37 Go to previous message
ljpumas  is currently offline ljpumas
Messages: 40
Registered: October 2007
Member
I found the bug.

There was a stupid bug in the form doSave() which sets the sf_user culture to an empty value Embarassed

[Updated on: Wed, 19 May 2010 14:37]

Previous Topic:Symfony Cache grows to much?
Next Topic:i18n in option form add_empty
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software