Skip to content

Support for English Inspector. #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: release/1.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Editor/AssmblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
using UnityEditor.Localization.Editor;

[assembly: Localization]
[assembly: UnityEditor.Localization]
14 changes: 8 additions & 6 deletions Editor/GUI/Inspectors/AngleLimitsPropertyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ namespace Inspector
{
public class AngleLimitPropertyInfo : PropertyInfo
{
bool isEngLang => !EditorPrefs.GetBool("UCSB_JLM");

public AngleLimitPropertyInfo(string newName, string labelText)
: base(newName, labelText)
{
minSlider = new FloatSlider("下限", 0f, -180f);
maxSlider = new FloatSlider("上限", 0f, 180f);
minSlider = new FloatSlider(isEngLang ? "Minimum Limit" : "下限", 0f, -180f);
maxSlider = new FloatSlider(isEngLang ? "Maximum Limit" : "上限", 0f, 180f);
}

public override void Show()
Expand Down Expand Up @@ -50,7 +52,7 @@ public override void Show()
GUILayout.Space(SubSpacing);
GUILayout.BeginHorizontal();

updateValuesTogether = GUILayout.Toggle(updateValuesTogether, "同時に変更");
updateValuesTogether = GUILayout.Toggle(updateValuesTogether, isEngLang ? "Sync Limit" : "同時に変更");
if (updateValuesTogether)
{
if (minChanged)
Expand All @@ -63,17 +65,17 @@ public override void Show()
}
}

if (GUILayout.Button("下限に統一"))
if (GUILayout.Button(isEngLang ? "Minimum" : "下限に統一"))
{
maxProperty.floatValue = -minProperty.floatValue;
}

if (GUILayout.Button("上限に統一"))
if (GUILayout.Button(isEngLang ? "Maximum" : "上限に統一"))
{
minProperty.floatValue = -maxProperty.floatValue;
}

if (GUILayout.Button("反転"))
if (GUILayout.Button(isEngLang ? "Flip" : "反転"))
{
var minValue = minProperty.floatValue;
minProperty.floatValue = -maxProperty.floatValue;
Expand Down
48 changes: 25 additions & 23 deletions Editor/GUI/Inspectors/SpringBoneInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace Unity.Animations.SpringBones
[CanEditMultipleObjects]
public class SpringBoneInspector : Editor
{
bool isEngLang => !EditorPrefs.GetBool("UCSB_JLM");

public override void OnInspectorGUI()
{
serializedObject.Update();
Expand All @@ -21,7 +23,7 @@ public override void OnInspectorGUI()

var bone = (SpringBone)target;

if (GUILayout.Button("基点を選択", SpringBoneGUIStyles.ButtonStyle))
if (GUILayout.Button(isEngLang ? "Select Base Point" : "基点を選択", SpringBoneGUIStyles.ButtonStyle))
{
Selection.objects = targets
.Select(item => ((SpringBone)item).pivotNode)
Expand All @@ -34,9 +36,9 @@ public override void OnInspectorGUI()
var managerCount = managers.Length;
for (int managerIndex = 0; managerIndex < managerCount; managerIndex++)
{
EditorGUILayout.ObjectField("マネージャー", managers[managerIndex], typeof(SpringManager), true);
EditorGUILayout.ObjectField(isEngLang ? "Manager" : "マネージャー", managers[managerIndex], typeof(SpringManager), true);
}
var newEnabled = EditorGUILayout.Toggle("有効", bone.enabled);
var newEnabled = EditorGUILayout.Toggle(isEngLang ? "Enabled" : "有効", bone.enabled);
GUILayout.EndVertical();

if (newEnabled != bone.enabled)
Expand Down Expand Up @@ -68,7 +70,7 @@ public override void OnInspectorGUI()
RenderAngleLimitVisualization();
}

showOriginalInspector = EditorGUILayout.Toggle("標準インスペクター表示", showOriginalInspector);
showOriginalInspector = EditorGUILayout.Toggle(isEngLang ? "Default Inspector View" : "標準インスペクター表示", showOriginalInspector);
GUILayout.Space(Spacing);
if (showOriginalInspector)
{
Expand Down Expand Up @@ -134,8 +136,8 @@ private void RenderAngleLimitVisualization()

GUILayout.BeginVertical("box");
GUILayout.BeginHorizontal();
GUILayout.Label("Y 軸角度制限");
GUILayout.Label("Z 軸角度制限");
GUILayout.Label(isEngLang ? "Y Axis Angle Limit" : "Y 軸角度制限");
GUILayout.Label(isEngLang ? "Z Axis Angle Limit" : "Z 軸角度制限");
GUILayout.EndHorizontal();
EditorGUILayout.Space();
const float DefaultRectHeight = 100f;
Expand Down Expand Up @@ -230,35 +232,35 @@ private void OnEnable()
InitializeData();

var forceProperties = new PropertyInfo[] {
new PropertyInfo("stiffnessForce", "硬さ"),
new PropertyInfo("dragForce", "空気抵抗"),
new PropertyInfo("springForce", "重力"),
new PropertyInfo("windInfluence", "風の影響値")
new PropertyInfo("stiffnessForce", isEngLang ? "Stiffness" : "硬さ"),
new PropertyInfo("dragForce", isEngLang ? "Drag" : "空気抵抗"),
new PropertyInfo("springForce", isEngLang ? "Gravity" : "重力"),
new PropertyInfo("windInfluence", isEngLang ? "Wind Influence" : "風の影響値")
};

var angleLimitProperties = new PropertyInfo[] {
new PropertyInfo("pivotNode", "基点"),
new PropertyInfo("angularStiffness", "回転の硬さ"),
new AngleLimitPropertyInfo("yAngleLimits", "Y 軸角度制限"),
new AngleLimitPropertyInfo("zAngleLimits", "Z 軸角度制限")
new PropertyInfo("pivotNode", isEngLang ? "Base Pivot" : "基点"),
new PropertyInfo("angularStiffness", isEngLang ? "Angular Stiffness" : "回転の硬さ"),
new AngleLimitPropertyInfo("yAngleLimits", isEngLang ? "Y Axis Angle Limit" : "Y 軸角度制限"),
new AngleLimitPropertyInfo("zAngleLimits", isEngLang ? "Z Axis Angle Limit" : "Z 軸角度制限")
};

var lengthLimitProperties = new PropertyInfo[] {
new PropertyInfo("lengthLimitTargets", "ターゲット")
new PropertyInfo("lengthLimitTargets", isEngLang ? "Targets" : "ターゲット")
};

var collisionProperties = new PropertyInfo[] {
new PropertyInfo("radius", "半径"),
new PropertyInfo("sphereColliders", "球体"),
new PropertyInfo("capsuleColliders", "カプセル"),
new PropertyInfo("panelColliders", "板")
new PropertyInfo("radius", isEngLang ? "Radius" : "半径"),
new PropertyInfo("sphereColliders", isEngLang ? "Sphere Colliders" : "球体"),
new PropertyInfo("capsuleColliders", isEngLang ? "Capsule Colliders" : "カプセル"),
new PropertyInfo("panelColliders", isEngLang ? "Panel Colliders" : "板")
};

propertySets = new PropertySet[] {
new PropertySet("力", forceProperties),
new PropertySet("角度制限", angleLimitProperties),
new PropertySet("距離制限", lengthLimitProperties),
new PropertySet("当たり判定", collisionProperties),
new PropertySet(isEngLang ? "Force" : "力", forceProperties),
new PropertySet(isEngLang ? "Angle Limit" : "角度制限", angleLimitProperties),
new PropertySet(isEngLang ? "Length Limit" : "距離制限", lengthLimitProperties),
new PropertySet(isEngLang ? "Collision" : "当たり判定", collisionProperties),
};

foreach (var set in propertySets)
Expand Down
4 changes: 3 additions & 1 deletion Editor/GUI/Inspectors/SpringBonePivotInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ namespace Unity.Animations.SpringBones
[CanEditMultipleObjects]
public class SpringBonePivotInspector : Editor
{
bool isEngLang => !EditorPrefs.GetBool("UCSB_JLM");

public override void OnInspectorGUI()
{
InitializeData();

if (GUILayout.Button("ボーンを選択", SpringBoneGUIStyles.ButtonStyle))
if (GUILayout.Button(isEngLang ? "Select bone" : "ボーンを選択", SpringBoneGUIStyles.ButtonStyle))
{
Selection.objects = bones.Select(bone => bone.gameObject).ToArray();
}
Expand Down
8 changes: 5 additions & 3 deletions Editor/GUI/Inspectors/SpringManagerInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ namespace Unity.Animations.SpringBones
[CanEditMultipleObjects]
public class SpringManagerInspector : Editor
{
bool isEngLang => !EditorPrefs.GetBool("UCSB_JLM");

public class InspectorButton<T>
{
public InspectorButton(string label, System.Action<T> onPress)
Expand All @@ -35,9 +37,9 @@ public override void OnInspectorGUI()
if (actionButtons == null || actionButtons.Length == 0)
{
actionButtons = new[] {
new SpringManagerButton("窓を表示", ShowSpringWindow),
new SpringManagerButton("SpringBoneを全て選択", SelectAllBones),
new SpringManagerButton("SpringBoneリストを更新", UpdateBoneList)
new SpringManagerButton(isEngLang ? "Display Spring Window" : "窓を表示", ShowSpringWindow),
new SpringManagerButton(isEngLang ? "Select All SpringBone" : "SpringBoneを全て選択", SelectAllBones),
new SpringManagerButton(isEngLang ? "Update SpringBone List" : "SpringBoneリストを更新", UpdateBoneList)
};
}

Expand Down
32 changes: 16 additions & 16 deletions Editor/GUI/Windows/LoadSpringBoneSetupWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ public class LoadSpringBoneSetupWindow : EditorWindow
{
private static class Styles
{
public static readonly string editorWindowTitle = Localization.Tr("Load spring bone setup");
public static readonly string stopPlayModeMessage = Localization.Tr("Do not setup in Play Mode");
public static readonly string selectObjectRootsMessage = Localization.Tr("Select parent object of the spring bone");
public static readonly string resultFormat = Localization.Tr("Set up complete:{0}\nNumber of bones: {1} Number of colliders: {2}");
public static readonly string csvFile = Localization.Tr("CSV File");
public static readonly string textFile = Localization.Tr("Text File");
public static readonly string loadSpringBoneSetup = Localization.Tr("Load spring bone setup");
public static readonly string errorFormat = Localization.Tr(
public static readonly string editorWindowTitle = L10n.Tr("Load spring bone setup");
public static readonly string stopPlayModeMessage = L10n.Tr("Do not setup in Play Mode");
public static readonly string selectObjectRootsMessage = L10n.Tr("Select parent object of the spring bone");
public static readonly string resultFormat = L10n.Tr("Set up complete:{0}\nNumber of bones: {1} Number of colliders: {2}");
public static readonly string csvFile = L10n.Tr("CSV File");
public static readonly string textFile = L10n.Tr("Text File");
public static readonly string loadSpringBoneSetup = L10n.Tr("Load spring bone setup");
public static readonly string errorFormat = L10n.Tr(
"SpringBone setup failed.\n"
+ "Souce data may contain errors,\n"
+ "or the data don't match the character.\n"
Expand All @@ -26,16 +26,16 @@ private static class Styles
+ "\n"
+ "Path: {1}");

public static readonly string springBoneSetup = Localization.Tr("SpringBone Setup");
public static readonly string springBoneSetupFailedFormat = Localization.Tr("SpringBone Setup failed:{0}\nPath:{1}");
public static readonly string labelSpringBoneRoot = Localization.Tr("SpringBone Root");
public static readonly string springBoneSetup = L10n.Tr("SpringBone Setup");
public static readonly string springBoneSetupFailedFormat = L10n.Tr("SpringBone Setup failed:{0}\nPath:{1}");
public static readonly string labelSpringBoneRoot = L10n.Tr("SpringBone Root");

public static readonly GUIContent labelLoadingConfig = new GUIContent(Localization.Tr("Loading Configuration"));
public static readonly GUIContent labelSpringBone = new GUIContent(Localization.Tr("SpringBone"));
public static readonly GUIContent labelCollider = new GUIContent(Localization.Tr("Collider"));
public static readonly GUIContent labelLoadingConfig = new GUIContent(L10n.Tr("Loading Configuration"));
public static readonly GUIContent labelSpringBone = new GUIContent(L10n.Tr("SpringBone"));
public static readonly GUIContent labelCollider = new GUIContent(L10n.Tr("Collider"));

public static readonly GUIContent labelSelectFromRoot = new GUIContent(Localization.Tr("Get root from selection"));
public static readonly GUIContent labelSetupLoadCSV = new GUIContent(Localization.Tr("Set up from CSV file"));
public static readonly GUIContent labelSelectFromRoot = new GUIContent(L10n.Tr("Get root from selection"));
public static readonly GUIContent labelSetupLoadCSV = new GUIContent(L10n.Tr("Set up from CSV file"));
}

public static void ShowWindow()
Expand Down
22 changes: 11 additions & 11 deletions Editor/GUI/Windows/MirrorSpringBoneWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ public class MirrorSpringBoneWindow : EditorWindow
{
private static class Styles
{
public static readonly string editorWindowTitle = Localization.Tr("SpringBone Mirror");
public static readonly string editorWindowTitle = L10n.Tr("SpringBone Mirror");

public static readonly GUIContent labelDoMirror = new GUIContent(Localization.Tr("Do Mirror"));
public static readonly GUIContent labelGetFromSelection = new GUIContent(Localization.Tr("Get from selection"));

public static readonly GUIContent labelSelectAllCopyDst = new GUIContent(Localization.Tr("Select all copy destination"));
public static readonly GUIContent labelSelectAllCopySrc = new GUIContent(Localization.Tr("Select all copy source"));
public static readonly GUIContent labelSelectAll = new GUIContent(Localization.Tr("Select All"));
public static readonly GUIContent labelConfigXbZero = new GUIContent(Localization.Tr("Set bone where X > 0"));
public static readonly GUIContent labelConfigXlZero = new GUIContent(Localization.Tr("Set bone where X < 0"));
public static readonly GUIContent labelSrc = new GUIContent(Localization.Tr("Source"));
public static readonly GUIContent labelDst = new GUIContent(Localization.Tr("→ Destination"));
public static readonly GUIContent labelDoMirror = new GUIContent(L10n.Tr("Do Mirror"));
public static readonly GUIContent labelGetFromSelection = new GUIContent(L10n.Tr("Get from selection"));

public static readonly GUIContent labelSelectAllCopyDst = new GUIContent(L10n.Tr("Select all copy destination"));
public static readonly GUIContent labelSelectAllCopySrc = new GUIContent(L10n.Tr("Select all copy source"));
public static readonly GUIContent labelSelectAll = new GUIContent(L10n.Tr("Select All"));
public static readonly GUIContent labelConfigXbZero = new GUIContent(L10n.Tr("Set bone where X > 0"));
public static readonly GUIContent labelConfigXlZero = new GUIContent(L10n.Tr("Set bone where X < 0"));
public static readonly GUIContent labelSrc = new GUIContent(L10n.Tr("Source"));
public static readonly GUIContent labelDst = new GUIContent(L10n.Tr("→ Destination"));
}

public static void ShowWindow()
Expand Down
26 changes: 13 additions & 13 deletions Editor/GUI/Windows/SaveSpringBoneSetupWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ public class SaveSpringBoneSetupWindow : EditorWindow
{
private static class Styles
{
public static readonly string editorWindowTitle = Localization.Tr("Save SpringBone Setup");
public static readonly string textSpringBoneRoot = Localization.Tr("SpringBone Root");
public static readonly string textSaveSpringBoneSetup = Localization.Tr("Save SpringBone Setup");
public static readonly string textSaveSpringBone = Localization.Tr("Save SpringBone");
public static readonly string textFileOverwriteFormat = Localization.Tr("File already exists. Overwrite?:{0}\n\n");
public static readonly string textOverwrite = Localization.Tr("Overwrite");
public static readonly string textSavedFormat = Localization.Tr("Saved.: {0}");
public static readonly string textCancel = Localization.Tr("Cancel");
public static readonly string editorWindowTitle = L10n.Tr("Save SpringBone Setup");
public static readonly string textSpringBoneRoot = L10n.Tr("SpringBone Root");
public static readonly string textSaveSpringBoneSetup = L10n.Tr("Save SpringBone Setup");
public static readonly string textSaveSpringBone = L10n.Tr("Save SpringBone");
public static readonly string textFileOverwriteFormat = L10n.Tr("File already exists. Overwrite?:{0}\n\n");
public static readonly string textOverwrite = L10n.Tr("Overwrite");
public static readonly string textSavedFormat = L10n.Tr("Saved.: {0}");
public static readonly string textCancel = L10n.Tr("Cancel");

public static readonly GUIContent labelExportSetting = new GUIContent(Localization.Tr("Export Setting"));
public static readonly GUIContent labelSpringBone = new GUIContent(Localization.Tr("SpringBone"));
public static readonly GUIContent labelCollider = new GUIContent(Localization.Tr("Collider"));
public static readonly GUIContent labelGetRootFromSelection = new GUIContent(Localization.Tr("Get root from selection"));
public static readonly GUIContent labelSaveToCSV = new GUIContent(Localization.Tr("Save to CSV"));
public static readonly GUIContent labelExportSetting = new GUIContent(L10n.Tr("Export Setting"));
public static readonly GUIContent labelSpringBone = new GUIContent(L10n.Tr("SpringBone"));
public static readonly GUIContent labelCollider = new GUIContent(L10n.Tr("Collider"));
public static readonly GUIContent labelGetRootFromSelection = new GUIContent(L10n.Tr("Get root from selection"));
public static readonly GUIContent labelSaveToCSV = new GUIContent(L10n.Tr("Save to CSV"));
}

public static void ShowWindow()
Expand Down
Loading