forked from Unity-Technologies/UnityCsReference
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLocalizationDatabase.cs
More file actions
52 lines (46 loc) · 1.41 KB
/
Copy pathLocalizationDatabase.cs
File metadata and controls
52 lines (46 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine.Internal;
using System;
using System.Threading;
using System.Collections;
using System.Collections.Generic;
using System.Security;
using System.Security.Cryptography;
namespace UnityEditor
{
[ExcludeFromDocs]
public class L10n
{
private L10n() {}
public static string Tr(string str)
{
var new_str = LocalizationDatabase.GetLocalizedString(str);
return new_str;
}
public static string[] Tr(string[] str_list)
{
var res = new string[str_list.Length];
for (var i = 0; i < res.Length; ++i)
res[i] = Tr(str_list[i]);
return res;
}
public static string TrPath(string path)
{
string[] separatingChars = { "/" };
var result = new System.Text.StringBuilder(256);
var items = path.Split(separatingChars, System.StringSplitOptions.RemoveEmptyEntries);
for (var i = 0; i < items.Length; ++i)
{
result.Append(Tr(items[i]));
if (i < items.Length - 1)
result.Append("/");
}
return result.ToString();
}
}
}