aks-desktop: locales: index: Add i18n support to index things#448
Draft
illume wants to merge 1 commit intoAzure:mainfrom
Draft
aks-desktop: locales: index: Add i18n support to index things#448illume wants to merge 1 commit intoAzure:mainfrom
illume wants to merge 1 commit intoAzure:mainfrom
Conversation
715d8f7 to
641c9b3
Compare
There was a problem hiding this comment.
Pull request overview
Adds i18n support for AKS Desktop plugin “index-level” registrations (menus/routes/sidebar labels) so these strings can respond to UI language changes, aligning with the rest of the plugin’s localized UI.
Changes:
- Introduces
TranslatedRegistrations(mounted viaregisterAppBarAction) to re-register menu items, routes, custom project creators, and the AKS cluster provider usingt(...)when the language changes. - Updates project details tab labels to be translated at render-time via a
TranslatedLabelcomponent. - Adds new English translation keys for newly-localized strings.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
plugins/aks-desktop/src/index.tsx |
Adds translation-aware registration logic and translated tab labels; updates Azure sidebar label to use translated text when available. |
plugins/aks-desktop/locales/en/translation.json |
Adds new i18n keys needed by the newly translated registrations/labels. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+67
to
+79
| const docIndex = helpMenu.submenu.findIndex(item => item.id === 'original-documentation'); | ||
| if (docIndex !== -1) { | ||
| helpMenu.submenu[docIndex] = { | ||
| label: t('Documentation'), | ||
| id: 'aks-documentation', | ||
| url: 'https://aka.ms/aks/aks-desktop', | ||
| }; | ||
| } | ||
| const issueIndex = helpMenu.submenu.findIndex(item => item.id === 'original-open-issue'); | ||
| if (issueIndex !== -1) { | ||
| helpMenu.submenu[issueIndex] = { | ||
| label: t('Open an Issue'), | ||
| id: 'aks-open-issue', |
Comment on lines
+182
to
+186
| // Re-use the existing azure-auth-update event to trigger | ||
| // updateAzureAccountLabel, which will re-register the sidebar entry with | ||
| // the translated 'Azure Account' label (via tFunc) when not logged in. | ||
| window.dispatchEvent(new Event('azure-auth-update')); | ||
| }, [i18n.language, t]); |
Comment on lines
+57
to
+118
| /** Re-registers entries with translated strings when the UI language changes. */ | ||
| function TranslatedRegistrations() { | ||
| const { t, i18n } = useTranslation(); | ||
|
|
||
| React.useEffect(() => { | ||
| tFunc = t; | ||
|
|
||
| Headlamp.setAppMenu(menus => { | ||
| const helpMenu = menus?.find(menu => menu.id === 'original-help'); | ||
| if (helpMenu && helpMenu.submenu) { | ||
| const docIndex = helpMenu.submenu.findIndex(item => item.id === 'original-documentation'); | ||
| if (docIndex !== -1) { | ||
| helpMenu.submenu[docIndex] = { | ||
| label: t('Documentation'), | ||
| id: 'aks-documentation', | ||
| url: 'https://aka.ms/aks/aks-desktop', | ||
| }; | ||
| } | ||
| const issueIndex = helpMenu.submenu.findIndex(item => item.id === 'original-open-issue'); | ||
| if (issueIndex !== -1) { | ||
| helpMenu.submenu[issueIndex] = { | ||
| label: t('Open an Issue'), | ||
| id: 'aks-open-issue', | ||
| url: 'https://github.com/Azure/aks-desktop/issues', | ||
| }; | ||
| } | ||
| } | ||
| return menus; | ||
| }); | ||
|
|
||
| registerRoute({ | ||
| path: '/azure/login', | ||
| // @ts-ignore todo: fix component type | ||
| component: AzureLoginPage, | ||
| name: t('Azure Login'), | ||
| exact: true, | ||
| sidebar: { item: 'azure-profile', sidebar: 'HOME' }, | ||
| noAuthRequired: true, | ||
| useClusterURL: false, | ||
| }); | ||
|
|
||
| registerRoute({ | ||
| path: '/azure/profile', | ||
| component: AzureProfilePage, | ||
| name: t('Azure Profile'), | ||
| sidebar: { sidebar: 'HOME', item: 'azure-profile' }, | ||
| exact: true, | ||
| noAuthRequired: true, | ||
| useClusterURL: false, | ||
| }); | ||
|
|
||
| registerRoute({ | ||
| path: '/projects/create-aks-project', | ||
| component: CreateAKSProject, | ||
| name: t('Create a new AKS project'), | ||
| sidebar: { sidebar: 'HOME', item: 'projects' }, | ||
| exact: true, | ||
| noAuthRequired: true, | ||
| useClusterURL: false, | ||
| }); | ||
|
|
||
| registerRoute({ |
Comment on lines
+642
to
649
| "Select namespaces to use as a project": "Select namespaces to use as a project", | ||
| "New namespace with resources as a project": "New namespace with resources as a project", | ||
| "Create New AKS Managed Namespace": "Create New AKS Managed Namespace", | ||
| "Create new AKS managed namespace and use as a project": "Create new AKS managed namespace and use as a project", | ||
| "Azure Kubernetes Service": "Azure Kubernetes Service", | ||
| "Connect to an existing AKS (Azure Kubernetes Service) cluster from your Azure subscription. Requires Azure CLI authentication.": "Connect to an existing AKS (Azure Kubernetes Service) cluster from your Azure subscription. Requires Azure CLI authentication.", | ||
| "just now": "just now", | ||
| "{{seconds}}s ago": "{{seconds}}s ago", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP: ...
Testing