com.xmobitea.changx.mini-localization 1.5.2 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 72a99ea4cc194d6c813af2d259b7308c
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -1,6 +1,5 @@
1
1
  namespace XmobiTea.MiniLocalization.Editor
2
2
  {
3
- using System.IO;
4
3
  using UnityEditor;
5
4
 
6
5
  using UnityEngine;
@@ -35,32 +34,5 @@ namespace XmobiTea.MiniLocalization.Editor
35
34
  localizationComponentBase.OnUpdateText();
36
35
  }
37
36
  }
38
-
39
- [MenuItem("XmobiTea Tools/Localization/Open Settings")]
40
- private static void OpenSettings()
41
- {
42
- var localizationSettings = GetSettings();
43
-
44
- Selection.SetActiveObjectWithContext(localizationSettings, localizationSettings);
45
- }
46
-
47
- public static LocalizationSettings GetSettings()
48
- {
49
- var localizationSettings = Resources.Load<LocalizationSettings>(LocalizationSettings.ResourcesPath);
50
- if (localizationSettings == null)
51
- {
52
- localizationSettings = ScriptableObject.CreateInstance<LocalizationSettings>();
53
-
54
- var dirPath = Application.dataPath + "/Resources";
55
- if (!Directory.Exists(dirPath)) Directory.CreateDirectory(dirPath);
56
-
57
- var path = "Assets/Resources/" + LocalizationSettings.ResourcesPath + ".asset";
58
- AssetDatabase.CreateAsset(localizationSettings, path);
59
-
60
- Debug.Log("[Localization] Localization Settings create success at path " + path);
61
- }
62
-
63
- return localizationSettings;
64
- }
65
37
  }
66
38
  }
@@ -27,7 +27,7 @@
27
27
  public static void ShowWindow()
28
28
  {
29
29
  //Show existing window instance. If one doesn't exist, make one.
30
- EditorWindow.GetWindow(typeof(LocalizationComponentWindowsEditor));
30
+ EditorWindow.GetWindow<LocalizationComponentWindowsEditor>();
31
31
  }
32
32
 
33
33
  private void OnEnable()
@@ -113,7 +113,7 @@ namespace XmobiTea.MiniLocalization.Editor
113
113
  arguments = arguments.Replace("\\", "/");
114
114
  }
115
115
 
116
- Debug.Log("Run CommandLine " + processPath + " " + arguments);
116
+ Debug.Log("[Localization] Run CommandLine " + processPath + " " + arguments);
117
117
 
118
118
  var process = new System.Diagnostics.Process
119
119
  {
@@ -134,7 +134,7 @@ namespace XmobiTea.MiniLocalization.Editor
134
134
  process.WaitForExit(60000);
135
135
 
136
136
  if (!string.IsNullOrEmpty(output))
137
- Debug.Log("CommandLine with output " + output);
137
+ Debug.Log("[Localization] CommandLine with output " + output);
138
138
 
139
139
  if (!string.IsNullOrEmpty(error))
140
140
  Debug.LogError("Error while running CommandLine " + error);
@@ -1,7 +1,6 @@
1
1
  namespace XmobiTea.MiniLocalization.Editor
2
2
  {
3
3
  #if UNITY_USING_TMPRO
4
- using System.IO;
5
4
  using UnityEditor;
6
5
 
7
6
  using UnityEngine;
@@ -36,33 +35,6 @@ namespace XmobiTea.MiniLocalization.Editor
36
35
  localizationComponentBase.OnUpdateText();
37
36
  }
38
37
  }
39
-
40
- [MenuItem("XmobiTea Tools/Localization/Open Settings")]
41
- private static void OpenSettings()
42
- {
43
- var localizationSettings = GetSettings();
44
-
45
- Selection.SetActiveObjectWithContext(localizationSettings, localizationSettings);
46
- }
47
-
48
- public static LocalizationSettings GetSettings()
49
- {
50
- var localizationSettings = Resources.Load<LocalizationSettings>(LocalizationSettings.ResourcesPath);
51
- if (localizationSettings == null)
52
- {
53
- localizationSettings = ScriptableObject.CreateInstance<LocalizationSettings>();
54
-
55
- var dirPath = Application.dataPath + "/Resources";
56
- if (!Directory.Exists(dirPath)) Directory.CreateDirectory(dirPath);
57
-
58
- var path = "Assets/Resources/" + LocalizationSettings.ResourcesPath + ".asset";
59
- AssetDatabase.CreateAsset(localizationSettings, path);
60
-
61
- Debug.Log("[Localization] Localization Settings create success at path " + path);
62
- }
63
-
64
- return localizationSettings;
65
- }
66
38
  }
67
39
  #endif
68
40
  }
package/README.md CHANGED
@@ -6,16 +6,16 @@ Scene-based Unity localization package. Runtime loads XML into an active key-val
6
6
 
7
7
  Open the smallest file that answers the task.
8
8
 
