hansva opened a new issue, #9502:
URL: https://github.com/apache/hop/issues/9502
### What needs to happen?
**Problem**
Weblate copies every key from the `messages_en_US.properties` template into
each translation file. A string nobody has translated yet is written with an
empty value:
AiProviderObjectFactory.PluginNotFound=
Java's `ResourceBundle` only falls back to another bundle when a key is
*missing*. A key that is present with an empty value counts as found, so
`BaseMessages.getString()` returns `""`. Hop's own fallback in
`GlobalMessageUtil` (selected locale → en_US → root) also only moves on when a
key is missing. Users of a partly translated language see empty labels,
tooltips and messages instead of the English text.
Weblate's "Remove blank strings" add-on would clean these keys up. It also
removes the Apache license header when the first key in a file is blank, and
Apache RAT then fails the build. So it can't be used.
**Proposed fix**
In `GlobalMessageUtil.calculateString`, treat an empty translation the same
as a missing one:
- If a package has an empty value for the key, try the next package in the
same locale.
- If every package is empty for a locale, try the next active locale (en_US,
then root).
- If the key is empty everywhere, return `""` rather than `!key!`.
**Acceptance criteria**
- With the UI set to a language whose bundle has `Key=`, the en_US text is
shown.
- An empty value in one package does not hide a translation in a later
package of the same locale.
- A key that is empty in every bundle still resolves to `""`.
- Unit tests in `GlobalMessageUtilTest` cover the three cases above.
- Weblate pull requests that add empty keys can be merged as is.
**Out of scope**
Code that calls `ResourceBundle.getString()` directly, including the
`GlobalMessageUtil.getString(ResourceBundle, key, …)` helpers, still returns
`""` for an empty value.
### Issue Priority
Priority: 2
### Issue Component
Component: Translations
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]