Back to Blog

    Developer Blog

    Additional Language support with Foxit PDF SDK for Web

    Foxit PDF SDK for Web

    Internalization Resources

    Foxit PDF SDK for Web has adopted the i18Next international framework to implement additional language support. The localization resources are stored at ~lib\locales. Each folder contains two resource files – the ui_.json and viewer_.json. The first one is for the advanced web viewer demo, and the other is for the basic web viewer demo.

    library options locales foxit sdk

    UI Language used in basic and advanced web viewer demo

    The basic web viewer demo displays its UI language according to the primary language of browser. For example, if the top language in the browser is Chinese, it automatically displays the UI in Chinese.

    The advanced web viewer demo requires pdfui.changeLanguage(‘language code’) to clarify the specific UI language. The following table shows how to call the changeLanguage() and the corresponding UI language.

    https://webviewer-demo.foxitsoftware.cn/examples/UIExtension/advanced_webViewer/
    foxit pdf sdk web change language code text

    Note: A language code is formatted in the style of “en-US” and “zh-CN”

    How to add a new language

    1) Create a new language folder in ~lib\locales. The folder name should follow the language codes standard.

    2) Duplicate the one or two json resource files from ‘en-US’ folder into the target language folder. The ui_.json is for UIExtension level application, and the viewer_.json is for pdfViewer level application. If you are developing based UIExtension, the recommended way is to translate ui_.json, and keep original viewer_.json in the same folder. This way, you can correctly access the basic web viewer demo at any time. Once you’ve done that, you’re good to go!

    ui json viewer files foxit sdk

    NOTE: To apply the language, refer to the section ‘UI Language used in basic and adv web viewer demo’.