Upgraded to; email template and language change issue(s)

We’re on and we’re seeing two issues which may be related.

(1) Some email templates are in the wrong language, as per picture below. I tried the Settings → Website → setep → Languages → “Reload defaults” trick as described elsewhere, which fixed some templates (which had line-noise-like text) but not all of them.


(2) I attempted to solve the problem (on DEV) by switching to a new language and back again, figuring that this would flush all the template emails. It gave me this error:

[Mon Feb 22 14:48:08.046563 2021] [php7:error] [pid 23265] [client] PHP Fatal error: Uncaught Exception: DB Error: Duplicate entry
‘2-gd_GB-givenName-0-0’ for key ‘user_settings.user_settings_pkey’ Query: INSERT INTO user_settings (user_id, locale, setting_name, setting_value, s
etting_type)\n\t\t\t\t\t\tSELECT DISTINCT us.user_id, ?, ?, us.setting_value, ‘string’\n\t\t\t\t\t\tFROM user_settings us\n\t\t\t\t\t\tWHERE us.setti
ng_name = ? AND us.locale = ? AND us.user_id = ? in /var/www/ojs/lib/pkp/classes/db/DAO.inc.php:703\nStack trace:\n#0 /var/www/ojs/lib/pkp/classes/db
/DAO.inc.php(231): DAO->handleError(Object(ADODB_mysqli), ‘INSERT INTO use…’)\n#1 /var/www/ojs/lib/pkp/classes/user/UserDAO.inc.php(605): DAO->upda
te(‘INSERT INTO use…’, Array)\n#2 /var/www/ojs/lib/pkp/controllers/grid/admin/languages/AdminLanguageGridHandler.inc.php(370): UserDAO->changeSiteP
rimaryLocale(‘en_US’, ‘gd_GB’)\n#3 /var/www/ojs/lib/pkp/classes/core/PKPRouter.inc.php(391): AdminLanguageGridHandler->setPrimaryLocale(Array, Object
(Request))\n#4 /var/www/ojs/lib/pkp/classes/core/PKPComponentRouter.inc.php(257): PKPRouter->_authorizeInitializ in /var/www/ojs/lib/pkp/classes/db/D
AO.inc.php on line 703, referer: https://vuwunicoojst003.ods.vuw.ac.nz/index/admin/settings


INSERT INTO user_settings (user_id, locale, setting_name, setting_value, setting_type)
SELECT DISTINCT us.user_id, ?, ?, us.setting_value, ‘string’
FROM user_settings us
WHERE us.setting_name = ? AND us.locale = ? AND us.user_id = ?

Looks like a charset issue.

Email templates are stored in files that are distributed with every ojs version. Those files are loaded into your DB when you install ojs (or when you ask it to reset the email-templates). If the charsets don’t match, things go wild.

My recommendation here (unless you have very specific needs) is keep all in utf8mb4…

So… in this case, rollback to your backup version and:

  • check if your language files are stored in the wrong charset (please, open them with your favorite editor and confirm is utf8)
  • check if your DB is in the wrong one (please, confirm you are with utf8mb4-whatever)
  • check you have a wired configuration (check your config.inc.php) and keep tight to utf8.

After this, if all is in same charset, you will be able to reset your email-templates.


PD: We can speak Catalan if you like. :wink:

1 Like