Bug 38166: Make core status graph strings translatable

This patch makes several strings translatable. I usually dealth with
this by adding my statuses like `NEW` to the status graph shippped by
the backend I was working with, and solved the translation step inside
of the plugin itself.

But really, the core status graph should be translatable so core
backends (like the to-be FreeForm) and backend authors can rest assured
they only need to care about their custom statuses.

To test:
1. Make sure you have 35570 applied so it is easier to test
2. Enable the ILLModule syspref.
3. Install a language you're familiar with. I pick es-ES for the sake of
   this testing steps to be readable:
   $ ktd --shell
  k$ koha-translate --install es-ES --dev kohadev && restart_all
4. Enable (language sysprefs) and switch to your language (click at the
   left bottom on the language name).
5. Create a new ILL request
=> FAIL: Notice some buttons are not in your language
6. Jump to the ILL requests list
=> FAIL: The status displays as 'New request'
7. Apply this patch
8. Generate the translation entries for the core status graph strings:
  k$ gulp po:extract
  k$ gulp po:update # I had to run it twice to complete, unrelated error
9. Edit the relevant -messages.po file. In my case:
  k$ vim misc/translator/po/es-ES-messages.po
Note: it is easier on VScode which shows you the changed lines in colors
on the scroll bar. The idea is to find the new strings that relate to
Koha::ILL::Request and translate them
10. Translate the strings that relate to this patch (at least 'New
    request' and some of the buttons in the ILL request detail).
11. Install the new translations:
  k$ koha-translate --update es-ES --dev kohadev && restart_all
12. Refresh the ILL requests list
=> SUCCESS: The request status is translated!
13. Manage the ILL request
=> SUCCESS: The buttons you translated, are translated!!
14. Sign off :-D
15. Grant tcohen some cookies next time

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Tomas Cohen Arazi 2024-10-14 11:54:54 -03:00 committed by Katrin Fischer
parent eab94d1213
commit 608a6c2365
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 18 additions and 17 deletions

View File

@ -34,6 +34,7 @@ use Koha::Cache::Memory::Lite;
use Koha::Database;
use Koha::DateUtils qw( dt_from_string );
use Koha::Exceptions::Ill;
use Koha::I18N qw(__);
use Koha::ILL::Backend::Standard;
use Koha::ILL::Batches;
use Koha::ILL::Comments;
@ -580,8 +581,8 @@ sub _core_status_graph {
prev_actions => [ ], # Actions containing buttons
# leading to this status
id => 'NEW', # ID of this status
name => 'New request', # UI name of this status
ui_method_name => 'New request', # UI name of method leading
name => __('New request'), # UI name of this status
ui_method_name => __('New request'), # UI name of method leading
# to this status
method => 'create', # method to this status
next_actions => [ 'REQ', 'GENREQ', 'KILL' ], # buttons to add to all
@ -591,8 +592,8 @@ sub _core_status_graph {
REQ => {
prev_actions => [ 'NEW', 'REQREV', 'QUEUED', 'CANCREQ' ],
id => 'REQ',
name => 'Requested',
ui_method_name => 'Confirm request',
name => __('Requested'),
ui_method_name => __('Confirm request'),
method => 'confirm',
next_actions => [ 'REQREV', 'COMP', 'CHK' ],
ui_method_icon => 'fa-check',
@ -600,8 +601,8 @@ sub _core_status_graph {
GENREQ => {
prev_actions => [ 'NEW', 'REQREV' ],
id => 'GENREQ',
name => 'Requested from partners',
ui_method_name => 'Place request with partners',
name => __('Requested from partners'),
ui_method_name => __('Place request with partners'),
method => 'generic_confirm',
next_actions => [ 'COMP', 'CHK', 'REQREV' ],
ui_method_icon => 'fa-paper-plane',
@ -609,8 +610,8 @@ sub _core_status_graph {
REQREV => {
prev_actions => [ 'REQ', 'GENREQ' ],
id => 'REQREV',
name => 'Request reverted',
ui_method_name => 'Revert request',
name => __('Request reverted'),
ui_method_name => __('Revert request'),
method => 'cancel',
next_actions => [ 'REQ', 'GENREQ', 'KILL' ],
ui_method_icon => 'fa-times',
@ -618,7 +619,7 @@ sub _core_status_graph {
QUEUED => {
prev_actions => [ ],
id => 'QUEUED',
name => 'Queued request',
name => __('Queued request'),
ui_method_name => 0,
method => 0,
next_actions => [ 'REQ', 'KILL' ],
@ -627,7 +628,7 @@ sub _core_status_graph {
CANCREQ => {
prev_actions => [ 'NEW' ],
id => 'CANCREQ',
name => 'Cancellation requested',
name => __('Cancellation requested'),
ui_method_name => 0,
method => 0,
next_actions => [ 'KILL', 'REQ' ],
@ -636,8 +637,8 @@ sub _core_status_graph {
COMP => {
prev_actions => [ 'REQ' ],
id => 'COMP',
name => 'Completed',
ui_method_name => 'Mark completed',
name => __('Completed'),
ui_method_name => __('Mark completed'),
method => 'mark_completed',
next_actions => [ 'CHK' ],
ui_method_icon => 'fa-check',
@ -646,7 +647,7 @@ sub _core_status_graph {
prev_actions => [ 'QUEUED', 'REQREV', 'NEW', 'CANCREQ' ],
id => 'KILL',
name => 0,
ui_method_name => 'Delete request',
ui_method_name => __('Delete request'),
method => 'delete',
next_actions => [ ],
ui_method_icon => 'fa-trash',
@ -654,8 +655,8 @@ sub _core_status_graph {
CHK => {
prev_actions => [ 'REQ', 'GENREQ', 'COMP' ],
id => 'CHK',
name => 'Checked out',
ui_method_name => 'Check out',
name => __('Checked out'),
ui_method_name => __('Check out'),
needs_prefs => [ 'CirculateILL' ],
needs_perms => [ 'user_circulate_circulate_remaining_permissions' ],
# An array of functions that all must return true
@ -667,8 +668,8 @@ sub _core_status_graph {
RET => {
prev_actions => [ 'CHK' ],
id => 'RET',
name => 'Returned to library',
ui_method_name => 'Check in',
name => __('Returned to library'),
ui_method_name => __('Check in'),
method => 'check_in',
next_actions => [ 'COMP' ],
ui_method_icon => 'fa-download',