ezscript_require with i18n strings

Author Message

Jerome Despatis

Saturday 29 January 2011 2:48:20 am

Hi,

I've some javascripts (bundled in a global minified .js file thanks to ezscript_require).

In those javascripts, I may have functions that use localized strings. For now, I give those localized strings as an argument to those .js functions, but really not a perfect solution.

=> hence my question: as ezscript_require parses all my .js script, is it possible to use some kind of i18n("...") function in the .js file, and ezscript replaces them according to siteaccess for example (in the case siteaccess is the language)

Or any idea is welcome to use localized strings in a .js file, (that would be parsed by ezlupdate to easily create translation.ts for each foreign language)

Thanks

Jerome Despatis

Saturday 29 January 2011 10:17:12 am

Well gonna use a i18n() js func in my js scripts and an ezjscore server functions to provide this function with all localized strings. As it is a php class, it will get parsed by ezlupdate...

Gaetano Giunta

Monday 31 January 2011 1:16:34 am

Not something I recommend, but you can use the "include" template function to actually have some js files parsed using the template engine (hence translatable via i18n) and included on the page. Just use the 'file:' namespace instead of the 'design:' one. Drawback is that you'll have css/jss inline

Principal Consultant International Business
Member of the Community Project Board

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.