Skip to content

aks-desktop: locales: index: Add i18n support to index things#448

Draft
illume wants to merge 1 commit intoAzure:mainfrom
illume:index-translations
Draft

aks-desktop: locales: index: Add i18n support to index things#448
illume wants to merge 1 commit intoAzure:mainfrom
illume:index-translations

Conversation

@illume
Copy link
Collaborator

@illume illume commented Mar 16, 2026

WIP: ...

image image

Testing

  • Go to settings and change the language
  • use headlamp, go to different places
    • note the aks desktop provided sidebars are translated
    • note projects are translated
  • There are some untranslated strings (like on the provider page) that still come up as english until we get new translations.
    • you can temporarily add a pretend translation to show it's working

Copilot AI review requested due to automatic review settings March 16, 2026 17:26
@illume illume marked this pull request as draft March 16, 2026 17:30
@illume illume force-pushed the index-translations branch from 715d8f7 to 641c9b3 Compare March 16, 2026 17:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 via registerAppBarAction) to re-register menu items, routes, custom project creators, and the AKS cluster provider using t(...) when the language changes.
  • Updates project details tab labels to be translated at render-time via a TranslatedLabel component.
  • 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",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants