JavaScript translation file for a language contains admin strings for anonymous users

Created on 2 February 2023, over 1 year ago

Problem/Motivation

It looks like Drupal generates the js translation file (locale for window.drupalTranslations) with everything available in the locale.storage, including strings meant only for site administrators -> Toolbar, Quick edit, CKEditor and etc.
I've noticed this in _locale_rebuild_js() method in the locale.module

I wonder if this can be somehow optimized, because right now this js file is served also for anonymous users and most of these strings don't make sense for them.

There are two main concerns with this approach:
1. Strings that are not supposed to be seen by anonymous users.
2. Javascript file size

Steps to reproduce

On a multilingual site, translate some UI-related strings, clear cache and open the locale file generated for that language.

πŸ› Bug report
Status

Active

Version

9.5

Component
LocaleΒ  β†’

Last updated 3 days ago

Created by

πŸ‡§πŸ‡¬Bulgaria yivanov

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

Comments & Activities

Production build 0.69.0 2024