fix: translateIfKey breaks plugin config labels by treating plain text as i18n keys#8564
fix: translateIfKey breaks plugin config labels by treating plain text as i18n keys#8564DDomelette wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The new
value.includes('.')heuristic may be too strict for i18n keys that don't use dot notation or for legitimate plain text containing a dot (e.g. URLs); consider a more robust way to distinguish keys from plain text (e.g. explicit prefix, config flag, or trying translation first and falling back). - Previously, non-resolvable strings fell back to the original
value, but nowtranslateIfKeyreturnsnullwhengetRaw(value)is falsy; double-check that all call sites handlenullcorrectly or consider maintaining the previous fallback-to-original behavior.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new `value.includes('.')` heuristic may be too strict for i18n keys that don't use dot notation or for legitimate plain text containing a dot (e.g. URLs); consider a more robust way to distinguish keys from plain text (e.g. explicit prefix, config flag, or trying translation first and falling back).
- Previously, non-resolvable strings fell back to the original `value`, but now `translateIfKey` returns `null` when `getRaw(value)` is falsy; double-check that all call sites handle `null` correctly or consider maintaining the previous fallback-to-original behavior.
## Individual Comments
### Comment 1
<location path="dashboard/src/composables/useConfigTextResolver.js" line_range="11" />
<code_context>
if (!value || typeof value !== 'string') return value
- return getRaw(value) ? tm(value) : value
+ if (!value.includes('.')) return value
+ return getRaw(value) ? tm(value) : null
}
</code_context>
<issue_to_address>
**issue (bug_risk):** Returning null instead of the original value on missing i18n key may cause downstream breakage.
Previously, a falsy `getRaw(value)` fell back to returning `value`, which is a safe, visible string. Now it returns `null`, which may flow into callers expecting a string and lead to empty UI or warnings. If you want missing keys to be explicit, ensure all consumers handle `null`; otherwise consider keeping the original `value` or using a dedicated placeholder instead.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Code Review
This pull request modifies the translateIfKey function in useConfigTextResolver.js to return early if the string does not contain a dot, and to return null instead of the original value when getRaw(value) is falsy. The review feedback correctly identifies a regression where plain text strings containing dots (such as version numbers or IP addresses) that are not valid i18n keys will return null, causing them to disappear from the UI. The reviewer suggests falling back to the original value instead of returning null.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if (!value || typeof value !== 'string') return value | ||
| return getRaw(value) ? tm(value) : value | ||
| if (!value.includes('.')) return value | ||
| return getRaw(value) ? tm(value) : null |
There was a problem hiding this comment.
If value is a plain text string that contains a dot (for example, version numbers like "v1.0", IP addresses like "127.0.0.1", or descriptions containing sentences with periods like "Timeout (e.g. 5s)"), !value.includes('.') will evaluate to false.
Since it is not a valid i18n key, getRaw(value) will return null, causing translateIfKey to return null. This will result in fallbackText becoming '' (empty string) in resolveConfigText, making these plain text labels, descriptions, or hints completely disappear from the UI.
To prevent this regression, we should return the original value as a fallback when getRaw(value) is falsy, rather than returning null.
| return getRaw(value) ? tm(value) : null | |
| return getRaw(value) ? tm(value) : value |
Problem
ull, causing plugin configuration field labels (descriptions, hints) to disappear entirely in the WebUI.
Root Cause
The function calls getRaw(value) on the raw config field text. When the plugin provides plain text descriptions (e.g. API Key, Timeout) that don't correspond to any i18n key path, getRaw() returns undefined, and the function returns
ull.
Fix
Added a check: if the value doesn't contain ., it's plain text (not an i18n dot-separated path), so return it as-is. Only attempt i18n resolution for dot-separated key paths.
Changes
Summary by Sourcery
Bug Fixes: