Hi all, We saw the javascript files(.js) are not translated. In fact, only .tmpl and .inc strings are exported in po files. Some developers added some strings to be translated in javascript files (Like "Cart" button in OPAC), so when we translate in french, there is no translation for those strings. I looked up content of tmpl_process, xgettext.pl, TmplTokenizer and saw that only <script> tags are parsed as javascript. I tryied to patch it quickly to try parsing .js files as "<script>" content, but it seems that is more complicated it seems. Perhaps someone who already patched those files can guide me to the right way? Bests, -- Nahuel ANGELINETTI
I think the convention has been to use the underscore function to designate translatable string literals like: alert( _("Error: barcode empty!") ); Whether that is actually working or not, I'll have to leave for someone else to answer. --Joe On Mon, Dec 29, 2008 at 10:25 AM, Nahuel ANGELINETTI <nahuel@biblibre.com>wrote:
Hi all,
We saw the javascript files(.js) are not translated. In fact, only .tmpl and .inc strings are exported in po files. Some developers added some strings to be translated in javascript files (Like "Cart" button in OPAC), so when we translate in french, there is no translation for those strings. I looked up content of tmpl_process, xgettext.pl, TmplTokenizer and saw that only <script> tags are parsed as javascript. I tryied to patch it quickly to try parsing .js files as "<script>" content, but it seems that is more complicated it seems. Perhaps someone who already patched those files can guide me to the right way?
Bests,
-- Nahuel ANGELINETTI _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha.org http://lists.koha.org/mailman/listinfo/koha-devel
The convention is to use _(), BUT tmpl_process doesn't parse the ".js" files. So they're not putted in po translation files and translators cannot translate them. Only <script> tags are parsed as javascript. Le Mon, 29 Dec 2008 10:51:06 -0500, "Joe Atzberger" <ohiocore@gmail.com> a écrit :
I think the convention has been to use the underscore function to designate translatable string literals like: alert( _("Error: barcode empty!") );
Whether that is actually working or not, I'll have to leave for someone else to answer.
--Joe
On Mon, Dec 29, 2008 at 10:25 AM, Nahuel ANGELINETTI <nahuel@biblibre.com>wrote:
Hi all,
We saw the javascript files(.js) are not translated. In fact, only .tmpl and .inc strings are exported in po files. Some developers added some strings to be translated in javascript files (Like "Cart" button in OPAC), so when we translate in french, there is no translation for those strings. I looked up content of tmpl_process, xgettext.pl, TmplTokenizer and saw that only <script> tags are parsed as javascript. I tryied to patch it quickly to try parsing .js files as "<script>" content, but it seems that is more complicated it seems. Perhaps someone who already patched those files can guide me to the right way?
Bests,
-- Nahuel ANGELINETTI _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha.org http://lists.koha.org/mailman/listinfo/koha-devel
I intend to submit a patch this week that will add an include to the staff side: base-js.inc , which includes js that needs to be processed by H::T::P. It will include a global 'koha' object, which could store an array of strings for translation. If accepted, the same could be done for the opac. That could be used if making tmpl_process parse .js files is too messy. Regards, -- Ryan Higgins LibLime * Open-Source Solutions for Libraries Featuring KohaZOOM ILS 888-564-2457 x704 On Mon, Dec 29, 2008 at 10:25 AM, Nahuel ANGELINETTI <nahuel@biblibre.com> wrote:
Hi all,
We saw the javascript files(.js) are not translated. In fact, only .tmpl and .inc strings are exported in po files. Some developers added some strings to be translated in javascript files (Like "Cart" button in OPAC), so when we translate in french, there is no translation for those strings. I looked up content of tmpl_process, xgettext.pl, TmplTokenizer and saw that only <script> tags are parsed as javascript. I tryied to patch it quickly to try parsing .js files as "<script>" content, but it seems that is more complicated it seems. Perhaps someone who already patched those files can guide me to the right way?
Bests,
-- Nahuel ANGELINETTI _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha.org http://lists.koha.org/mailman/listinfo/koha-devel
On Mon, Dec 29, 2008 at 9:15 AM, Ryan Higgins <ryan.higgins@liblime.com>wrote:
I intend to submit a patch this week that will add an include to the staff side: base-js.inc , which includes js that needs to be processed by H::T::P. It will include a global 'koha' object, which could store an array of strings for translation. If accepted, the same could be done for the opac.
That could be used if making tmpl_process parse .js files is too messy.
Regards,
-- Ryan Higgins
LibLime * Open-Source Solutions for Libraries Featuring KohaZOOM ILS 888-564-2457 x704
On Mon, Dec 29, 2008 at 10:25 AM, Nahuel ANGELINETTI <nahuel@biblibre.com> wrote:
Hi all,
We saw the javascript files(.js) are not translated. In fact, only .tmpl and .inc strings are exported in po files. Some developers added some strings to be translated in javascript files (Like "Cart" button in OPAC), so when we translate in french, there is no translation for those strings. I looked up content of tmpl_process, xgettext.pl, TmplTokenizer and saw that only <script> tags are parsed as javascript. I tryied to patch it quickly to try parsing .js files as "<script>" content, but it seems that is more complicated it seems. Perhaps someone who already patched those files can guide me to the right way?
Bests,
-- Nahuel ANGELINETTI _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha.org http://lists.koha.org/mailman/listinfo/koha-devel
_______________________________________________ Koha-devel mailing list Koha-devel@lists.koha.org http://lists.koha.org/mailman/listinfo/koha-devel
Ryan, This sounds like a great idea, and would allow easy translation. Would it be possible to have a separate script that accessed this template, however, for HTTP caching purposes? We already have a fairly large amount of inline JS, and this translation object might get fairly hefty. -- Jesse Weaver Software Developer, LibLime
participants (4)
-
Jesse Weaver -
Joe Atzberger -
Nahuel ANGELINETTI -
Ryan Higgins