How to Customize Language Resources with Foxit PDF SDK for Web
Assumption
Assume you have an assets/
in your website root directory, where you will configure the language resources. Let’s call this path as websiteRoot/assets/
.
Configuration
- Copy
lib/locals
inside the SDK towebsiteRoot/assets/
. - Set up the I18N path for loading resources.
new UIExtension.PDFUI({ i18n: { absolutePath: 'websiteRoot/assets/locals' }, // the other options... });
- Add more languages
Create a new folder inwebsiteRoot/assets/locals
. The folder name should follow the language codes standard, such as zh-CN for Chinese. And then new a file, name it as ui_.json and then translate the entries to your language. You can find the English resources inside the SDK package. - Set up default language
new UIExtension.PDFUI({ i18n: { absolutePath: `websiteRoot/assets/locals`, lng: 'zh-CN' }, // the other options })
Verify the configuration in a developer environment
- Clear your browser caches to ensure the latest I18N resources will be loaded.
- Refresh your browser, open the Network panel in DevTools,and check if the
ui_.json
request URL points your custom language path. If yes, then you’re all set!
Updated on August 11, 2021