Bug 24662 - Remove global variables MSG_* from datatables.inc
Summary: Remove global variables MSG_* from datatables.inc
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: I18N/L10N (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Julian Maurice
QA Contact: Testopia
URL:
Keywords:
Depends on: 24661 24664
Blocks:
  Show dependency treegraph
 
Reported: 2020-02-14 10:00 UTC by Julian Maurice
Modified: 2020-11-30 21:48 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
Version(s) released in:
20.05.00


Attachments
Bug 24662: Remove global variables MSG_* from datatables.inc (13.39 KB, patch)
2020-02-14 10:00 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 24662: Remove global variables MSG_* from datatables.inc (13.81 KB, patch)
2020-03-04 18:42 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 24662: Remove global variables MSG_* from datatables.inc (13.52 KB, patch)
2020-03-11 10:31 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Julian Maurice 2020-02-14 10:00:09 UTC
Now that bug 21156 is pushed, we don't need to have global variables in .inc or .tt files for translation in .js file. We can simply declare our translatable strings where they are used.
Comment 1 Julian Maurice 2020-02-14 10:00:37 UTC
Created attachment 98921 [details] [review]
Bug 24662: Remove global variables MSG_* from datatables.inc

Now that bug 21156 is pushed, we don't need to have global variables in
.inc or .tt files for translation in .js file. We can simply declare our
translatable strings where they are used.

This patch removes all global variables used in DataTables configuration

Test plan:
1. cd misc/translator && ./translate update fr-FR
2. Translate strings in misc/tranlator/po/fr-FR-messages-js.po
3. cd misc/translator && ./translate install fr-FR
4. Go to the staff interface, in english, and check that DataTables
tables are still working. You should check at least the following pages:
    - catalogue/detail.pl
    - circ/circulation.pl
    - tools/quotes.pl
    - tools/letter.pl
5. Switch to french and check again DataTables tables, and verify that
   strings are translated

This patch depends on bug 24661
Comment 2 Bernardo Gonzalez Kriegel 2020-02-14 12:58:41 UTC
Hi,
two comments:
a) You need to create fr-FR-messages-js.po first, or update fails.
I'll try to write a Bug to create them all

b) There are problems with qa-tools
 FAIL   koha-tmpl/intranet-tmpl/prog/js/checkouts.js
   OK     git manipulation
   FAIL   untranslatable_strings
                Untranslatable string found (Loading... you may continue scanning.) - See coding guideline JS5

 FAIL   koha-tmpl/intranet-tmpl/prog/js/datatables.js
   OK     git manipulation
   FAIL   untranslatable_strings
                Untranslatable string found (First) - See coding guideline JS5
                Untranslatable string found (Last) - See coding guideline JS5
                Untranslatable string found (Next) - See coding guideline JS5
                Untranslatable string found (Previous) - See coding guideline JS5
                Untranslatable string found (No data available in table) - See coding guideline JS5
                Untranslatable string found (Showing _START_ to _END_ of _TOTAL_ entries) - See coding guideline JS5
                Untranslatable string found (No entries to show) - See coding guideline JS5
                Untranslatable string found ((filtered from _MAX_ total entries)) - See coding guideline JS5
                Untranslatable string found (Show _MENU_ entries) - See coding guideline JS5
                Untranslatable string found (Loading...) - See coding guideline JS5
                Untranslatable string found (Processing...) - See coding guideline JS5
                Untranslatable string found (Search:) - See coding guideline JS5
                Untranslatable string found (No matching records found) - See coding guideline JS5
                Untranslatable string found (Copy to clipboard) - See coding guideline JS5
                Untranslatable string found (Press <i>ctrl</i> or <i>⌘</i> + <i>C</i> to copy the table data<br>to your system clipboard.<br><br>To cancel, click this message or press escape.) - See coding guideline JS5
                Untranslatable string found (Copied %d rows to clipboard) - See coding guideline JS5
                Untranslatable string found (Copied one row to clipboard) - See coding guideline JS5
                Untranslatable string found (Clear filter) - See coding guideline JS5
                Untranslatable string found (Clear filter) - See coding guideline JS5
                Untranslatable string found (All) - See coding guideline JS5
                Untranslatable string found (a an the) - See coding guideline JS5

False positives perhaps.
Comment 3 Bernardo Gonzalez Kriegel 2020-02-14 14:44:27 UTC
See Bug 24664 for missing *-messages-js.po
Comment 4 Martin Renvoize 2020-03-04 17:15:29 UTC
QA script fixes awaiting merge, but we wanted to get the rmaints to pull in the translation js bug first.
Comment 5 Bernardo Gonzalez Kriegel 2020-03-04 18:42:42 UTC
Created attachment 100147 [details] [review]
Bug 24662: Remove global variables MSG_* from datatables.inc

Now that bug 21156 is pushed, we don't need to have global variables in
.inc or .tt files for translation in .js file. We can simply declare our
translatable strings where they are used.

This patch removes all global variables used in DataTables configuration

