Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Tr

This function referes a po file like ja.po as an asset. Asmdef and [assembly: UnityEditor.Localization] is needed.
Read time 1 minuteLast updated 10 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule

Tr(string)

This function referes a po file like ja.po as an asset. Asmdef and [assembly: UnityEditor.Localization] is needed.
public static string Tr(string str)

Parameters

Original text, basically English.

Returns

Type

Description

stringLocalized text.

Examples

using UnityEngine;using UnityEditor;// This is not an editor script.public class MyScript : MonoBehaviour {}[CustomEditor(typeof(MyScript))]public class MyScriptInspector : Editor{ MyScript m_Target = null; void OnEnable() { m_Target = target as MyScript; } public override void OnInspectorGUI() { base.OnInspectorGUI(); EditorGUILayout.LabelField(L10n.Tr("Cancel")); }}

Tr(string[])

This function referes a po file like ja.po as an asset. Asmdef and [assembly: UnityEditor.Localization] is needed.
public static string[] Tr(string[] str_list)

Parameters

str_list

Returns

Type

Description

string[]Localized text.

Examples

using UnityEngine;using UnityEditor;// This is not an editor script.public class MyScript : MonoBehaviour {}[CustomEditor(typeof(MyScript))]public class MyScriptInspector : Editor{ MyScript m_Target = null; void OnEnable() { m_Target = target as MyScript; } public override void OnInspectorGUI() { base.OnInspectorGUI(); EditorGUILayout.LabelField(L10n.Tr("Cancel")); }}

Tr(string, string)

This function referes a po file like ja.po as an asset. Asmdef and [assembly: UnityEditor.Localization] is needed.
public static string Tr(string str, string groupName)

Parameters

Original text, basically English.

groupName

Returns

Type

Description

stringLocalized text.

Examples

using UnityEngine;using UnityEditor;// This is not an editor script.public class MyScript : MonoBehaviour {}[CustomEditor(typeof(MyScript))]public class MyScriptInspector : Editor{ MyScript m_Target = null; void OnEnable() { m_Target = target as MyScript; } public override void OnInspectorGUI() { base.OnInspectorGUI(); EditorGUILayout.LabelField(L10n.Tr("Cancel")); }}