9
- | Need | Use |
10
- | --- | --- |
11
- | Choose API or generate common code | `AI_USAGE.md` |
12
- | Switch runtime language, read current language, build language selector | `AI_SWITCH_LANGUAGE.md` |
13
- | Bind fixed UI text or use the bulk localization window | `AI_BIND_UI_TEXT.md` |
14
- | Add, rename, or remove a localization key | `AI_ADD_LOCALIZATION_KEY.md` |
15
- | Import translations from CSV or Google Sheets | `AI_IMPORT_TRANSLATIONS.md` |
16
- | Setup router | `AI_SETUP.md` |
17
- | Scene manager setup and bootstrap | `AI_SETUP_LOCALIZATION_MANAGER.md` |
18
- | Settings, XML, CSV/Google import, constants | `AI_SETUP_LOCALIZATION_SETTINGS.md` |
9
+ | Need | Use |
10
+ | --- | --- |
11
+ | Choose API or generate common code | `AI_USAGE.md` |
12
+ | Switch runtime language, read current language, build language selector | `AI_SWITCH_LANGUAGE.md` |
13
+ | Bind fixed UI text or use the bulk localization window | `AI_BIND_UI_TEXT.md` |
14
+ | Add, rename, or remove a localization key | `AI_ADD_LOCALIZATION_KEY.md` |
15
+ | Import translations from CSV or Google Sheets | `AI_IMPORT_TRANSLATIONS.md` |
16
+ | Setup router | `AI_SETUP.md` |
17
+ | Scene manager setup and bootstrap | `AI_SETUP_LOCALIZATION_MANAGER.md` |
18
+ | Settings, XML, CSV/Google import, constants | `AI_SETUP_LOCALIZATION_SETTINGS.md` |
19
19
  | Exact signatures, fields, XML shape, editor menus | `AI_API_REFERENCE.md` |
20
20
  | Lifecycle, source precedence, async refreshes, edge cases | `AI_BEHAVIOR.md` |
21
21
  | Package guardrails for AI agents | `AGENTS.md` |
@@ -69,16 +69,16 @@ Default settings asset path created by `Open Settings`:
69
69
  Assets/Resources/XmobiTea LocalizationSettings.asset
70
70
  ```
71
71
 
72
- Runtime lookup uses `Resources.Load<LocalizationSettings>("XmobiTea LocalizationSettings")`.
73
-
74
- Manager setup: `AI_SETUP_LOCALIZATION_MANAGER.md`. Settings/import setup: `AI_SETUP_LOCALIZATION_SETTINGS.md`.
75
-
76
- Common task guides:
77
-
78
- - switch runtime language: `AI_SWITCH_LANGUAGE.md`;
79
- - bind fixed UI text: `AI_BIND_UI_TEXT.md`;
80
- - add or rename keys: `AI_ADD_LOCALIZATION_KEY.md`;
81
- - import CSV or Google Sheets: `AI_IMPORT_TRANSLATIONS.md`.
72
+ Runtime lookup uses `Resources.Load<LocalizationSettings>("XmobiTea LocalizationSettings")`.
73
+
74
+ Manager setup: `AI_SETUP_LOCALIZATION_MANAGER.md`. Settings/import setup: `AI_SETUP_LOCALIZATION_SETTINGS.md`.
75
+
76
+ Common task guides:
77
+
78
+ - switch runtime language: `AI_SWITCH_LANGUAGE.md`;
79
+ - bind fixed UI text: `AI_BIND_UI_TEXT.md`;
80
+ - add or rename keys: `AI_ADD_LOCALIZATION_KEY.md`;
81
+ - import CSV or Google Sheets: `AI_IMPORT_TRANSLATIONS.md`.
82
82
 
83
83
  ## Runtime Usage
84
84
 
@@ -124,9 +124,9 @@ Menu:
124
124
  XmobiTea Tools/Localization/Fetch Localization
125
125
  ```
126
126
 
127
- CSV-only import does not need `Worksheet Key`. Google Sheets import does.
128
-
129
- After `Fetch Localization`, any existing `Local-LocalizationFile/<Language>.xml` output is copied into the assigned local XML assets. Clear stale local output files before online-only fetches if local XML should not change.
127
+ CSV-only import does not need `Worksheet Key`. Google Sheets import does.
128
+
129
+ After `Fetch Localization`, any existing `Local-LocalizationFile/<Language>.xml` output is copied into the assigned local XML assets. Clear stale local output files before online-only fetches if local XML should not change.
130
130
 
131
131
  ## XML Shape
132
132
 
@@ -148,7 +148,7 @@ Include the XML declaration; the runtime parser reads the root at `ChildNodes.It
148
148
  | `XmobiTea Tools/Localization/Open Settings` | create/select settings asset |
149
149
  | `XmobiTea Tools/Localization/Show LocalizationComponentWindows` | bulk add/remove text binding components |
150
150
  | `XmobiTea Tools/Localization/Generate LocalizationConstantId.cs` | generate constants from first language XML |
151
- | `XmobiTea Tools/Localization/Fetch Localization` | import XML from CSV/Google source, copy existing local output files into assigned XML assets, then regenerate constants |
151
+ | `XmobiTea Tools/Localization/Fetch Localization` | import XML from CSV/Google source, copy existing local output files into assigned XML assets, then regenerate constants |
152
152
 
153
153
  ## Sample
154
154
 
@@ -170,7 +170,7 @@ namespace XmobiTea.MiniLocalization
170
170
  {
171
171
  if (success)
172
172
  {
173
- Debug.Log("Load xml from online url success");
173
+ Debug.Log("[Localization] Load xml from online url success");
174
174
 
175
175
  // Online localization replaces the active dictionary with the downloaded source.
176
176
  if (instance._currentLanguage == thisLanguage)
@@ -205,12 +205,12 @@ namespace XmobiTea.MiniLocalization
205
205
  }
206
206
  else
207
207
  {
208
- Debug.Log("Load xml from online url success, but the current language does not match");
208
+ Debug.Log("[Localization] Load xml from online url success, but the current language does not match");
209
209
  }
210
210
  }
211
211
  else
212
212
  {
213
- Debug.LogError("Failed to load xml from online url");
213
+ Debug.LogError("[Localization] Failed to load xml from online url");
214
214
  }
215
215
  }));
216
216
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.xmobitea.changx.mini-localization",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "displayName": "XmobiTea Localization",
5
5
  "description": "XML-backed localization manager for Unity UI, TextMesh Pro, CSV import, Google Sheets import, and generated key constants.",
6
6
  "unity": "2022.3",