Locale IDs are chaotically assigned

Created on 5 September 2025, about 2 months ago

Problem/Motivation

Source hashes are wrongly linked to Locale IDs.

The problem is located in BabelLocaleTranslation::getStringTranslation() and BabelLocaleLookup.

When a string translation is already cached, BabelLocaleLookup::resolveCacheMiss() is not called, so BabelLocaleLookup::$sid is not set for that string. Then BabelLocaleTranslation::getStringTranslation() tries to get the string translation by calling BabelLocaleLookup::getSourceId() which will return ID of the string that was lat time fetched from the backend. And that it's an incorect string.

Steps to reproduce

On a site with some content visit pages with a non-English language to get Locale tables populated.

Run this query:

SELECT bs.hash, COUNT(bsi.id) AS c, GROUP_CONCAT(ls.source)
FROM babel_source bs
INNER JOIN babel_source_instance bsi ON bs.hash = bsi.hash
INNER JOIN locales_source ls ON bsi.id = ls.lid
GROUP BY bs.hash
HAVING c > 1

You will notice different strings concatenated at the same hash. But different strings cannot have the same hash.

Proposed resolution

When caching the translations, in BabelLocaleLookup, cache also the Locale source ID, so we can properly retrieve it.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇷🇴Romania claudiu.cristea Arad 🇷🇴

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024