1. Home
  2. Foxit PDF SDK for Web
  3. How to Customize Language Resources with Foxit PDF SDK for Web

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

  1. Copy lib/locals inside the SDK to websiteRoot/assets/.
  2. Set up the I18N path for loading resources.
    new UIExtension.PDFUI({
        i18n: {
            absolutePath: 'websiteRoot/assets/locals'
        },
        // the other options...
    });
    
  3. Add more languages
    Create a new folder in websiteRoot/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.
  4. 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

  1. Clear your browser caches to ensure the latest I18N resources will be loaded.
  2. 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 October 12, 2020

Was this article helpful?

Related Articles

Ready to try Foxit PDF SDK?
Click the link below to download your trial
Free Trial