Bug 35091 - Improve translation of usage statistics country list
Summary: Improve translation of usage statistics country list
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: I18N/L10N (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 35097
  Show dependency treegraph
 
Reported: 2023-10-18 14:17 UTC by Owen Leonard
Modified: 2023-11-10 01:46 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00


Attachments
Bug 35091: Improve translation of usage statistics country list (12.01 KB, patch)
2023-10-18 15:11 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 35091: Improve translation of usage statistics country list (12.07 KB, patch)
2023-10-18 22:50 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 35091: Improve translation of usage statistics country list (12.11 KB, patch)
2023-10-21 21:49 UTC, David Nind
Details | Diff | Splinter Review
Bug 35091: Improve translation of usage statistics country list (12.17 KB, patch)
2023-11-01 12:23 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2023-10-18 14:17:42 UTC
The usage statistics page uses an include file, country-list.inc, which contains a large list of country names.

When this include file is processed for translation the entire list shows up as one string:

#: koha-tmpl/intranet-tmpl/prog/en/includes/country-list.inc:1
#, c-format
msgid "[%% SET countries = [ \"Afghanistan\", \"Albania\", \"Algeria\", \"Andorra\"...

This file should be reworked so that each country is a separate string in translations.
Comment 1 Owen Leonard 2023-10-18 15:11:12 UTC
Created attachment 157336 [details] [review]
Bug 35091: Improve translation of usage statistics country list

This patch reworks country-list.inc so that each country name can be
wrapped separately in the t() translation function and be processed
individually during the translation process.

To test, apply the patch and update a translation, e.g. fr-FR:
   - perl misc/translator/translate update fr-FR

- Edit the updated po file for the language you chose, e.g.
  misc/translator/po/fr-FR-messages.po, and locate strings from
  country-strings.inc. Each country names should show up as a separate
  string for translation.
- Update the file to fill in translated strings for one or more
  countries. For example:

  koha-tmpl/intranet-tmpl/prog/en/includes/country-list.inc:2
  msgid "Afghanistan"
  msgstr ""

- Install the updated po file:
   - perl misc/translator/translate install fr-FR
- Enable the translation if necessary under Administration -> System
  preferences -> language.
- Go to Administration -> Share usage statistics and check the "Your
  country" dropdown. The list should look correct.
- Switch to your updated translation and confirm that the country names
  you translated show up as expected.
Comment 2 Lucas Gass 2023-10-18 22:50:29 UTC
Created attachment 157362 [details] [review]
Bug 35091: Improve translation of usage statistics country list

This patch reworks country-list.inc so that each country name can be
wrapped separately in the t() translation function and be processed
individually during the translation process.

To test, apply the patch and update a translation, e.g. fr-FR:
   - perl misc/translator/translate update fr-FR

- Edit the updated po file for the language you chose, e.g.
  misc/translator/po/fr-FR-messages.po, and locate strings from
  country-strings.inc. Each country names should show up as a separate
  string for translation.
- Update the file to fill in translated strings for one or more
  countries. For example:

  koha-tmpl/intranet-tmpl/prog/en/includes/country-list.inc:2
  msgid "Afghanistan"
  msgstr ""

- Install the updated po file:
   - perl misc/translator/translate install fr-FR
- Enable the translation if necessary under Administration -> System
  preferences -> language.
- Go to Administration -> Share usage statistics and check the "Your
  country" dropdown. The list should look correct.
- Switch to your updated translation and confirm that the country names
  you translated show up as expected.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 3 David Nind 2023-10-19 06:20:32 UTC
Hi Lucas.

It looks to me like you've signed this off, but the status hasn't been changed 8-)

David
Comment 4 David Nind 2023-10-21 21:49:42 UTC
Created attachment 157598 [details] [review]
Bug 35091: Improve translation of usage statistics country list

This patch reworks country-list.inc so that each country name can be
wrapped separately in the t() translation function and be processed
individually during the translation process.

To test, apply the patch and update a translation, e.g. fr-FR:
   - perl misc/translator/translate update fr-FR

- Edit the updated po file for the language you chose, e.g.
  misc/translator/po/fr-FR-messages.po, and locate strings from
  country-strings.inc. Each country names should show up as a separate
  string for translation.
- Update the file to fill in translated strings for one or more
  countries. For example:

  koha-tmpl/intranet-tmpl/prog/en/includes/country-list.inc:2
  msgid "Afghanistan"
  msgstr ""

- Install the updated po file:
   - perl misc/translator/translate install fr-FR
- Enable the translation if necessary under Administration -> System
  preferences -> language.
- Go to Administration -> Share usage statistics and check the "Your
  country" dropdown. The list should look correct.
- Switch to your updated translation and confirm that the country names
  you translated show up as expected.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: David Nind <david@davidnind.com>
Comment 5 Katrin Fischer 2023-11-01 12:18:37 UTC
This is a good improvement, but got me thinking, because I quite hated translating all these :)

Currently we maintain at least 2 country lists. The other is the authorised value COUNTRY. And both string sets end up in different translation files. 

I am hoping the suggestion feature on Weblate/Pootle will help here now :)
Comment 6 Katrin Fischer 2023-11-01 12:23:29 UTC
Hm, OK - not a problem of this patch, but what we are doing here is a bit strange, we should store country codes, not the names that can change when translated:

Bug 35213 - Standardize country information sent to Hea
Comment 7 Katrin Fischer 2023-11-01 12:23:56 UTC
Created attachment 158175 [details] [review]
Bug 35091: Improve translation of usage statistics country list

This patch reworks country-list.inc so that each country name can be
wrapped separately in the t() translation function and be processed
individually during the translation process.

To test, apply the patch and update a translation, e.g. fr-FR:
   - perl misc/translator/translate update fr-FR

- Edit the updated po file for the language you chose, e.g.
  misc/translator/po/fr-FR-messages.po, and locate strings from
  country-strings.inc. Each country names should show up as a separate
  string for translation.
- Update the file to fill in translated strings for one or more
  countries. For example:

  koha-tmpl/intranet-tmpl/prog/en/includes/country-list.inc:2
  msgid "Afghanistan"
  msgstr ""

- Install the updated po file:
   - perl misc/translator/translate install fr-FR
- Enable the translation if necessary under Administration -> System
  preferences -> language.
- Go to Administration -> Share usage statistics and check the "Your
  country" dropdown. The list should look correct.
- Switch to your updated translation and confirm that the country names
  you translated show up as expected.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Tomás Cohen Arazi 2023-11-01 20:27:00 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 9 Fridolin Somers 2023-11-10 01:46:21 UTC
Enhancement not pushed to 23.05.x