Skip to content

Add a Simplified Chinese reference locale to the five demos #280

Closed

Description

@yunfeizhu

Problem / use case

While trying the editor, I wanted to switch the interface to Simplified Chinese. I opened File > Options > Language, but the available choices are English, French, Spanish, and German. There is no Chinese reference dictionary in packages/locales either.

For a Chinese-speaking user, this means navigating editing commands, comments, presenter controls, and settings in another language. A host application can supply its own dictionary, but it has to maintain thousands of viewer-specific strings before offering a consistent Chinese interface.

How to see the gap

  1. Open the React demo and create a new presentation.
  2. Open File > Options > Language.
  3. Look for 简体中文 (zh-CN): it is not available.

The other four demos use the same set of reference languages. This does not depend on the contents of a particular presentation.

Checked against pptx-react-viewer 3.17.0 / main f824eb0c760b3ff1319d1cb5dd2d3e4329f0822b.

Proposed solution

Add a complete zh-CN reference dictionary alongside the existing languages, preserve the same interpolation placeholders, and register it in the React, Vue, Angular, Svelte, and Vanilla demos. The language picker should show 简体中文, apply the choice immediately, and restore it after a reload.

Document how external applications can copy the reference dictionary and register it with their binding, following the existing private-workspace model.

Willing to implement

Yes. I have prepared the dictionary and five-demo integration, with key/placeholder checks and browser tests for switching languages and restoring the saved choice.

The hard-coded control labels reported in #278 are a separate gap addressed by #279; this request adds the Chinese language itself.

Activity

  1. yunfeizhu commented on Sep 14, 2026

    @yunfeizhu
    ContributorAuthor

    @ChristopherVR One follow-up suggestion for applications consuming the npm packages: could we make the reference dictionaries available through a published locale package?

    English is already available through import { translationsEn } from 'pptx-react-viewer/i18n'. With the approach in #281, an application that wants Chinese still needs to copy the zh-CN source directory into its own project, since pptx-viewer-locales is private. Keeping that copy in sync as viewer keys change adds maintenance work for each application.

    Publishing the existing locale workspace with its per-language exports could provide this usage:

    // Proposed npm import once the locale package is published
    import { translationsZhCN } from 'pptx-viewer-locales/zh-CN';
    
    i18n.addResourceBundle('zh-CN', 'translation', translationsZhCN);
    await i18n.changeLanguage('zh-CN');

    This would also help users of the French, Spanish, and German dictionaries. A separate package would keep translations opt-in, reusable across the five bindings, and versioned alongside the viewer.

    Would you be open to this as a separate follow-up to #281, or would you prefer locale subpaths in the individual viewer packages?

  2. ChristopherVR commented on Sep 14, 2026

    @ChristopherVR
    Owner

    @yunfeizhu thanks for the contributions - I'd still prefer an approach similar to how you can import english atm (import { translationsEn } from 'pptx-react-viewer/i18n) instead of publishing a locales package which I feel is practically useless on its own. I feel its less of a trade-off than maintaining an additional package.

    I'm open to be corrected on this if you feel so otherwise continue with the locale subpaths

  3. yunfeizhu commented on Sep 14, 2026

    @yunfeizhu
    ContributorAuthor

    @ChristopherVR That makes sense. I'll proceed with locale subpaths in the viewer packages, so applications can import translations directly from the component package. For React, the usage would be:

    import { translationsZhCN } from 'pptx-react-viewer/i18n/zh-CN';

    I'll follow the same pattern for the other bindings and keep the existing English import unchanged. Thanks for clarifying the direction!

  4. yunfeizhu commented on Sep 14, 2026

    @yunfeizhu
    ContributorAuthor

    I've opened #282 to track the agreed locale-subpath follow-up, with the implementation in #283.

    It makes the translations available from the existing viewer packages, for example:

    import { translationsZhCN } from 'pptx-react-viewer/i18n/zh-CN';

    The same pattern covers French, Spanish, German, and Simplified Chinese across all five bindings. The locale workspace stays private; consumers do not need to install an additional package.

  5. ChristopherVR commented on Sep 14, 2026

    @ChristopherVR
    Owner

    Closing this issue so we can continue to track the subpath changes in the other issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions