Bug 22080

Summary: Easier translation of ElasticSearch mappings page
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: TemplatesAssignee: Fridolin Somers <fridolin.somers>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: trivial    
Priority: P5 - low CC: f.demians, julian.maurice, lucas, martin.renvoize, nick
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 15395    
Bug Blocks:    
Attachments: Bug 22080 - Easier translation of ElasticSearch mappings page
Bug 22080: [DO NOT PUSH] test code
Bug 22080: Easier translation of ElasticSearch mappings page
Bug 22080: Easier translation of ElasticSearch mappings page
Bug 22080: [DO NOT PUSH] test code
Bug 22080: [DO NOT PUSH] test code
Bug 22080: Easier translation of ElasticSearch mappings page
Bug 22080: (QA Follow-up) Add filters

Description Fridolin Somers 2019-01-08 08:51:02 UTC
Actual translation of ElasticSearch mappings page contains a huge block :

%s %s An error occurred when updating mappings (%s). %s An error occurred when deleting the existing mappings. Nothing has been changed! (search field %s with mapping %s.) %s Invalid field weight "%s", must be a positive decimal number. %s An error occurred when updating Elasticsearch index mappings: %s. %s Index "%s" needs to be reindexed %s Index "%s" needs to be recreated %s Mappings updated successfully. %s Mappings have been reset successfully. %s %s %s 

I propose to add <span> to split into several translation blocks.
Comment 1 Fridolin Somers 2019-01-08 08:55:04 UTC
Created attachment 83705 [details] [review]
Bug 22080 - Easier translation of ElasticSearch mappings page

Actual translation of ElasticSearch mappings page contains a huge block with a lot of %s.
It makes translation hard.

This patch adds <span> to split into several translation blocks.

Test plan :
1) Compare page with and without patch, check the only difference is span tags.
2) Check HTML is OK with patch.
3) Update a PO file and see new translation blocks.
Comment 2 Frédéric Demians 2019-01-08 09:34:30 UTC
Isn't it a good place to use new translation mechanism introduced by bug #15395 (thanks Julian)? A sample usage is available on bug #21789.
Comment 3 Julian Maurice 2019-01-08 09:43:27 UTC
(In reply to Frédéric Demians from comment #2)
> Isn't it a good place to use new translation mechanism introduced by bug
> #15395 (thanks Julian)? A sample usage is available on bug #21789.

Absolutely. Fridolin, please look at https://wiki.koha-community.org/wiki/Internationalization,_plural_forms,_context,_and_more_RFC to see how to do it (or ask me directly ;))
Comment 4 Fridolin Somers 2019-01-11 10:07:35 UTC
Comment on attachment 83705 [details] [review]
Bug 22080 - Easier translation of ElasticSearch mappings page

I'm creating a new patch with new translate system.
Comment 5 Fridolin Somers 2019-01-11 13:39:11 UTC
Created attachment 83791 [details] [review]
Bug 22080: [DO NOT PUSH] test code

This code is not generate all messages to template :
koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt
Comment 6 Fridolin Somers 2019-01-11 13:39:25 UTC
Created attachment 83792 [details] [review]
Bug 22080: Easier translation of ElasticSearch mappings page

Actual translation of ElasticSearch mappings page contains a huge block with a lot of %s.
It makes translation hard.

This patch uses new method from Bug 15395 to split into several translation blocks.

Test plan :
1) Apply patch "Bug 22080: [DO NOT PUSH] test code"
2) Apply this patch
3) Enable ElasticSearch in SearchEngine preference
4) Go to Administration > Search engine configuration
5) Check page is OK
6) Update the PO files of a language : perl translate update xx-YY
7) Write translation strings in misc/translator/po/xx-YY-messages.po
8) Install translation : perl translate install xx-YY
9) Check translated page
Comment 7 Fridolin Somers 2019-01-11 13:48:33 UTC
(In reply to Fridolin SOMERS from comment #5)
> Created attachment 83791 [details] [review] [review]
> Bug 22080: [DO NOT PUSH] test code
> 
> This code is not generate all messages to template :
> koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/
> mappings.tt

To make the strings easy to see in template, I've added this code to the perl page.
Of course, don't sign it nor push it ;)
Comment 8 Fridolin Somers 2019-01-11 13:49:11 UTC
(In reply to Frédéric Demians from comment #2)
> Isn't it a good place to use new translation mechanism introduced by bug
> #15395 (thanks Julian)? A sample usage is available on bug #21789.

This mechanism is great, thanks a lot Julian and Frédéric :D
Comment 9 Martin Renvoize 2019-02-12 13:36:29 UTC
Created attachment 85012 [details] [review]
Bug 22080: Easier translation of ElasticSearch mappings page

Actual translation of ElasticSearch mappings page contains a huge block with a lot of %s.
It makes translation hard.

This patch uses new method from Bug 15395 to split into several translation blocks.

Test plan :
1) Apply patch "Bug 22080: [DO NOT PUSH] test code"
2) Apply this patch
3) Enable ElasticSearch in SearchEngine preference
4) Go to Administration > Search engine configuration
5) Check page is OK
6) Update the PO files of a language : perl translate update xx-YY
7) Write translation strings in misc/translator/po/xx-YY-messages.po
8) Install translation : perl translate install xx-YY
9) Check translated page

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 10 Martin Renvoize 2019-02-12 13:37:28 UTC
Works well for me.. signing off..

As a side note, I 'think' the qa script may need updating for the new translation stuff.. currently with this patch it yields:

```
 FAIL   koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt
   FAIL   filters
                missing_filter at line 92 (          [% t("Mappings updated successfully.") %])
                missing_filter at line 94 (          [% t("Mappings have been reset successfully.") %])
                missing_filter at line 81 (          [% t("An error occurred when deleting the existing mappings. Nothing has been changed!") %])
```
Comment 11 Kyle M Hall 2019-02-21 12:24:27 UTC
Created attachment 85441 [details] [review]
Bug 22080: [DO NOT PUSH] test code

This code is not generate all messages to template :
koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 12 Kyle M Hall 2019-02-21 12:26:41 UTC
Created attachment 85442 [details] [review]
Bug 22080: [DO NOT PUSH] test code

This code is not generate all messages to template :
koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 13 Kyle M Hall 2019-02-21 12:26:52 UTC
Created attachment 85443 [details] [review]
Bug 22080: Easier translation of ElasticSearch mappings page

Actual translation of ElasticSearch mappings page contains a huge block with a lot of %s.
It makes translation hard.

This patch uses new method from Bug 15395 to split into several translation blocks.

Test plan :
1) Apply patch "Bug 22080: [DO NOT PUSH] test code"
2) Apply this patch
3) Enable ElasticSearch in SearchEngine preference
4) Go to Administration > Search engine configuration
5) Check page is OK
6) Update the PO files of a language : perl translate update xx-YY
7) Write translation strings in misc/translator/po/xx-YY-messages.po
8) Install translation : perl translate install xx-YY
9) Check translated page

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 14 Kyle M Hall 2019-02-21 12:26:55 UTC
Created attachment 85444 [details] [review]
Bug 22080: (QA Follow-up) Add filters

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 15 Nick Clemens 2019-02-22 15:07:08 UTC
Awesome work all!

Pushed to master for 19.05
Comment 16 Martin Renvoize 2019-02-26 09:56:52 UTC
Pushed to 18.11.x for 18.11.04
Comment 17 Lucas Gass 2019-03-08 16:41:51 UTC
skipping this ES patch in 18.05.x, if I am wrong let me know
Comment 18 Fridolin Somers 2019-04-24 07:48:05 UTC
No problem, its just for translation