PDF Generation Template Editor
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
The WebViewer UI is internationalized with i18next. Six languages ship out of the box; you can switch at runtime and add your own.
Translation files live in packages/webview/public/locales/ (copied to dist/locales/ on build), named translation-<lng>.json to match the i18next-http-backend load path ./locales/-.json.
| Code | Language |
|---|---|
en | English (fallback) |
zh-CN | Simplified Chinese |
zh-TW | Traditional Chinese |
ja | Japanese |
fr | French |
th | Thai |
Default/fallback: en. The selected language is persisted in localStorage under the language key.
UI.setLanguage(language) Switch the UI language at runtime. Async.
/**
* @method UI.setLanguage
* @param {string} language Default supported: en, zh-CN, zh-TW, fr, th, ja.
*/
await UI.setLanguage('zh-CN');Internally: await i18next.changeLanguage(language), then store.setLanguage(language), then persists to localStorage['language']. Components consume translations via useTranslation() from i18next-vue.
UI.addLanguage(language) Add a language resource to the available set.
UI.addLanguage({ /* language resource object */ });UI.removeLanguage(language) Remove a language from the available set.
UI.removeLanguage('fr');UI.setLanguages(languages) Replace the entire set of available languages.
UI.setLanguages([ /* array or object */ ]);The active initializer is packages/webview/src/i18n.js:
i18next + i18next-http-backend + i18next-vue.localStorage['language'] || localStorage['currentLanguage'] || 'en'.load: 'currentOnly', returnObjects: true, fallbackLng: 'en', namespace translation../locales/-.json via a custom XHR requester that tolerates Android-webview status 0 for file:// loads.window.i18next = i18next globally and exports i18nextPromise (awaited in App/index.vue before the app renders).
packages/webview/src/i18nNext.jsis a minimal legacy variant (no HTTP backend, no localStorage) and is not imported bymain.js. It is superseded byi18n.js.
packages/webview/src/helpers/setupI18n.jsdeclares aLanguages[]catalog of 25[code, displayName]pairs andlanguageRulesmapping internal codes to i18next/dayjs locale codes — useful as a reference for the broader language catalog the SDK can be extended to support.
await UI.setLanguage('ja');UI.addLanguage({
code: 'ko',
translations: {
'header.tools.annotate': '주석',
/* …full translation map… */
},
});
await UI.setLanguage('ko');The exact shape of the resource object follows the i18next resource structure; see
translation-en.jsonfor the full set of keys.