No there isn't really. This is also a problem for any language, and
unless you have back-end parsed JS files it's not possible. The only
solution is so place a JS literal object in your page source
containing the message strings:

<script>
var Msg = {
        username: '<?php echo __('username'); ?>',
        someKey: '<?php echo __('moreKeys'); ?>'
};
</script>

And then reference it in your JS:

alert(Msg.username);

On Nov 9, 12:26 am, heohni <[email protected]>
wrote:
> Hi,
>
> I have a multilingual project and I am using the P28n and <?php
>  __('text'); ?> methods.
>  But I am also doing a lot of Ajax stuff and from time to time I have
>  the need to output text via my javascript files.
>
> Is there anyhow a way / a trick ( how to use the cakephp translation
>  () in my js files?
>
> Thanks! I look forward to your appreciated answers!

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to