Bug 26395: Move translatable strings out of letter.tt into letter.js
commit8bf7c342bfaf7425f17427f6e82167f26c2311f8
authorOwen Leonard <oleonard@myacpl.org>
Fri, 4 Sep 2020 19:10:50 +0000 (4 19:10 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 29 Sep 2020 12:28:18 +0000 (29 14:28 +0200)
tree3b6d23bc5816a7a488f827e5e3c122d517b3064f
parent2c98f4849ddad3494e936a0b4ea39eca247dd9f2
Bug 26395: Move translatable strings out of letter.tt into letter.js

This patch moves strings defined for translation in letter.tt
into letter.js for translation using the new double-underscore
i81n function.

Note, the "MSG_NO_NOTICE_FOUND" usage has been removed because it didn't
work.

To test, apply the patch and go to Tools -> Notices & Slips.

- Use the "Copy" dropdown to copy an existing notice to a specific
  library.
- Save the copied notice.
- Return to the "All libraries" view on the Notices & Slips page.
- Repeat the same process above: Copy the same notice to the same
  library.
- When you click save on the "Add notice" page you should get an error
  message, "A letter with the code 'ACCTDETAILS' already exists for
  <library>"

- From the "All libraries" view on the Notices & Slips page, copy the
  text in the "Code" column of an existing notice.
- Click "New notice" and choose the module of the notice you copied
  from.
- On the "Add notice" page, paste the code into the "Code" field and
  enter a name in the "Name" field.
- Click "Save" without making any other changes. You should get an error
  message, "Please fill at least one template."
- Enter some data into one of the message body fields but not message
  subject, and click "Save" again.
- You should get an error, "Please specify title and content for
  <notice>"
- Enter data in the message subject field and click "Save" again.
- You should get an error, "A default letter with the code <CODE>
  already exists."

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

  msgid "Please fill at least one template."
  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>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt
koha-tmpl/intranet-tmpl/prog/js/letter.js