Bug 17762 - Ability to translate notices
Summary: Ability to translate notices
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Notices (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low new feature (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
: 7224 17160 (view as bug list)
Depends on: 17234 17666
Blocks: 18664 18911 19344 19675 21571
  Show dependency treegraph
 
Reported: 2016-12-12 16:22 UTC by Jonathan Druart
Modified: 2020-09-09 15:47 UTC (History)
9 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
It's now possible to translate notice templates into different languages. There is a new 'preferred language' setting available in the user account, that controls which template will be used when generating notices.
Version(s) released in:


Attachments
Bug 17762: DB changes - Add new 'lang' columns to letter and borrowers tables (3.96 KB, patch)
2016-12-12 17:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: DBIC Schema changes (3.74 KB, patch)
2016-12-12 17:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Add the new TranslateNotices syspref (4.05 KB, patch)
2016-12-12 17:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Add the lang attribute to the patron form (5.34 KB, patch)
2016-12-12 17:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Remove FK on message_transports (2.26 KB, patch)
2016-12-12 17:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Add lang to the PK of letter (2.27 KB, patch)
2016-12-12 17:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Update the letter form interface (15.14 KB, patch)
2016-12-12 17:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Send lang to GetPreparedLetter (14.08 KB, patch)
2016-12-12 17:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Add the lang parameter to C4::Letters::getletter (4.48 KB, patch)
2016-12-12 17:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Fix sql fields insertion (3.26 KB, patch)
2016-12-30 11:05 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: DB changes - Add new 'lang' columns to letter and borrowers tables (4.00 KB, patch)
2017-01-23 18:31 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: DBIC Schema changes (3.78 KB, patch)
2017-01-23 18:31 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Add the new TranslateNotices syspref (4.09 KB, patch)
2017-01-23 18:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Add the lang attribute to the patron form (5.38 KB, patch)
2017-01-23 18:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Remove FK on message_transports (2.30 KB, patch)
2017-01-23 18:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Add lang to the PK of letter (2.31 KB, patch)
2017-01-23 18:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Update the letter form interface (15.18 KB, patch)
2017-01-23 18:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Send lang to GetPreparedLetter (13.78 KB, patch)
2017-01-23 18:33 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Add the lang parameter to C4::Letters::getletter (4.52 KB, patch)
2017-01-23 18:33 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Fix sql fields insertion (3.32 KB, patch)
2017-01-23 18:33 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: DB changes - Add new 'lang' columns to letter and borrowers tables (4.07 KB, patch)
2017-03-24 16:30 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Add the new TranslateNotices syspref (4.09 KB, patch)
2017-03-24 16:30 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Add the lang attribute to the patron form (5.38 KB, patch)
2017-03-24 16:30 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Remove FK on message_transports (2.54 KB, patch)
2017-03-24 16:30 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Add lang to the PK of letter (2.31 KB, patch)
2017-03-24 16:30 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Update the letter form interface (15.18 KB, patch)
2017-03-24 16:30 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Send lang to GetPreparedLetter (13.40 KB, patch)
2017-03-24 16:30 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Add the lang parameter to C4::Letters::getletter (4.52 KB, patch)
2017-03-24 16:30 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Fix sql fields insertion (3.32 KB, patch)
2017-03-24 16:31 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: Fix test for NewsChannels.t (851 bytes, patch)
2017-03-24 16:31 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: DBIC Schema changes (7.24 KB, patch)
2017-03-24 16:31 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17762: DB changes - Add new 'lang' columns to letter and borrowers tables (4.13 KB, patch)
2017-05-05 20:21 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 17762: Add the new TranslateNotices syspref (4.23 KB, patch)
2017-05-05 20:21 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 17762: Add the lang attribute to the patron form (5.42 KB, patch)
2017-05-05 20:21 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 17762: Remove FK on message_transports (2.59 KB, patch)
2017-05-05 20:21 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 17762: Add lang to the PK of letter (2.36 KB, patch)
2017-05-05 20:21 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 17762: Update the letter form interface (15.24 KB, patch)
2017-05-05 20:21 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 17762: Send lang to GetPreparedLetter (13.51 KB, patch)
2017-05-05 20:21 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 17762: Add the lang parameter to C4::Letters::getletter (4.65 KB, patch)
2017-05-05 20:21 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 17762: Fix sql fields insertion (3.38 KB, patch)
2017-05-05 20:22 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 17762: Fix test for NewsChannels.t (907 bytes, patch)
2017-05-05 20:22 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 17762: DBIC Schema changes (7.30 KB, patch)
2017-05-05 20:22 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 17762 (QA Followup) Use default lang if pref disabled (821 bytes, patch)
2017-05-05 20:22 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 17762 (QA Followup) Fix Letters.t - add lang to fixtures (1.04 KB, patch)
2017-05-05 20:22 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2016-12-12 16:22:14 UTC
If a library has students/patrons from different countries, they will all receive the same notices. At the moment they are not translatable.
An improvement would be to let the library translate the notices in different languages.

This bug will get patches to achieve this goal.
Comment 1 Jonathan Druart 2016-12-12 17:02:09 UTC
Created attachment 58133 [details] [review]
Bug 17762: DB changes - Add new 'lang' columns to letter and borrowers tables

Sponsored-by: Orex Digital
Comment 2 Jonathan Druart 2016-12-12 17:02:13 UTC
Created attachment 58134 [details] [review]
Bug 17762: DBIC Schema changes

Sponsored-by: Orex Digital
Comment 3 Jonathan Druart 2016-12-12 17:02:16 UTC
Created attachment 58135 [details] [review]
Bug 17762: Add the new TranslateNotices syspref

This whole patch set adds the ability to translate notices in different
languages.
That way, if a library has patrons from different countries, they will
not have to send the notices in only one language but they will be able to
translate them.

Test plan:
- Switch on TranslateNotices
- Translate the interface in different languages
- Edit patron's details
=> You should see a new "prefered language" entry
That language will be used to send notices to this patron
- Edit several notice templates
=> You should see different tabs, 1 tab per language translated at the
opac (which sounds to make sense)
- Now the notice generated for this patron should be the one translated
in the language picked for him
To confirm that, try to generate several notices for this patron.
If the notice is not translated, the default one should be used.

Sponsored-by: Orex Digital
Comment 4 Jonathan Druart 2016-12-12 17:02:19 UTC
Created attachment 58136 [details] [review]
Bug 17762: Add the lang attribute to the patron form

Not the opac because we do not want the patron to modify it, they won't
be necessary translated.

Sponsored-by: Orex Digital
Comment 5 Jonathan Druart 2016-12-12 17:02:23 UTC
Created attachment 58137 [details] [review]
Bug 17762: Remove FK on message_transports

I don't really understand where does come from this foreign key but at first glance it does not make sense.

Note that it seems we could also remove message_transports.branchcode

Sponsored-by: Orex Digital
Comment 6 Jonathan Druart 2016-12-12 17:02:26 UTC
Created attachment 58138 [details] [review]
Bug 17762: Add lang to the PK of letter

We need to enlarge the PK of the letter table.

Sponsored-by: Orex Digital
Comment 7 Jonathan Druart 2016-12-12 17:02:30 UTC
Created attachment 58139 [details] [review]
Bug 17762: Update the letter form interface

If the pref is on, the notice template will be translatable in different
languages

Sponsored-by: Orex Digital
Comment 8 Jonathan Druart 2016-12-12 17:02:34 UTC
Created attachment 58140 [details] [review]
Bug 17762: Send lang to GetPreparedLetter

This patch set the lang parameter when C4::Letters::GetPreparedLetter is
called to generate the notice.
Note that we do not need to pass it if want_librarian is set.

TODO: I do not know what to do with TransferSlip

Sponsored-by: Orex Digital
Comment 9 Jonathan Druart 2016-12-12 17:02:37 UTC
Created attachment 58141 [details] [review]
Bug 17762: Add the lang parameter to C4::Letters::getletter

Sponsored-by: Orex Digital
Comment 10 Hugo Agud 2016-12-14 14:59:27 UTC
Hi

After applying the patch I get an internal Server error and I can see this log i plack-error.log

DBD::mysql::st execute failed: Unknown column 'me.lang' in 'field list' [for Statement "SELECT `me`.`borrowernumber`, `me`.`cardnumber`, `me`.`surname`, `me`.`firstname`, `me`.`title`, `me`.`othernames`, `me`.`initials`, `me`.`streetnumber`, `me`.`streettype`, `me`.`address`, `me`.`address2`, `me`.`city`, `me`.`state`, `me`.`zipcode`, `me`.`country`, `me`.`email`, `me`.`phone`, `me`.`mobile`, `me`.`fax`, `me`.`emailpro`, `me`.`phonepro`, `me`.`B_streetnumber`, `me`.`B_streettype`, `me`.`B_address`, `me`.`B_address2`, `me`.`B_city`, `me`.`B_state`, `me`.`B_zipcode`, `me`.`B_country`, `me`.`B_email`, `me`.`B_phone`, `me`.`dateofbirth`, `me`.`branchcode`, `me`.`categorycode`, `me`.`dateenrolled`, `me`.`dateexpiry`, `me`.`gonenoaddress`, `me`.`lost`, `me`.`debarred`, `me`.`debarredcomment`, `me`.`contactname`, `me`.`contactfirstname`, `me`.`contacttitle`, `me`.`guarantorid`, `me`.`borrowernotes`, `me`.`relationship`, `me`.`sex`, `me`.`password`, `me`.`flags`, `me`.`userid`, `me`.`opacnote`, `me`.`contactnote`, `me`.`sort1`, `me`.`sort2`, `me`.`altcontactfirstname`, `me`.`altcontactsurname`, `me`.`altcontactaddress1`, `me`.`altcontactaddress2`, `me`.`altcontactaddress3`, `me`.`altcontactstate`, `me`.`altcontactzipcode`, `me`.`altcontactcountry`, `me`.`altcontactphone`, `me`.`smsalertnumber`, `me`.`sms_provider_id`, `me`.`privacy`, `me`.`privacy_guarantor_checkouts`, `me`.`checkprevcheckout`, `me`.`updated_on`, `me`.`lastseen`, `me`.`lang` FROM `borrowers` `me` WHERE ( `userid` = ? )" with ParamValues: 0='Odigital'] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832.
DBIx::Class::Storage::DBI::_dbh_execute(): Unknown column 'me.lang' in 'field list' at /home/vagrant/kohaclone/Koha/Objects.pm line 176
Comment 11 Jonathan Druart 2016-12-14 16:44:49 UTC
(In reply to Hugo Agud from comment #10)
> After applying the patch I get an internal Server error and I can see this
> log i plack-error.log

Hi Hugo,
You need to apply patches from bug 17234 (not the 3.14 patch) and bug 17666.
Then you have to execute the updatedatabase script (`perl installer/data/mysql/updatedatabase.pl`) to update the DB structure.
Then restart plack and everything should go fine.
Comment 12 Hugo Agud 2016-12-30 07:43:21 UTC
I have installed the patch and I have been able to test with PREDUE and ODUE and it almost works fine.

I am able to receive the letter in the prefered language, BUT if I change the prefered language it has no effect on the letter language

I have restarted memcached, plack and the kohadevbox with no effect on the language lettter
Comment 13 Jonathan Druart 2016-12-30 08:35:45 UTC
(In reply to Hugo Agud from comment #12)

Hi Hugo, thanks for testing!

> I am able to receive the letter in the prefered language, BUT if I change
> the prefered language it has no effect on the letter language

Can you detail the different steps you made?
You should not need to restart plack or memcached.
Comment 14 Hugo Agud 2016-12-30 08:44:47 UTC
Thanks to you.. 

I have applied your test plan and then change the language preference for notices and start again

Test plan:
- Switch on TranslateNotices
- Translate the interface in different languages
- Edit patron's details
=> You should see a new "prefered language" entry
That language will be used to send notices to this patron
- Edit several notice templates

- Now the notice generated for this patron should be the one translated
in the language picked for him
To confirm that, try to generate several notices for this patron.
If the notice is not translated, the default one should be used.

Once I finished this with success, I decided to change the 'Preferred language for notices' to ca-ES and I have tested in different ways

1. Execute again the cron scripts for advance and overdue, it generate the letter in the firs language I seleted (es-ES)

2. I checked-in and checked-out again the books, and execute again the cron scripts overudue and advance notice and the letters still in (es-ES) instead of the new (ca-ES)

I have restarted memcached and plack and the server just in case.. 

I hope it helps
Comment 15 Jonathan Druart 2016-12-30 11:05:24 UTC
Created attachment 58525 [details] [review]
Bug 17762: Fix sql fields insertion

The "Insert ->" buttons used to copy the sql field to the textarea was
based on the id of the fieldset.
This id has to be unique to work as expected. It is now composed of mtt
+ lang instead of mtt only
Comment 16 Hugo Agud 2016-12-30 11:42:58 UTC
checked and working fine!

Thanks Jonathan
Comment 17 Josef Moravec 2017-01-20 15:19:20 UTC
Jonathan, could you add followup due to bug 16239? Updated wiki page for reference: https://wiki.koha-community.org/wiki/Interface_patterns

Thanks
Comment 18 Josef Moravec 2017-01-20 15:21:42 UTC
Ah, looks like it probably will need rebase
Comment 19 Jonathan Druart 2017-01-23 18:31:37 UTC
Created attachment 59452 [details] [review]
Bug 17762: DB changes - Add new 'lang' columns to letter and borrowers tables

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>
Comment 20 Jonathan Druart 2017-01-23 18:31:51 UTC
Created attachment 59453 [details] [review]
Bug 17762: DBIC Schema changes

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>
Comment 21 Jonathan Druart 2017-01-23 18:32:04 UTC
Created attachment 59454 [details] [review]
Bug 17762: Add the new TranslateNotices syspref

This whole patch set adds the ability to translate notices in different
languages.
That way, if a library has patrons from different countries, they will
not have to send the notices in only one language but they will be able to
translate them.

Test plan:
- Switch on TranslateNotices
- Translate the interface in different languages
- Edit patron's details
=> You should see a new "prefered language" entry
That language will be used to send notices to this patron
- Edit several notice templates
=> You should see different tabs, 1 tab per language translated at the
opac (which sounds to make sense)
- Now the notice generated for this patron should be the one translated
in the language picked for him
To confirm that, try to generate several notices for this patron.
If the notice is not translated, the default one should be used.

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>
Comment 22 Jonathan Druart 2017-01-23 18:32:17 UTC
Created attachment 59455 [details] [review]
Bug 17762: Add the lang attribute to the patron form

Not the opac because we do not want the patron to modify it, they won't
be necessary translated.

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>
Comment 23 Jonathan Druart 2017-01-23 18:32:30 UTC
Created attachment 59456 [details] [review]
Bug 17762: Remove FK on message_transports

I don't really understand where does come from this foreign key but at first glance it does not make sense.

Note that it seems we could also remove message_transports.branchcode

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>
Comment 24 Jonathan Druart 2017-01-23 18:32:44 UTC
Created attachment 59457 [details] [review]
Bug 17762: Add lang to the PK of letter

We need to enlarge the PK of the letter table.

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>
Comment 25 Jonathan Druart 2017-01-23 18:32:58 UTC
Created attachment 59458 [details] [review]
Bug 17762: Update the letter form interface

If the pref is on, the notice template will be translatable in different
languages

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>
Comment 26 Jonathan Druart 2017-01-23 18:33:12 UTC
Created attachment 59459 [details] [review]
Bug 17762: Send lang to GetPreparedLetter

This patch set the lang parameter when C4::Letters::GetPreparedLetter is
called to generate the notice.
Note that we do not need to pass it if want_librarian is set.

TODO: I do not know what to do with TransferSlip

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>
Comment 27 Jonathan Druart 2017-01-23 18:33:23 UTC
Created attachment 59460 [details] [review]
Bug 17762: Add the lang parameter to C4::Letters::getletter

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>
Comment 28 Jonathan Druart 2017-01-23 18:33:36 UTC
Created attachment 59461 [details] [review]
Bug 17762: Fix sql fields insertion

The "Insert ->" buttons used to copy the sql field to the textarea was
based on the id of the fieldset.
This id has to be unique to work as expected. It is now composed of mtt
+ lang instead of mtt only

Signed-off-by: Hugo Agud <hagud@orex.es>
Comment 29 Tomás Cohen Arazi 2017-02-21 15:23:38 UTC
Jonathan, I like the idea and how it is implemented. My only doubt is about the existence of the 'default' tab. I expected 'default' to be a given language, not a different one than (say) Ensligh.
Comment 30 Jonathan Druart 2017-02-22 08:50:15 UTC
It's default in the sense that it will fallback to this notice if the one we want is not defined.
Comment 31 Jonathan Druart 2017-03-24 16:30:22 UTC
Created attachment 61614 [details] [review]
Bug 17762: DB changes - Add new 'lang' columns to letter and borrowers tables

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>
Comment 32 Jonathan Druart 2017-03-24 16:30:28 UTC
Created attachment 61615 [details] [review]
Bug 17762: Add the new TranslateNotices syspref

This whole patch set adds the ability to translate notices in different
languages.
That way, if a library has patrons from different countries, they will
not have to send the notices in only one language but they will be able to
translate them.

Test plan:
- Switch on TranslateNotices
- Translate the interface in different languages
- Edit patron's details
=> You should see a new "prefered language" entry
That language will be used to send notices to this patron
- Edit several notice templates
=> You should see different tabs, 1 tab per language translated at the
opac (which sounds to make sense)
- Now the notice generated for this patron should be the one translated
in the language picked for him
To confirm that, try to generate several notices for this patron.
If the notice is not translated, the default one should be used.

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>
Comment 33 Jonathan Druart 2017-03-24 16:30:33 UTC
Created attachment 61616 [details] [review]
Bug 17762: Add the lang attribute to the patron form

Not the opac because we do not want the patron to modify it, they won't
be necessary translated.

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>
Comment 34 Jonathan Druart 2017-03-24 16:30:38 UTC
Created attachment 61617 [details] [review]
Bug 17762: Remove FK on message_transports

I don't really understand where does come from this foreign key but at first glance it does not make sense.

Note that it seems we could also remove message_transports.branchcode

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>
Comment 35 Jonathan Druart 2017-03-24 16:30:42 UTC
Created attachment 61618 [details] [review]
Bug 17762: Add lang to the PK of letter

We need to enlarge the PK of the letter table.

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>
Comment 36 Jonathan Druart 2017-03-24 16:30:46 UTC
Created attachment 61619 [details] [review]
Bug 17762: Update the letter form interface

If the pref is on, the notice template will be translatable in different
languages

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>
Comment 37 Jonathan Druart 2017-03-24 16:30:51 UTC
Created attachment 61620 [details] [review]
Bug 17762: Send lang to GetPreparedLetter

This patch set the lang parameter when C4::Letters::GetPreparedLetter is
called to generate the notice.
Note that we do not need to pass it if want_librarian is set.

TODO: I do not know what to do with TransferSlip

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>
Comment 38 Jonathan Druart 2017-03-24 16:30:56 UTC
Created attachment 61621 [details] [review]
Bug 17762: Add the lang parameter to C4::Letters::getletter

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>
Comment 39 Jonathan Druart 2017-03-24 16:31:00 UTC
Created attachment 61622 [details] [review]
Bug 17762: Fix sql fields insertion

The "Insert ->" buttons used to copy the sql field to the textarea was
based on the id of the fieldset.
This id has to be unique to work as expected. It is now composed of mtt
+ lang instead of mtt only

Signed-off-by: Hugo Agud <hagud@orex.es>
Comment 40 Jonathan Druart 2017-03-24 16:31:04 UTC
Created attachment 61623 [details] [review]
Bug 17762: Fix test for NewsChannels.t
Comment 41 Jonathan Druart 2017-03-24 16:31:09 UTC
Created attachment 61624 [details] [review]
Bug 17762: DBIC Schema changes
Comment 42 Jonathan Druart 2017-03-24 16:31:29 UTC
Rebased and fixed a test.
Comment 43 Nick Clemens 2017-05-05 20:21:28 UTC
Created attachment 63199 [details] [review]
Bug 17762: DB changes - Add new 'lang' columns to letter and borrowers tables

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 44 Nick Clemens 2017-05-05 20:21:33 UTC
Created attachment 63200 [details] [review]
Bug 17762: Add the new TranslateNotices syspref

This whole patch set adds the ability to translate notices in different
languages.
That way, if a library has patrons from different countries, they will
not have to send the notices in only one language but they will be able to
translate them.

Test plan:
- Switch on TranslateNotices
- Translate the interface in different languages
- Edit patron's details
=> You should see a new "prefered language" entry
That language will be used to send notices to this patron
- Edit several notice templates
=> You should see different tabs, 1 tab per language translated at the
opac (which sounds to make sense)
- Now the notice generated for this patron should be the one translated
in the language picked for him
To confirm that, try to generate several notices for this patron.
If the notice is not translated, the default one should be used.

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 45 Nick Clemens 2017-05-05 20:21:36 UTC
Created attachment 63201 [details] [review]
Bug 17762: Add the lang attribute to the patron form

Not the opac because we do not want the patron to modify it, they won't
be necessary translated.

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 46 Nick Clemens 2017-05-05 20:21:40 UTC
Created attachment 63202 [details] [review]
Bug 17762: Remove FK on message_transports

I don't really understand where does come from this foreign key but at first glance it does not make sense.

Note that it seems we could also remove message_transports.branchcode

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 47 Nick Clemens 2017-05-05 20:21:44 UTC
Created attachment 63203 [details] [review]
Bug 17762: Add lang to the PK of letter

We need to enlarge the PK of the letter table.

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 48 Nick Clemens 2017-05-05 20:21:48 UTC
Created attachment 63204 [details] [review]
Bug 17762: Update the letter form interface

If the pref is on, the notice template will be translatable in different
languages

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 49 Nick Clemens 2017-05-05 20:21:55 UTC
Created attachment 63205 [details] [review]
Bug 17762: Send lang to GetPreparedLetter

This patch set the lang parameter when C4::Letters::GetPreparedLetter is
called to generate the notice.
Note that we do not need to pass it if want_librarian is set.

TODO: I do not know what to do with TransferSlip

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 50 Nick Clemens 2017-05-05 20:21:59 UTC
Created attachment 63206 [details] [review]
Bug 17762: Add the lang parameter to C4::Letters::getletter

Sponsored-by: Orex Digital

Signed-off-by: Hugo Agud <hagud@orex.es>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 51 Nick Clemens 2017-05-05 20:22:03 UTC
Created attachment 63207 [details] [review]
Bug 17762: Fix sql fields insertion

The "Insert ->" buttons used to copy the sql field to the textarea was
based on the id of the fieldset.
This id has to be unique to work as expected. It is now composed of mtt
+ lang instead of mtt only

Signed-off-by: Hugo Agud <hagud@orex.es>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 52 Nick Clemens 2017-05-05 20:22:11 UTC
Created attachment 63208 [details] [review]
Bug 17762: Fix test for NewsChannels.t

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 53 Nick Clemens 2017-05-05 20:22:15 UTC
Created attachment 63209 [details] [review]
Bug 17762: DBIC Schema changes

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 54 Nick Clemens 2017-05-05 20:22:19 UTC
Created attachment 63210 [details] [review]
Bug 17762 (QA Followup) Use default lang if pref disabled
Comment 55 Nick Clemens 2017-05-05 20:22:23 UTC
Created attachment 63211 [details] [review]
Bug 17762 (QA Followup) Fix Letters.t - add lang to fixtures
Comment 56 Nick Clemens 2017-05-05 20:24:29 UTC
All looks good, I added a followup so that we don't send translated notices if the pref is off.

One question, you have:
a/members/moremember.pl
  335 	# Display the language description instead of the code
  336 	# Note that this is certainly wrong

It seems to work, why is it wrong?
Comment 57 Jonathan Druart 2017-05-08 13:29:19 UTC
(In reply to Nick Clemens from comment #56)
> All looks good, I added a followup so that we don't send translated notices
> if the pref is off.
> 
> One question, you have:
> a/members/moremember.pl
>   335 	# Display the language description instead of the code
>   336 	# Note that this is certainly wrong
> 
> It seems to work, why is it wrong?

I think we should display the description in the translated language.
For instance "Spanish" is always "Español", whatever the language of the interface (same as the language list in the footer). It sounds wrong to me.
Comment 58 Kyle M Hall 2017-05-12 14:34:12 UTC
Pushed to master for 17.05, thanks Jonathan, Nick!
Comment 59 Katrin Fischer 2017-05-14 10:19:57 UTC
Very much looking forward to this!

This won't get ported back to 16.11.x as it is an enhancement.
Comment 60 Katrin Fischer 2017-07-08 18:59:23 UTC
*** Bug 7224 has been marked as a duplicate of this bug. ***
Comment 61 Jonathan Druart 2019-12-16 10:13:53 UTC
*** Bug 17160 has been marked as a duplicate of this bug. ***