MyLocalization Decument
  • v1.3
    • MyLocalization English Document
      • MyLocalization Data Flow Diagram
      • Quick Start
        • Run the Demo Correctly
        • Preparation
        • Localize Text
        • Localize Texture
        • Localization of Other Types of Resources
      • Load Assets
        • Only Load Resources Corresponding to the Current Language
        • Implement IResLoader interface
        • Enable IResLoader Subclass
        • Convert Resource References Associations to Paths
        • Text Localization Items Do Not Need to Be Loaded with Language Type
      • Edit Text for Localization
        • Basic Operation
        • Automatic Translation
        • Find and Replace
        • Speech Binding Text
        • CSV Table Export and Import
        • Essay on the Importance of Text Table (StringTable)
      • Display and Setter Components
        • Correspondence between Setter Components and Display Components
        • RTL (Right To Left) Related Settings
        • Dynamic Splicing of Localized Text
        • Quickly create and modify localized field text using properties of MyString
    • MyLocalization 中文文档
      • MyLocalization 数据流程图
      • 快速开始
        • 正确运行 Demo
        • 准备工作
        • 文本本地化
        • 图片本地化
        • 其他资源的本地化
      • 加载当前语言资源
        • 只加载当前语言对应的资源
        • 实现 IResLoader 接口
        • 启用 IResLoader 子类
        • 将资源引用关联转为路径
        • 文本的本地化项不能随语言类型加载
      • 编辑文本表
        • 基本操作
        • 自动翻译
        • 搜索与替换
        • 语音绑定文字
        • CSV表格导出与导入
        • 使用 MyString 的属性快速创建和修改本地化字段文本
      • 一切准备都为了Setter组件实现本地化
        • Setter 组件与显示组件的对应关系
        • RTL (Right To Left)相关设置
        • 动态拼接本地化文本
Powered by GitBook
On this page
  1. v1.3
  2. MyLocalization English Document
  3. Quick Start

Localize Text

PreviousPreparationNextLocalize Texture

Last updated 2 years ago

To create a StringTable resource, run the following command: Assets (or right-click menu in Project) > Create > fuliu > Language Localization (Localization) > StringTable. The StringTable resource is named TextTable.

Usually the language type file properties will be automatically populated with LocalizationSetting's language type file that exists in the scene. If the autopopulated or autopopulated file is not what you want, you can manually populate it again.

Click the Open Editor button in the image above to open the text table editor. If all is well, the window should look like the following:

In the text table editor, click the + button to the left of the Create field to create a new field. By default, the field ID starts at 0. Then enter the field name in the field name input box, for example, "TestField 0"; Then click on the field name or the right arrow in front of the field name to open the text input field for each language:

We manually enter the first line (simplified Chinese): 'Test field 0' and the second line (English): 'TestField 0'. When we enter text into these two lines, we can see that the language name that was previously displayed in red is now displayed in white (if Unity's skin is Light, the text will only be displayed in black and will not change color, this is Unity's problem, but it does not affect use).

Let's go to the current scene and create a new Ugui Text UI object and attach the UITextStaticSetter component to it.

Drag the StringTable resource file created above into the object reference box below the static text in the image above. A drop-down list appears to the right of the object reference box. Select the field we created earlier: TestField 0 from the drop-down list.

The localization of the text is complete. The next step is to test whether it works properly. Click the "Set to Display component" button in the above image. You can see that the Text component in the Scene window changes into Chinese: "test field 0", indicating that it has been successful.

Click the button in the figure below to loop between different languages to see the Text display. If the text display is abnormal in different languages, you can adjust the text component parameters and Setter component parameters in time.