[D7] Drupal.t() does not respect locale_custom_strings

Created on 7 April 2010, almost 15 years ago
Updated 5 December 2023, about 1 year ago

I'm using $conf['locale_custom_strings_xx'] in settings.php and i have no problems with translations through t() php function. But if i translate through Drupal.t() javascript function there is no string translation from $conf['locale_custom_strings_xx']. Instead I have to use locales_target database table to translate strings through Drupal.t() javascript function.

Drupal.t() should also use $conf['locale_custom_strings_xx'].

Steps to reproduce

Easiest way to reproduce is:

1. enable second language (for example German)
2. specify some string overrides in settings.php, for example:

 $conf['locale_custom_strings_de'][''] = [
   'Label' => 'LabelCUSTOM',
   'Edit' => 'EditCUSTOM',
 ];

3. Go to /de/admin/structure/types/manage/page/fields
4. You can see the "Label" strings overriden correctly, but the "Edit" (when you start to type a new machine name) is not, as this is coming from Drupal.t() (instead it has "Bearbeiten" as a correct German translation).

(optionally)
5. apply patch
6. clear cache
7. "Bearbeiten" will be changed to "EditCUSTOM" correctly

Proposed resolution

Drupal.t() should respect the string overrides.

πŸ› Bug report
Status

Fixed

Version

7.0 ⚰️

Component
JavascriptΒ  β†’

Last updated about 8 hours ago

Created by

πŸ‡©πŸ‡ͺGermany checker

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024