Unable to translate browse and select UI strings

Created on 5 June 2023, over 1 year ago
Updated 6 June 2023, over 1 year ago

At the moment the JS code has a few strings in English which are not run through the translate function and cannot be translated at the moment.

For example the following strings will always display in English:

if (!select.is(":hidden")) {
  select.hide();
  _better_parent_item_pre_select(select);    
  bpi.show();
  toggle.text("(select)");
 } else {
  select.show();
  bpi.hide();
  toggle.text("(browse)");
 }

They should be run through the Drupal.t function. I would also remove the brackets from the string because it's much easier to find an existing translation for the word without brackets.
toggle.text("(" . Drupal.t("select") . ")");

🐛 Bug report
Status

RTBC

Version

9.4

Component

Code

Created by

🇫🇮Finland heikkiy Oulu

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

Comments & Activities

  • Issue created by @heikkiy
  • Assigned to shailja179
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India shailja179 India

    Apply this patch and clear the cache once, and search text to translate from admin/build/translate/search.
    It should work now.

  • Status changed to Needs work over 1 year ago
  • 🇫🇮Finland heikkiy Oulu

    The patch does include the possibility to translate the strings but at the same time it also changes the original strings from (select) to select. This is out side of the original scope of the issue to be able to actually translate the string because now it also changes the string content from the original.

    Either we need to adjust the ticket description or keep the original string as it was like suggested in the original comment with the plus operator where the bracket characters are not run through the t function.

  • First commit to issue fork.
  • @bharath-kondeti opened merge request.
  • 🇮🇳India bharath-kondeti Hyderabad

    Addressed #4 and raised a MR with changes. Please review

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Status changed to RTBC over 1 year ago
  • 🇫🇮Finland heikkiy Oulu

    Tested and both strings translate to Finnish. Looks good for RTBC.

  • 🇮🇳India shailja179 India

    My bad.Made the new changes in patch but MR looks good.

Production build 0.71.5 2024