Bug 26244 - Move translatable strings out of memberentrygen.tt and into JavaScript
Summary: Move translatable strings out of memberentrygen.tt and into JavaScript
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: I18N/L10N (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Owen Leonard
QA Contact: Kyle M Hall (khall)
URL:
Keywords:
Depends on: 21156 26245 29278
Blocks:
  Show dependency treegraph
 
Reported: 2020-08-18 20:50 UTC by Owen Leonard
Modified: 2022-12-12 21:25 UTC (History)
5 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:
22.05.00
Circulation function:


Attachments
Bug 26243: Move translatable strings out of memberentrygen.tt and into JavaScript (5.69 KB, patch)
2020-08-19 18:09 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 26244: Move translatable strings out of memberentrygen.tt and into JavaScript (6.10 KB, patch)
2021-10-20 11:39 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 26244: Move translatable strings out of memberentrygen.tt and into JavaScript (6.16 KB, patch)
2022-03-10 07:52 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26244: Move translatable strings out of memberentrygen.tt and into JavaScript (6.21 KB, patch)
2022-03-31 18:13 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2020-08-18 20:50:54 UTC
Strings defined for translation in memberentrygen.tt can now be wrapped in the new translation function and put in members.js and messaging-preference-form.js.
Comment 1 Owen Leonard 2020-08-19 18:09:08 UTC
Created attachment 108688 [details] [review]
Bug 26243: Move translatable strings out of memberentrygen.tt and into JavaScript

This patch removes the definition of translatable strings out of
templates and into the corresponding JavaScript file, using the new JS
i81n function.

Note: I was unable to trigger the confirmation message in the
check_form_borrowers function. I think the form is now structured in a
way that it is never triggered, thus a candidate for removal.

To test:

- Apply the patch and go to Patrons.
- Add or edit a patron.
- Select a date of birth at least one month in the past and confirm that
  the patron's age is displayed in the hint below.
- Test multiple variations to confirm that the singular and plural of
  'year' and 'month' display correctly. (e.g. 1 year 9 months, 2 years,
  etc).
- Set some patron messaging preferences for the patron.
- Change the patron category.
- You should get a confirmation: "Change messaging preferences to
  default for this category?"

TESTING TRANSLATABILITY

- Update a translation, e.g. fr-FR:

  > cd misc/translator
  > perl translate update fr-FR

- Open the corresponding .po file for JavaScript strings, e.g.
  misc/translator/po/fr-FR-messages-js.po
- Locate strings pulled from
  koha-tmpl/intranet-tmpl/prog/js/members.js for translation, e.g.:

  msgid "%s years"
  msgstr ""

- Edit the "msgstr" string however you want (it's just for testing).
- Install the updated translation:

  > perl translate install fr-FR

- Switch to your newly translated language in the staff client
  and repeat the test plan above. The translated strings should
  appear.
Comment 2 David Nind 2020-09-27 10:27:44 UTC
Hi Owen.

I'm not sure what I'm doing wrong for this one.

I've tried several times. 

But whatever I try I can't get it to recognise changes for the age/month/year phrases or the message when changing patron category.

David
Comment 3 Owen Leonard 2021-10-20 11:39:16 UTC
Created attachment 126581 [details] [review]
Bug 26244: Move translatable strings out of memberentrygen.tt and into JavaScript

This patch removes the definition of translatable strings out of
templates and into the corresponding JavaScript file, using the new JS
i81n function.

Note: I was unable to trigger the confirmation message in the
check_form_borrowers function. I think the form is now structured in a
way that it is never triggered, thus a candidate for removal.

To test:

- Apply the patch and go to Patrons.
- Add or edit a patron.
- Select a date of birth at least one month in the past and confirm that
  the patron's age is displayed in the hint below.
- Test multiple variations to confirm that the singular and plural of
  'year' and 'month' display correctly. (e.g. 1 year 9 months, 2 years,
  etc).
- Set some patron messaging preferences for the patron.
- Change the patron category.
- You should get a confirmation: "Change messaging preferences to
  default for this category?"

TESTING TRANSLATABILITY

- Update a translation, e.g. fr-FR:

  > cd misc/translator
  > perl translate update fr-FR

- Open the corresponding .po file for JavaScript strings, e.g.
  misc/translator/po/fr-FR-messages-js.po
- Locate strings pulled from
  koha-tmpl/intranet-tmpl/prog/js/members.js for translation, e.g.:

  msgid "%s years"
  msgstr ""

- Edit the "msgstr" string however you want (it's just for testing).
- Install the updated translation:

  > perl translate install fr-FR

- Switch to your newly translated language in the staff client
  and repeat the test plan above. The translated strings should
  appear.
Comment 4 Owen Leonard 2021-10-20 11:53:51 UTC
Please note that a bug in memberentry.pl could prevent complete testing of this patch. If you have switched to fr-FR, for example, and are editing an existing patron record, the "lang" variable will not be correctly set in the template, causing the localization file to be omitted.

One way around this would be to set borrowers.lang in the patron record you are testing to match the language, e.g. 'fr-FR'
Comment 5 Fridolin Somers 2022-03-10 07:52:06 UTC
Created attachment 131540 [details] [review]
Bug 26244: Move translatable strings out of memberentrygen.tt and into JavaScript

This patch removes the definition of translatable strings out of
templates and into the corresponding JavaScript file, using the new JS
i81n function.

Note: I was unable to trigger the confirmation message in the
check_form_borrowers function. I think the form is now structured in a
way that it is never triggered, thus a candidate for removal.

To test:

- Apply the patch and go to Patrons.
- Add or edit a patron.
- Select a date of birth at least one month in the past and confirm that
  the patron's age is displayed in the hint below.
- Test multiple variations to confirm that the singular and plural of
  'year' and 'month' display correctly. (e.g. 1 year 9 months, 2 years,
  etc).
- Set some patron messaging preferences for the patron.
- Change the patron category.
- You should get a confirmation: "Change messaging preferences to
  default for this category?"

TESTING TRANSLATABILITY

- Update a translation, e.g. fr-FR:

  > cd misc/translator
  > perl translate update fr-FR

- Open the corresponding .po file for JavaScript strings, e.g.
  misc/translator/po/fr-FR-messages-js.po
- Locate strings pulled from
  koha-tmpl/intranet-tmpl/prog/js/members.js for translation, e.g.:

  msgid "%s years"
  msgstr ""

- Edit the "msgstr" string however you want (it's just for testing).
- Install the updated translation:

  > perl translate install fr-FR

- Switch to your newly translated language in the staff client
  and repeat the test plan above. The translated strings should
  appear.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Comment 6 Fridolin Somers 2022-03-10 07:52:55 UTC
I've checked that each text is well moved and appears in PO files after translation update.
Comment 7 Kyle M Hall (khall) 2022-03-31 18:13:01 UTC
Created attachment 132806 [details] [review]
Bug 26244: Move translatable strings out of memberentrygen.tt and into JavaScript

This patch removes the definition of translatable strings out of
templates and into the corresponding JavaScript file, using the new JS
i81n function.

Note: I was unable to trigger the confirmation message in the
check_form_borrowers function. I think the form is now structured in a
way that it is never triggered, thus a candidate for removal.

To test:

- Apply the patch and go to Patrons.
- Add or edit a patron.
- Select a date of birth at least one month in the past and confirm that
  the patron's age is displayed in the hint below.
- Test multiple variations to confirm that the singular and plural of
  'year' and 'month' display correctly. (e.g. 1 year 9 months, 2 years,
  etc).
- Set some patron messaging preferences for the patron.
- Change the patron category.
- You should get a confirmation: "Change messaging preferences to
  default for this category?"

TESTING TRANSLATABILITY

- Update a translation, e.g. fr-FR:

  > cd misc/translator
  > perl translate update fr-FR

- Open the corresponding .po file for JavaScript strings, e.g.
  misc/translator/po/fr-FR-messages-js.po
- Locate strings pulled from
  koha-tmpl/intranet-tmpl/prog/js/members.js for translation, e.g.:

  msgid "%s years"
  msgstr ""

- Edit the "msgstr" string however you want (it's just for testing).
- Install the updated translation:

  > perl translate install fr-FR

- Switch to your newly translated language in the staff client
  and repeat the test plan above. The translated strings should
  appear.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 8 Fridolin Somers 2022-04-12 09:41:07 UTC
Pushed to master for 22.05, thanks to everybody involved ﷐[U+1F984]﷑