[Bug 42577] New: Gettext.js incorrectly located and tidied
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42577 Bug ID: 42577 Summary: Gettext.js incorrectly located and tidied Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: trivial Priority: P5 - low Component: Templates Assignee: oleonard@myacpl.org Reporter: dcook@prosentient.com.au QA Contact: testopia@bugs.koha-community.org If you look at opac-tmpl/bootstrap/js/Gettext.js or its intranet-tmpl equivalent, you'll notice that it's actually a third-party script and not a Koha script, so it should be in the "lib" folder and the license for it should be added to about.tt We've also tidied the file because it wasn't in "lib"... so we might want to undo that. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42577 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |21156 --- Comment #1 from David Cook <dcook@prosentient.com.au> --- It looks like Gettext.js originated from https://github.com/Getty/locale-simple/blob/0.019/share/js/gettext/Gettext.j... Looking at bug 21156 it's not clear to me whether it was this version or a different version used. There is a reference to 0.19 but not sure if that's a typo of 0.019 or something else. It looks like the author rewrote the codebase using Claude so Gettext.js as a downloadable file doesn't exist anymore. Interesting use of AI... Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21156 [Bug 21156] Internationalization: plural forms, context, and more for JS files -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42577 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@openfifth.c | |o.uk --- Comment #2 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- (In reply to David Cook from comment #1)
It looks like Gettext.js originated from https://github.com/Getty/locale-simple/blob/0.019/share/js/gettext/Gettext.j...
Looking at bug 21156 it's not clear to me whether it was this version or a different version used. There is a reference to 0.19 but not sure if that's a typo of 0.019 or something else.
It looks like the author rewrote the codebase using Claude so Gettext.js as a downloadable file doesn't exist anymore.
Interesting use of AI...
Confused.. what codebase, what author, where? I still think it sounds worthwhile moving our copy of the file to /lib and referencing it in about right? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42577 --- Comment #3 from David Cook <dcook@prosentient.com.au> --- (In reply to Martin Renvoize (ashimema) from comment #2)
(In reply to David Cook from comment #1)
It looks like Gettext.js originated from https://github.com/Getty/locale-simple/blob/0.019/share/js/gettext/Gettext.j...
Looking at bug 21156 it's not clear to me whether it was this version or a different version used. There is a reference to 0.19 but not sure if that's a typo of 0.019 or something else.
It looks like the author rewrote the codebase using Claude so Gettext.js as a downloadable file doesn't exist anymore.
Interesting use of AI...
Confused.. what codebase, what author, where?
I still think it sounds worthwhile moving our copy of the file to /lib and referencing it in about right?
So Torsten Raudssus (Getty on Github) authored the code that is in the Gettext.js file in the OPAC and Staff Interface. I think this is the version that Koha currently has: https://github.com/Getty/locale-simple/blob/0.019/share/js/gettext/Gettext.j... That author rewrote the whole "locale-simple" code base, which is where Gettext.js came from, using Claude and now the functionality is available via the "locale-simple" package on NPM. Based on the README, it does seem like there's a UMD bundle "locale-simple.umd.js" that we could use in lieu of Gettext.js. I'm assuming there are breaking changes, but that might fit our dev model better at this point. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42577 --- Comment #4 from David Cook <dcook@prosentient.com.au> --- (In reply to Martin Renvoize (ashimema) from comment #2)
I still think it sounds worthwhile moving our copy of the file to /lib and referencing it in about right?
In any case, yeah worth moving into "/lib" and referencing it in about.pl. We'll need to make some changes in the future probably, but for now it's enough to just move it (and possibly re-download it to the untidied version). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42577 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|oleonard@myacpl.org |koha-bugs@lists.koha-commun | |ity.org -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42577 Frédéric Demians <f.demians@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |43843 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43843 [Bug 43843] OPAC JavaScript translations break when the Content-Security-Policy is enabled -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42577 Frédéric Demians <f.demians@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |f.demians@tamil.fr --- Comment #5 from Frédéric Demians <f.demians@tamil.fr> --- Another reason to replace Gettext.js rather than just move it: it builds the plural function of the Plural-Forms header with "new Function", which the Content-Security-Policy blocks when it doesn't allow 'unsafe-eval'. With the CSP enabled, every translated OPAC is broken: Koha.i18n is never defined and every __() call throws (bug 43843). I'd suggest replacing it with Tannin: https://github.com/aduth/tannin What the change would need: - Add tannin.min.js to the lib folders of the OPAC and the staff interface. - Rewrite i18n.js on top of Tannin. - Change the locale_data.js format: Tannin expects a format different from Gettext. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42577 Frédéric Demians <f.demians@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |In Discussion --- Comment #6 from Frédéric Demians <f.demians@tamil.fr> --- Bug 43843 proposes to replace Gettext.js with Tannin: - tannin.min.js 1.2.0 is added to koha-tmpl/intranet-tmpl/lib/tannin and koha-tmpl/opac-tmpl/lib/tannin, unchanged from unpkg, and to the licenses tab of the About page; - both copies of Gettext.js are removed, and the Gettext.js exceptions are removed from Koha/Devel/Files.pm; - i18n.js uses Tannin, with the same __(), __n(), __p(), __np()... functions, and the same locale_data.js files. So, once bug 43843 is pushed, there is no Gettext.js left to move to "lib" or to untidy, and this bug can be closed. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42577 --- Comment #7 from David Cook <dcook@prosentient.com.au> --- Sounds interesting. I don't know heaps about Gettext. I know that Gettext.js has been re-written, but I think it's function names have all changed anyway, so we could change to Tannin. Frédéric could you post about it in the Development channel on Mattermost? I think there will be people much more knowledgeable than me with things to say about it -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42577 Frédéric Demians <f.demians@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|43843 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43843 [Bug 43843] OPAC JavaScript translations break when the Content-Security-Policy is enabled -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org