Test plan:
1. cd misc/translator && ./translate update fr-FR
2. Translate strings in misc/tranlator/po/fr-FR-messages-js.po
3. cd misc/translator && ./translate install fr-FR
4. Go to the staff interface, in english, and check that DataTables
tables are still working. You should check at least the following pages:
    - catalogue/detail.pl
    - circ/circulation.pl
    - tools/quotes.pl
    - tools/letter.pl
5. Switch to french and check again DataTables tables, and verify that
   strings are translated

This patch depends on bug 24661

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Tested using es-ES or de-DE (build compendium, update, translate, install)
cd misc/translator
msgcat --use-first -o de.po po/de-DE-*.po
./translate update de-DE
msgmerge de.po po/de-DE-messages-js.po -o - | msgattrib --no-obsolete -o po/de-DE-messages-js.po
./translate install de-DE

DataTables works, and are translated.
There are some messages from qa-tools.
Comment 6 Bernardo Gonzalez Kriegel 2020-03-04 18:43:36 UTC
(In reply to Martin Renvoize from comment #4)
> QA script fixes awaiting merge, but we wanted to get the rmaints to pull in
> the translation js bug first.

Ok!
It works, so I signed.
Comment 7 Martin Renvoize 2020-03-11 10:31:42 UTC
Created attachment 100525 [details] [review]
Bug 24662: Remove global variables MSG_* from datatables.inc

Now that bug 21156 is pushed, we don't need to have global variables in
.inc or .tt files for translation in .js file. We can simply declare our
translatable strings where they are used.

This patch removes all global variables used in DataTables configuration

Test plan:
1. cd misc/translator && ./translate update fr-FR
2. Translate strings in misc/tranlator/po/fr-FR-messages-js.po
3. cd misc/translator && ./translate install fr-FR
4. Go to the staff interface, in english, and check that DataTables
tables are still working. You should check at least the following pages:
    - catalogue/detail.pl
    - circ/circulation.pl
    - tools/quotes.pl
    - tools/letter.pl
5. Switch to french and check again DataTables tables, and verify that
   strings are translated

This patch depends on bug 24661

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 8 Martin Renvoize 2020-03-11 10:31:59 UTC
A nice clarification of the code here.. PQA
Comment 9 Martin Renvoize 2020-03-11 13:49:51 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 10 Joy Nelson 2020-04-03 17:20:54 UTC
QA errors when applying to 19.11.x   Are these necessary to correct before pushing to 19.11.x branch?

 

 FAIL   koha-tmpl/intranet-tmpl/prog/js/checkouts.js
   OK     git manipulation
   FAIL   untranslatable_strings
                Untranslatable string found (Loading... you may continue scanning.) - See coding guideline JS5

 FAIL   koha-tmpl/intranet-tmpl/prog/js/datatables.js
   OK     git manipulation
   FAIL   untranslatable_strings
                Untranslatable string found (First) - See coding guideline JS5
                Untranslatable string found (Last) - See coding guideline JS5
                Untranslatable string found (Next) - See coding guideline JS5
                Untranslatable string found (Previous) - See coding guideline JS5
                Untranslatable string found (No data available in table) - See coding guideline JS5
                Untranslatable string found (Showing _START_ to _END_ of _TOTAL_ entries) - See coding guideline JS5
                Untranslatable string found (No entries to show) - See coding guideline JS5
                Untranslatable string found ((filtered from _MAX_ total entries)) - See coding guideline JS5
                Untranslatable string found (Show _MENU_ entries) - See coding guideline JS5
                Untranslatable string found (Loading...) - See coding guideline JS5
                Untranslatable string found (Processing...) - See coding guideline JS5
                Untranslatable string found (Search:) - See coding guideline JS5
                Untranslatable string found (No matching records found) - See coding guideline JS5
                Untranslatable string found (Copy to clipboard) - See coding guideline JS5
                Untranslatable string found (Press <i>ctrl</i> or <i>⌘</i> + <i>C</i> to copy the table data<br>to your system clipboard.<br><br>To cancel, click this message or press escape.) - See coding guideline JS5
                Untranslatable string found (Copied %d rows to clipboard) - See coding guideline JS5
                Untranslatable string found (Copied one row to clipboard) - See coding guideline JS5
                Untranslatable string found (Clear filter) - See coding guideline JS5
                Untranslatable string found (Clear filter) - See coding guideline JS5
                Untranslatable string found (All) - See coding guideline JS5
                Untranslatable string found (a an the) - See coding guideline JS5

 FAIL   koha-tmpl/intranet-tmpl/prog/js/letter.js
   OK     git manipulation
   FAIL   untranslatable_strings
                Untranslatable string found (Loading...) - See coding guideline JS5

 FAIL   koha-tmpl/intranet-tmpl/prog/js/table_filters.js
   OK     git manipulation
   FAIL   untranslatable_strings
                Untranslatable string found (Deactivate filters) - See coding guideline JS5
                Untranslatable string found (Activate filters) - See coding guideline JS5