eclipse-theia / theia

Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
http://theia-ide.org
Eclipse Public License 2.0
19.38k stars 2.45k forks source link

The settings page does not support internationalization #13802

Closed fly-bue closed 4 days ago

fly-bue commented 3 weeks ago

Bug Description:

I found that internationalization was not implemented in the preference-tree-widget.ts and preference-node-renderer.ts files, and I tried to solve this problem. As follows:

  // preference-tree-widget.ts
  protected override toNodeName(node: TreeNode): string {
   const visibleChildren = this.model.currentRows.get(node.id)?.visibleChildren;
       // todo
        const baseName = nls.localizeByDefault(this.labelProvider.getName(node));
        const printedNameWithVisibleChildren = this.model.isFiltered && visibleChildren !== undefined
            ? `${baseName} (${visibleChildren})`
            : baseName;
        return printedNameWithVisibleChildren;
    }

  // preference-node-renderer.ts
 protected createDomNode(): HTMLElement {
        const wrapper = document.createElement('ul');
        wrapper.className = 'settings-section';
        wrapper.id = `${this.preferenceNode.id}-editor`;
        const isCategory = Preference.TreeNode.isTopLevel(this.preferenceNode);
        const hierarchyClassName = isCategory ? HEADER_CLASS : SUBHEADER_CLASS;
        // todo
        const name = nls.localizeByDefault(this.labelProvider.getName(this.preferenceNode));
        const label = document.createElement('li');
        label.classList.add('settings-section-title', hierarchyClassName);
        label.textContent = name;
        wrapper.appendChild(label);
        return wrapper;
    }

image When does the team plan to support internationalization of the settings page?

Steps to Reproduce:

image

Additional Information

Operating System: Windows 11 Theia Version: master

msujew commented 3 weeks ago

Hey @fly-bue,

the main issue is that these names are dynamically generated from the IDs/names of the preferences. They're not real named groups. VS Code also struggles with this, and AFAIK also doesn't translate the names of the preference groups.

However, we can maintain a list of translations for known groups. Note that the preferences contributed by plugins won't have a translated group name.

fly-bue commented 3 weeks ago

Thanks for the reply.I found that some translations are already implemented in this repo, but they are not used in Theia settings page yet.

msujew commented 3 weeks ago

I see. Seems like VS Code has actually started translating those preference groups. That wasn't there the last time I worked on the feature. I'll implement this soon.