Comment 7 for bug 1091588

Revision history for this message
Rogan Hamby (rogan-hamby) wrote (last edit ):

A patch to add this functionality is at https://git.evergreen-ils.org/?p=working/Evergreen.git;a=commit;h=2542925ced2283f61fb9f8a2fc2e8a20e7eabaf6

follow up commit with commas fix: 3b60d2f80764a16b3d58241580b769c7f6d862b1

There is one particular point to this patch I would still like feedback on.
The implementation assumes that in an effort to not check every event that the
logic only applies to events with the SendSMS, SendEmail, or ProcessTemplate reactors.
However, any event could potentially create a patron message so we may want to expand
this to all possible events which would be simple to do if we want to go that route.

From the commit message:

This feature supplies the ability to create alternate templates for Action Triggers
that will generate locale-specific out for Action Triggers. If you send notices in
multiple languages, we recommend putting some words to that effect in your notice
templates. The template, message, and message title can all be localized. To use the
feature the following new UI elements have been added:

- When you double-click on an Event Definition under Notifications / Action Triggers
  to edit it there will be a tab option for Edit Alternate Template if the reactor is
  ProcessTemplate, SendEmail or SendSMS.
- In the Patron Registration and Patron Editor screens staff members may now select a
  locale for a patron and edit it in the Patron Preferred Language field.
- Patrons may set their own locale in the My Account interface off the OPAC by going to
  Preferences -> Personal Information and setting the Preferred Language field.

The templates used on the Edit Definition tab are the defaults that are used if there are
no alternate templates available that match the preferred language. If alternate templates
are available the system will use a locale that is an exact match and then if failing that
use one where the language code matches and then fall back to the default one.

For example, if a patron has a locale of fr-CA and there are templates for both fr-CA and
fr-FR it will use the fr-CA. If the fr-CA template was deleted it would fall back on using
the fr-FR for the patron since it at least shares the same base language.

Valid locales are the codes defined in the i18n_locale table in the config schema.