0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-09 21:23:14 +08:00
discourse/frontend/discourse-i18n
Kris 9f6ca55078
FIX: Don't treat empty translations as missing for locale fallback (#41299)
When a translation resolves to an empty value `""`, this is valid and
intentional...

...but `findTranslationWithFallback` uses a falsy check, `!translation`,
to decide to fallback to the next locale. When this happens the key is
shown instead of the empty value being handled.

To reproduce this, you can set your site locale to something not english
(French for example) and then change your user's locale to English
(`/my/preferences/interface`). Then an empty translation will produce
the key instead of remaining blank... like this example from the admin
header component:

<img width="800" alt="image"
src="https://github.com/user-attachments/assets/e9b4b715-6752-419c-af9b-b99facfd24ff"
/>

This has cropped up in other places before, but never fixed at the root
(https://meta.discourse.org/t/bug-with-search-banner-search-button-text-shown-in-search-banner-theme-component/273628/13?u=awesomerobot)

Switching the check to null will fix it.
2026-06-30 16:56:04 -04:00
..
src FIX: Don't treat empty translations as missing for locale fallback (#41299) 2026-06-30 16:56:04 -04:00
addon-main.cjs
package.json DEPS: Bump the embroider group across 1 directory with 4 updates (#40856) 2026-06-16 14:57:02 +02:00
tsconfig.json DEV: Add a script for generating external types in discourse-types (#37095) 2026-03-09 20:37:43 +01:00