You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a Simplified Chinese reference locale to the five demos #280
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
Open the React demo and create a new presentation.
Open File > Options > Language.
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.
@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 publishedimport{translationsZhCN}from'pptx-viewer-locales/zh-CN';i18n.addResourceBundle('zh-CN','translation',translationsZhCN);awaiti18n.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?
@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
@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:
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.
Activity
yunfeizhu commentedon Sep 14, 2026
@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 thezh-CNsource directory into its own project, sincepptx-viewer-localesis 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:
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?
ChristopherVR commentedon Sep 14, 2026
@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
yunfeizhu commentedon Sep 14, 2026
@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:
I'll follow the same pattern for the other bindings and keep the existing English import unchanged. Thanks for clarifying the direction!
yunfeizhu commentedon Sep 14, 2026
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:
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.
ChristopherVR commentedon Sep 14, 2026
Closing this issue so we can continue to track the subpath changes in the other issue.