Bug 26243 - Move translatable strings out of templates and into circulation.js
Summary: Move translatable strings out of templates and into circulation.js
Status: CLOSED 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: 21156
Blocks:
  Show dependency treegraph
 
Reported: 2020-08-18 18:42 UTC by Owen Leonard
Modified: 2021-06-14 21:30 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:
20.11.00, 20.05.05


Attachments
Bug 26243: Move translatable strings out of templates and into circulation.js (6.88 KB, patch)
2020-08-18 20:32 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 26243: Move translatable strings out of templates and into circulation.js (6.93 KB, patch)
2020-09-26 21:25 UTC, David Nind
Details | Diff | Splinter Review
Bug 26243: Move translatable strings out of templates and into circulation.js (6.99 KB, patch)
2020-09-26 22:07 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 26243: (QA follow-up) Switch quotes to avoid translation issues (3.61 KB, patch)
2020-09-26 22:07 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 2020-08-18 18:42:03 UTC
Strings defined for translation in circulation.tt and moremember.tt can now be wrapped in the new translation function and put in js/circulation.js.
Comment 1 Owen Leonard 2020-08-18 20:32:11 UTC
Created attachment 108551 [details] [review]
Bug 26243: Move translatable strings out of templates and into circulation.js

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

To test:

- Apply the patch and check out to a patron.
- If there are none on the account, add a new message using the "Add a
  new message" link.
- Click "Delete" for that message.
- You should get a confirmation message, "Are you sure you want to
  delete this message? This cannot be undone."
- If necessary, enable the ExportCircHistory system preference.
- Check out to a patron who has one or more items checked out.
- Wihtout checking any checkboxes, click the "Export" button at the
  bottom of the page.
- You should get an error message, "You must select checkout(s) to
  export."
- Add a restriction the patron's account.
- Delete the restriction. You should get a confirmation message, "Remove
  restriction?"
- Perform the same tests from the patron detail page.

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/pages/circulation.js for translation,
  e.g.:

  msgid "You must select checkout(s) to export"
  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-26 11:32:40 UTC
Hi Owen.

There doesn't appear to be an option in misc/translator/po/fr-FR-messages-js.po to add a translation for the message "Are you sure you want to delete this message? This cannot be undone."

There are only options to translate:
- Remove restriction?
- You must select checkout(s) to export

Everything else as per the test plan works.

David
Comment 3 Owen Leonard 2020-09-26 20:06:28 UTC
(In reply to David Nind from comment #2)
> There doesn't appear to be an option in
> misc/translator/po/fr-FR-messages-js.po to add a translation for the message
> "Are you sure you want to delete this message? This cannot be undone."

Sorry to have been unclear: This particular string is in the regular template rather than in JavaScript, so it will be picked up by the regular translation process, appearing in fr-FR-staff-prog.po.
Comment 4 David Nind 2020-09-26 20:36:50 UTC
> Sorry to have been unclear: This particular string is in the regular
> template rather than in JavaScript, so it will be picked up by the regular
> translation process, appearing in fr-FR-staff-prog.po.

Thanks Owen! Another sign off on the way...
Comment 5 David Nind 2020-09-26 21:25:11 UTC
Created attachment 110799 [details] [review]
Bug 26243: Move translatable strings out of templates and into circulation.js

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

To test:

- Apply the patch and check out to a patron.
- If there are none on the account, add a new message using the "Add a
  new message" link.
- Click "Delete" for that message.
- You should get a confirmation message, "Are you sure you want to
  delete this message? This cannot be undone."
- If necessary, enable the ExportCircHistory system preference.
- Check out to a patron who has one or more items checked out.
- Wihtout checking any checkboxes, click the "Export" button at the
  bottom of the page.
- You should get an error message, "You must select checkout(s) to
  export."
- Add a restriction the patron's account.
- Delete the restriction. You should get a confirmation message, "Remove
  restriction?"
- Perform the same tests from the patron detail page.

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/pages/circulation.js for translation,
  e.g.:

  msgid "You must select checkout(s) to export"
  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: David Nind <david@davidnind.com>
Comment 6 Katrin Fischer 2020-09-26 22:07:41 UTC
Created attachment 110807 [details] [review]
Bug 26243: Move translatable strings out of templates and into circulation.js

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

To test:

- Apply the patch and check out to a patron.
- If there are none on the account, add a new message using the "Add a
  new message" link.
- Click "Delete" for that message.
- You should get a confirmation message, "Are you sure you want to
  delete this message? This cannot be undone."
- If necessary, enable the ExportCircHistory system preference.
- Check out to a patron who has one or more items checked out.
- Wihtout checking any checkboxes, click the "Export" button at the
  bottom of the page.
- You should get an error message, "You must select checkout(s) to
  export."
- Add a restriction the patron's account.
- Delete the restriction. You should get a confirmation message, "Remove
  restriction?"
- Perform the same tests from the patron detail page.

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/pages/circulation.js for translation,
  e.g.:

  msgid "You must select checkout(s) to export"
  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: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 7 Katrin Fischer 2020-09-26 22:07:47 UTC
Created attachment 110808 [details] [review]
Bug 26243: (QA follow-up) Switch quotes to avoid translation issues

The QA script warned about text in single quotes which can be
a problem for languages like French that need to be able to use
these quotes in their translations.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Jonathan Druart 2020-09-29 12:31:16 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 9 Lucas Gass 2020-10-20 16:24:03 UTC
backported to 20.05.x for 20.05.05
Comment 10 Aleisha Amohia 2020-10-27 04:26:19 UTC
enhancement, not backported to 19.11.x