Sunday, February 10, 2013

Re: translation of Dropdowns

the question is: why are you not using "true" as second param for __() when you did so correctly in the first place
or even better:
why debugging a completely different - and again translated for a second time - result/output than you actually created yourself?
why not just using the value you just created?

    debug($sL10nValue); // instead of debug(__(...)) which would need to be debug(__(..., true)) but which would make no sense




Am Sonntag, 10. Februar 2013 18:36:50 UTC+1 schrieb acl68:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi everybody,

I an using Cakephp 1.3 and just work on translating my site. Things like
field labels work fine. But I also want to translate some dropdown
fields e.g. Country lists or type lists.

So the msgid would come from the database and I want to translate it
with my po/mo files. Since I will need the translation in a lot of
controllers I made a method in the appcontroller which receives an
array, translates the value with the __() method builds from that a new
method and returns this to the calling method.

Nice plan, but it doesn't work. calling the __() method from the
app_controller gives me just empty strings.

Question:
Do I miss a setting here somewhere to be able to use this method in the
app_controller?


Here my method:
 function l10nList($aList) {
  foreach($aList as $sKey => $sValue) {
   debug($sValue);
   $sL10nValue = __($sValue, true);
   debug(__($sL10nValue));
   $aL10nList[$sKey] = $sL10nValue;
  }
  return $aL10nList;
 }

The first debug gives me my value, the second nothing. Why?



Any help appreciated and rewarded with instant good karma  ;)

Calamity Jane
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAlEX2rEACgkQbOdiIJzHNKHbQACfYYTufbNFmm0XDUdL7Sck0eNb
iPAAn2SMnyvHr3XiUHb+L2X6GkCsgIA2
=UWCo
-----END PGP SIGNATURE-----

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: