Bug 26257 - Move translatable strings out of subscription-add.tt and into subscription-add.js
Summary: Move translatable strings out of subscription-add.tt and into subscription-ad...
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-19 18:46 UTC by Owen Leonard
Modified: 2022-12-12 21:24 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This enhancement moves the definition of translatable strings for serial subscriptions (subscription-add.tt) out of templates and into the corresponding JavaScript file, using the new JS i81n function.
Version(s) released in:
22.05.00


Attachments
Bug 26257: Move translatable strings out of subscription-add.tt and into subscription-add.js (14.09 KB, patch)
2021-10-21 18:04 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 26257: Move translatable strings out of subscription-add.tt and into subscription-add.js (14.14 KB, patch)
2021-11-28 18:20 UTC, David Nind
Details | Diff | Splinter Review
Bug 26257 - Screenshot - Formatting of test prediction pattern error message (16.23 KB, image/png)
2021-11-28 18:31 UTC, David Nind
Details
Bug 26257: Move translatable strings out of subscription-add.tt and into subscription-add.js (14.19 KB, patch)
2022-01-31 22:24 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-19 18:46:05 UTC
Strings defined for translation in subscription-add.tt can now be wrapped in the new translation function and put in subscription-add.js.
Comment 1 Owen Leonard 2021-10-21 18:04:42 UTC
Created attachment 126675 [details] [review]
Bug 26257: Move translatable strings out of subscription-add.tt and into subscription-add.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 go to Serials -> New subscription
- Click "Next" without filling out any fields. You should get two
  confirmations, "If you wish to claim late or missing issues you must
  link this subscription to a vendor. Click OK to ignore or Cancel to
  return and enter a vendor" and "You must choose or create a
  bibliographic record."
- Manually enter a vendor number which doesn't exist and click "Next."
  Error: "The vendor does not exist."
- Manually enter a record number which doesn't exist and click "Next."
  Error: "Bibliographic record does not exist!"
- Select a valid vendor and bibliographic record and proceed to the next
  page.
- Click "Test prediction pattern" without filling in any fields. Error:
  "Cannot test prediction pattern for the following reason(s): Frequency
  is not defined. - First publication date is not defined"
- Click "Save subscription" without filling in any information. Error:
  "You must choose a first publication date."
- Fill in a date and click "Save subscription." Error: "You must choose
  a subscription length or an end date."
- Enter a frequency and subscription start date and click "Save
  subscription." Error: "Please click on 'Test prediction pattern'
  before saving subscription."
- Click "Show advanced pattern" and then "Save subscription." Error:
  "You have modified the advanced prediction pattern. Please save your
  work or cancel modifications."

Testing numbering patterns:

- There are several strings related to setting and editing numbering
  patterns but I don't think they can be tested live while Bug 28012 is
  unfixed.

Testing Mana integration:

- To test Mana integration you must have Mana enabled, and a
  bibliographic record in your catalog which has an ISSN
  matching a record in Mana. You can go to "Search on Mana"
  from the Serials sidebar menu to locate a working record.
- Add a subscription using the bibliographic record which will match a
  record in Mana. When you click "Next" you should see a message at the
  top of the page saying, "Searching for subscription in Mana Knowledge
  Base"
- After a moment this message should be replaced with "Subscription
  found on Mana Knowledge Base: Show Mana results"
- Clicking the "Show Mana results" should trigger a modal window with
  the heading "Results from Mana Knowledge Base."

- Test the subscription add process using a bibliographic record which
  doesn't match anything in Mana. The message at the top of the page
  should read, "No subscription found on Mana Knowledge Base"

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

  msgid "Next issue publication date is not defined"
  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 Owen Leonard 2021-10-21 18:09:15 UTC
Sorry this test plan is so long! I tried to describe how to trigger as many of the translatable strings as possible.
Comment 3 David Nind 2021-11-28 18:20:56 UTC
Created attachment 128058 [details] [review]
Bug 26257: Move translatable strings out of subscription-add.tt and into subscription-add.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 go to Serials -> New subscription
- Click "Next" without filling out any fields. You should get two
  confirmations, "If you wish to claim late or missing issues you must
  link this subscription to a vendor. Click OK to ignore or Cancel to
  return and enter a vendor" and "You must choose or create a
  bibliographic record."
- Manually enter a vendor number which doesn't exist and click "Next."
  Error: "The vendor does not exist."
- Manually enter a record number which doesn't exist and click "Next."
  Error: "Bibliographic record does not exist!"
- Select a valid vendor and bibliographic record and proceed to the next
  page.
- Click "Test prediction pattern" without filling in any fields. Error:
  "Cannot test prediction pattern for the following reason(s): Frequency
  is not defined. - First publication date is not defined"
- Click "Save subscription" without filling in any information. Error:
  "You must choose a first publication date."
- Fill in a date and click "Save subscription." Error: "You must choose
  a subscription length or an end date."
- Enter a frequency and subscription start date and click "Save
  subscription." Error: "Please click on 'Test prediction pattern'
  before saving subscription."
- Click "Show advanced pattern" and then "Save subscription." Error:
  "You have modified the advanced prediction pattern. Please save your
  work or cancel modifications."

Testing numbering patterns:

- There are several strings related to setting and editing numbering
  patterns but I don't think they can be tested live while Bug 28012 is
  unfixed.

Testing Mana integration:

- To test Mana integration you must have Mana enabled, and a
  bibliographic record in your catalog which has an ISSN
  matching a record in Mana. You can go to "Search on Mana"
  from the Serials sidebar menu to locate a working record.
- Add a subscription using the bibliographic record which will match a
  record in Mana. When you click "Next" you should see a message at the
  top of the page saying, "Searching for subscription in Mana Knowledge
  Base"
- After a moment this message should be replaced with "Subscription
  found on Mana Knowledge Base: Show Mana results"
- Clicking the "Show Mana results" should trigger a modal window with
  the heading "Results from Mana Knowledge Base."

- Test the subscription add process using a bibliographic record which
  doesn't match anything in Mana. The message at the top of the page
  should read, "No subscription found on Mana Knowledge Base"

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

  msgid "Next issue publication date is not defined"
  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 4 David Nind 2021-11-28 18:21:34 UTC
(In reply to Owen Leonard from comment #2)
> Sorry this test plan is so long! I tried to describe how to trigger as many
> of the translatable strings as possible.

I like long test plans! 8-)
Comment 5 David Nind 2021-11-28 18:31:38 UTC
Created attachment 128059 [details]
Bug 26257 - Screenshot - Formatting of test prediction pattern error message

A couple of minor formatting suggestions for the messages.

Full stops at the end of these sentences - some have, some don't - I am not sure of the correct rule for these:
- The vendor does not exist
- You must choose a first publication date

Formatting of test prediction pattern error message (see screenshot from Firefox):
- No carriage return before the first reason
- No space between the - and the first letter for the second error
==> should ideally appear as:
Cannot test prediction pattern for the following reason(s):
- Frequency is not defined. 
- First publication date is not defined.
Comment 6 Katrin Fischer 2022-01-31 22:24:08 UTC
Created attachment 130026 [details] [review]
Bug 26257: Move translatable strings out of subscription-add.tt and into subscription-add.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 go to Serials -> New subscription
- Click "Next" without filling out any fields. You should get two
  confirmations, "If you wish to claim late or missing issues you must
  link this subscription to a vendor. Click OK to ignore or Cancel to
  return and enter a vendor" and "You must choose or create a
  bibliographic record."
- Manually enter a vendor number which doesn't exist and click "Next."
  Error: "The vendor does not exist."
- Manually enter a record number which doesn't exist and click "Next."
  Error: "Bibliographic record does not exist!"
- Select a valid vendor and bibliographic record and proceed to the next
  page.
- Click "Test prediction pattern" without filling in any fields. Error:
  "Cannot test prediction pattern for the following reason(s): Frequency
  is not defined. - First publication date is not defined"
- Click "Save subscription" without filling in any information. Error:
  "You must choose a first publication date."
- Fill in a date and click "Save subscription." Error: "You must choose
  a subscription length or an end date."
- Enter a frequency and subscription start date and click "Save
  subscription." Error: "Please click on 'Test prediction pattern'
  before saving subscription."
- Click "Show advanced pattern" and then "Save subscription." Error:
  "You have modified the advanced prediction pattern. Please save your
  work or cancel modifications."

Testing numbering patterns:

- There are several strings related to setting and editing numbering
  patterns but I don't think they can be tested live while Bug 28012 is
  unfixed.

Testing Mana integration:

- To test Mana integration you must have Mana enabled, and a
  bibliographic record in your catalog which has an ISSN
  matching a record in Mana. You can go to "Search on Mana"
  from the Serials sidebar menu to locate a working record.
- Add a subscription using the bibliographic record which will match a
  record in Mana. When you click "Next" you should see a message at the
  top of the page saying, "Searching for subscription in Mana Knowledge
  Base"
- After a moment this message should be replaced with "Subscription
  found on Mana Knowledge Base: Show Mana results"
- Clicking the "Show Mana results" should trigger a modal window with
  the heading "Results from Mana Knowledge Base."

- Test the subscription add process using a bibliographic record which
  doesn't match anything in Mana. The message at the top of the page
  should read, "No subscription found on Mana Knowledge Base"

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

  msgid "Next issue publication date is not defined"
  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 Fridolin Somers 2022-02-15 07:42:10 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