Sunday, February 10, 2013

Re: translation of Dropdowns

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi euromark,

thanks for your quick answer and "listening" to my problem.

So... I found the error. It was a mixture between missing "true" and
copy & paste error.

Here I include the working method. I guess someone else might find it
useful.

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

Thanks euromark!

Calamity Jane


Am 10.02.2013 20:15, schrieb euromark:
> 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:
>>
> 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)

iEYEARECAAYFAlEX/LAACgkQbOdiIJzHNKGXMACfcEPH4BdLqZAvG15r04AscyEa
MCAAn0yJ4n6eKCgGpoucW78oW1o/94G5
=lLyX
-----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: