-
Notifications
You must be signed in to change notification settings - Fork 4
Internationalization i18n
Mainly implemented the multilingual function of printing related logs, with language files in JSON format. WebSocket Server automatically matches language files with local language information upon startup.
The language folder path is usually the current path where the program runs when it does not contain root directory information
The I18nResourcePath static property is used to specify the path of the language folder, which defaults to the i18n directory under the current running directory.
The I18nResourceFileSuffix static property is used to specify the suffix of the language file, which defaults to. json.
The language file name must conform to System The name conventions for Globalization. CultureInfo, such as zh CN, en US, etc.
The language file is in JSON format, and the JSON file is in the form of key value pairs.
The key in JSON is a static read-only field in Class "Cyaim.WebSocketServer.Infrastructure.I18nText" that is not marked with the [JsonIgnore]. If all or part of the language configuration has been modified, I18nText.UpdateI18nText() method updates the running language text.
I18nText.UpdateI18nText("zh-CN");
// Or
I18nText.UpdateI18nText("../i18n/zh-CN.json");