fix(i18n): load server namespaces by kebab-case#30368
Conversation
Summary of ChangesHello @lyzno1, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical bug in the server-side internationalization (i18n) system where translation files were not being loaded correctly due to a mismatch in naming conventions. Previously, the system attempted to load i18n JSON files using camelCase namespaces, but the physical files were stored in kebab-case. This fix introduces a conversion step to ensure that the server correctly resolves and loads the appropriate translation files, thereby preventing fallback to raw translation keys and ensuring a consistent user experience. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses a bug where server-side internationalization was failing for namespaces named with kebab-case. The fix involves ensuring that namespaces are always converted to kebab-case before being used to construct file paths for loading translation JSON files. This is achieved by importing and using the kebabCase utility. The change is correct, well-targeted, and effectively resolves the issue by aligning server-side behavior with the file naming convention.
There was a problem hiding this comment.
Pull request overview
This PR fixes a server-side i18n loading issue where translation files with kebab-case names (e.g., dataset-settings.json) fail to load after namespaces are converted to camelCase internally by i18next.
Key Changes:
- Added
kebabCaseimport from es-toolkit/compat - Updated the
resourcesToBackendcallback to convert namespaces from camelCase back to kebab-case before building file import paths - Updated the namespace parameter type to accept both
NamespaceCamelCaseandNamespaceKebabCase
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Context
After PR #30336,
getTranslationcamelCases namespaces before callingloadNamespaces. The server backend then builds import paths like../i18n/${language}/${namespace}.json, which becomesdatasetSettings.jsonfordataset-settings. That file doesn't exist, so server translations for dashed namespaces fail.Repro
zh-Hans)./datasets/<id>/settings(usesdataset-settings).datasetSettings.jsonand misses; translations fall back to keys.Fix
namespaceto kebab-case before building the import path.