# Tr

> This function referes a po file like ja.po as an asset. Asmdef and [assembly: UnityEditor.Localization] is needed.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.5/script-reference/unityeditor.md)
* **Assembly:** UnityEditor.CoreModule

## Tr(string)

This function referes a po file like ja.po as an asset. Asmdef and \[assembly: UnityEditor.Localization] is needed.

```csharp
public static string Tr(string str)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Original text, basically English.

### Returns

| Type                                                           | Description     |
| -------------------------------------------------------------- | --------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | Localized text. |

### Examples

```csharp
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.

```csharp
public static string[] Tr(string[] str_list)
```

### Parameters

**** (\[string\[]]\(https\://learn.microsoft.com/dotnet/api/system.string)):&#x20;

### Returns

| Type                                                               | Description     |
| ------------------------------------------------------------------ | --------------- |
| [string\[\]](https://learn.microsoft.com/dotnet/api/system.string) | Localized text. |

### Examples

```csharp
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.

```csharp
public static string Tr(string str, string groupName)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Original text, basically English.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)):&#x20;

### Returns

| Type                                                           | Description     |
| -------------------------------------------------------------- | --------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | Localized text. |

### Examples

```csharp
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"));
    }
}
```
