目录

Multi-Language Capability

Applications designed based on the development framework apply to different countries and regions. With the multi-language capability, you do not need to develop application versions in different languages, and your users can switch between various locales. This also facilitates project maintenance.

You only need to perform operations in Defining Resource Files and Referencing Resources to use the multi-language capability of this framework. For details about how to obtain the current system language, see Obtaining the Language.

Defining Resource Files

Resource files store application content in multiple languages. This framework uses JSON files to store resource definitions.

Place the resource definition file of each locale in the i18n folder specified in Directory Structure. Name the resource files in language-region.json format. For example, name the resource file for English (United States) en-US.json. If there is no resource file of the locale that matches the system language, content in the en-US.json file will be used by default.

The format of the resource file content is as follows:

en-US.json

{
    "strings": {
        "hello": "Hello world!",
        "object": "Object parameter substitution-{name}",
        "array": "Array type parameter substitution-{0}",
        "symbol": "@#$%^&*()_+-={}[]\\|:;\"'<>,./?"
    },

    "files": {
        "image": "image/en_picture.PNG"
    }
}

Referencing Resources

Obtaining the Language

For details about how to obtain the language, see Application Configuration.