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.
package/AGENTS.md CHANGED
@@ -6,16 +6,16 @@ Scope: everything inside `Assets/XmobiTea Localization`.
6
6
 
7
7
  Choose by current need. Open the smallest file that answers it.
8
8
 
9
- | Need | Use |
10
- | --- | --- |
11
- | Choose localization API or generate common runtime 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 object, singleton timing, bootstrap, persistent manager | `AI_SETUP_LOCALIZATION_MANAGER.md` |
18
- | Settings asset, language items, XML, CSV/Google import, constants | `AI_SETUP_LOCALIZATION_SETTINGS.md` |
9
+ | Need | Use |
10
+ | --- | --- |
11
+ | Choose localization API or generate common runtime 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 object, singleton timing, bootstrap, persistent manager | `AI_SETUP_LOCALIZATION_MANAGER.md` |
18
+ | Settings asset, language items, XML, CSV/Google import, constants | `AI_SETUP_LOCALIZATION_SETTINGS.md` |
19
19
  | Exact signatures, return values, serialized fields, XML shape, editor menus | `AI_API_REFERENCE.md` |
20
20
  | Lifecycle, source precedence, async refreshes, fetch edge cases | `AI_BEHAVIOR.md` |
21
21
  | Package summary for humans | `README.md` |
@@ -42,11 +42,11 @@ Choose by current need. Open the smallest file that answers it.
42
42
  - If one language configures both Addressables XML and online XML, both async loads run and the callback that finishes later mutates the dictionary last.
43
43
  - `OnUpdateText` can fire more than once for one `ChooseLanguage(...)` call.
44
44
  - Runtime never reads CSV or Google Sheets.
45
- - `fetchType` is editor-only: `None`, `FromGoogleSheets`, `FromCsv`.
46
- - `worksheetKey` is required only when either fetch type is `FromGoogleSheets`.
47
- - Empty Google sheet-name fields are sent to the fetch executable as `local` or `online`; explicit sheet names must avoid spaces.
48
- - CSV rows must include `Key` plus one cell per configured language.
49
- - After any fetch run, existing `Local-LocalizationFile/<Language>.xml` files are copied into assigned local XML assets, even during online-only fetches.
45
+ - `fetchType` is editor-only: `None`, `FromGoogleSheets`, `FromCsv`.
46
+ - `worksheetKey` is required only when either fetch type is `FromGoogleSheets`.
47
+ - Empty Google sheet-name fields are sent to the fetch executable as `local` or `online`; explicit sheet names must avoid spaces.
48
+ - CSV rows must include `Key` plus one cell per configured language.
49
+ - After any fetch run, existing `Local-LocalizationFile/<Language>.xml` files are copied into assigned local XML assets, even during online-only fetches.
50
50
  - Generated constants come from editor tooling, not runtime discovery.
51
51
  - Generated `LocalizationConstantId` members are `public static readonly string`.
52
52
  - The generator reads keys from the first configured language item's local XML.
@@ -104,14 +104,14 @@ If changing resource paths, manager lifecycle, XML parsing, source precedence, g
104
104
  - `Editor/LocalizationManagerEditor.cs`
105
105
  - `Editor/LocalizationSettingsEditor.cs`
106
106
  - `Editor/LocalizationKeyDrawer.cs`
107
- - `AI_USAGE.md`
108
- - `AI_SWITCH_LANGUAGE.md`
109
- - `AI_BIND_UI_TEXT.md`
110
- - `AI_ADD_LOCALIZATION_KEY.md`
111
- - `AI_IMPORT_TRANSLATIONS.md`
112
- - `AI_SETUP.md`
113
- - `AI_SETUP_LOCALIZATION_MANAGER.md`
114
- - `AI_SETUP_LOCALIZATION_SETTINGS.md`
107
+ - `AI_USAGE.md`
108
+ - `AI_SWITCH_LANGUAGE.md`
109
+ - `AI_BIND_UI_TEXT.md`
110
+ - `AI_ADD_LOCALIZATION_KEY.md`
111
+ - `AI_IMPORT_TRANSLATIONS.md`
112
+ - `AI_SETUP.md`
113
+ - `AI_SETUP_LOCALIZATION_MANAGER.md`
114
+ - `AI_SETUP_LOCALIZATION_SETTINGS.md`
115
115
  - `AI_API_REFERENCE.md`
116
116
  - `AI_BEHAVIOR.md`
117
117
  - `README.md`
@@ -1,78 +1,78 @@
1
- # AI Add Localization Key
2
-
3
- Use this when a task adds, renames, or removes a localization key, or when `LocalizationConstantId` is missing or stale.
4
-
5
- ## Source Of Truth
6
-
7
- Choose one source of truth and update that source first:
8
-
9
- - CSV or Google Sheets when the project imports translations through `Fetch Localization`;
10
- - local XML files when the project edits runtime XML directly.
11
-
12
- The first configured language item's local XML must contain the full key set because constant generation reads that file only.
13
-
14
- ## Add A Key
15
-
16
- Checklist:
17
-
18
- - add the key to the source of truth;
19
- - if editing XML directly, add the key to every runtime language XML;
20
- - keep XML in the runtime parser shape;
21
- - regenerate constants;
22
- - update `LocalizationComponent`, `TMP_LocalizationComponent`, and scripts to use the new key.
23
-
24
- Minimal XML entry:
25
-
26
- ```xml
27
- <key name='Home_Title'>Home</key>
28
- ```
29
-
30
- ## Rename A Key
31
-
32
- Checklist:
33
-
34
- - rename the key in the source of truth;
35
- - update every affected XML or translation row;
36
- - regenerate constants;
37
- - update all component keys and script references;
38
- - remove old key usages so UI does not fall back to the old raw key string.
39
-
40
- ## Remove A Key
41
-
42
- Checklist:
43
-
44
- - delete the key from the source of truth;
45
- - regenerate constants;
46
- - remove or replace every component and code reference to that key.
47
-
48
- ## Regenerate Constants
49
-
50
- Run:
51
-
52
- ```text
53
- XmobiTea Tools/Localization/Generate LocalizationConstantId.cs
54
- ```
55
-
56
- Generated file:
57
-
58
- ```text
59
- Assets/XmobiTea-constant/Scripts/LocalizationConstantId.cs
60
- ```
61
-
62
- Use raw strings temporarily when constants are intentionally not regenerated yet.
63
-
64
- ## Verify
65
-
66
- Checklist:
67
-
68
- - run `ChooseLanguage(...)`;
69
- - confirm `LocalizationManager.GetText(key)` returns translated text instead of the raw key;
70
- - confirm fixed UI text refreshes;
71
- - confirm the generated constant exists when code uses `LocalizationConstantId.*`.
72
-
73
- ## Hard No
74
-
75
- - Do not add a key only to a non-first language XML and expect a constant to generate.
76
- - Do not rename keys in code only.
77
- - Do not leave stale component keys after a rename or delete.
78
- - Do not assume runtime discovers new constants automatically.
1
+ # AI Add Localization Key
2
+
3
+ Use this when a task adds, renames, or removes a localization key, or when `LocalizationConstantId` is missing or stale.
4
+
5
+ ## Source Of Truth
6
+
7
+ Choose one source of truth and update that source first:
8
+
9
+ - CSV or Google Sheets when the project imports translations through `Fetch Localization`;
10
+ - local XML files when the project edits runtime XML directly.
11
+
12
+ The first configured language item's local XML must contain the full key set because constant generation reads that file only.
13
+
14
+ ## Add A Key
15
+
16
+ Checklist:
17
+
18
+ - add the key to the source of truth;
19
+ - if editing XML directly, add the key to every runtime language XML;
20
+ - keep XML in the runtime parser shape;
21
+ - regenerate constants;
22
+ - update `LocalizationComponent`, `TMP_LocalizationComponent`, and scripts to use the new key.
23
+
24
+ Minimal XML entry:
25
+
26
+ ```xml
27
+ <key name='Home_Title'>Home</key>
28
+ ```
29
+
30
+ ## Rename A Key
31
+
32
+ Checklist:
33
+
34
+ - rename the key in the source of truth;
35
+ - update every affected XML or translation row;
36
+ - regenerate constants;
37
+ - update all component keys and script references;
38
+ - remove old key usages so UI does not fall back to the old raw key string.
39
+
40
+ ## Remove A Key
41
+
42
+ Checklist:
43
+
44
+ - delete the key from the source of truth;
45
+ - regenerate constants;
46
+ - remove or replace every component and code reference to that key.
47
+
48
+ ## Regenerate Constants
49
+
50
+ Run:
51
+
52
+ ```text
53
+ XmobiTea Tools/Localization/Generate LocalizationConstantId.cs
54
+ ```
55
+
56
+ Generated file:
57
+
58
+ ```text
59
+ Assets/XmobiTea-constant/Scripts/LocalizationConstantId.cs
60
+ ```
61
+
62
+ Use raw strings temporarily when constants are intentionally not regenerated yet.
63
+
64
+ ## Verify
65
+
66
+ Checklist:
67
+
68
+ - run `ChooseLanguage(...)`;
69
+ - confirm `LocalizationManager.GetText(key)` returns translated text instead of the raw key;
70
+ - confirm fixed UI text refreshes;
71
+ - confirm the generated constant exists when code uses `LocalizationConstantId.*`.
72
+
73
+ ## Hard No
74
+
75
+ - Do not add a key only to a non-first language XML and expect a constant to generate.
76
+ - Do not rename keys in code only.
77
+ - Do not leave stale component keys after a rename or delete.
78
+ - Do not assume runtime discovers new constants automatically.
@@ -1,7 +1,7 @@
1
- fileFormatVersion: 2
2
- guid: 9c3b91e223da4115ba42193b18265bc0
3
- TextScriptImporter:
4
- externalObjects: {}
5
- userData:
6
- assetBundleName:
7
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: 9c3b91e223da4115ba42193b18265bc0
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -24,7 +24,7 @@ using XmobiTea.MiniLocalization.Core;
24
24
  | `public static LocalizationLanguageItem GetCurrentLanguage()` | active item or `null` | inspect selected language | logs error and returns `null` |
25
25
  | `public static LocalizationLanguageItem[] GetAllLanguageItem()` | configured items or `null` | show language choices | logs error and returns `null` |
26
26
  | `public static string GetTextWithoutBOM(TextAsset textAsset)` | text content | helper for XML `TextAsset` parsing | no manager needed; `textAsset` must be non-null |
27
- | `public static Action OnUpdateText` | static `Action` field | refresh custom state after dictionary updates | no automatic guard |
27
+ | `public static Action OnUpdateText` | static `Action` field | refresh custom state after dictionary updates | no automatic guard |
28
28
 
29
29
  `ChooseLanguage(...)` returns `false` when the requested `SystemLanguage` is not configured.
30
30
 
@@ -119,14 +119,14 @@ Use this checklist when generating setup instructions:
119
119
  | `xmlRef` | optional Addressables runtime XML | shown only when Addressables is installed |
120
120
  | `onlineLocalizationUrl` | optional online runtime XML | URL must return parser-compatible XML |
121
121
  | `fetchTypeLocalLocalization` | editor import | `None`, `FromGoogleSheets`, or `FromCsv` |
122
- | `sheetNameFetchLocalLocalization` | local `FromGoogleSheets` | Google Sheet tab name; empty is sent to the fetch executable as `local`; avoid spaces |
122
+ | `sheetNameFetchLocalLocalization` | local `FromGoogleSheets` | Google Sheet tab name; empty is sent to the fetch executable as `local`; avoid spaces |
123
123
  | `csvFetchLocalLocalization` | local `FromCsv` | CSV `TextAsset` imported into Unity |
124
124
  | `fetchTypeOnlineLocalization` | editor import | `None`, `FromGoogleSheets`, or `FromCsv` |
125
- | `sheetNameFetchOnlineLocalization` | online `FromGoogleSheets` | Google Sheet tab name; empty is sent to the fetch executable as `online`; avoid spaces |
125
+ | `sheetNameFetchOnlineLocalization` | online `FromGoogleSheets` | Google Sheet tab name; empty is sent to the fetch executable as `online`; avoid spaces |
126
126
  | `csvFetchOnlineLocalization` | online `FromCsv` | CSV `TextAsset` imported into Unity |
127
127
  | `worksheetKey` | any `FromGoogleSheets` fetch | non-empty Google spreadsheet id/key |
128
128
 
129
- After any `Fetch Localization` run, the editor copies each existing `Local-LocalizationFile/<Language>.xml` file into the matching configured language item's assigned `XML` asset path. Create placeholder XML assets and assign them before fetching. Remove stale `Local-LocalizationFile` outputs before online-only fetches if the assigned local XML assets must not be overwritten.
129
+ After any `Fetch Localization` run, the editor copies each existing `Local-LocalizationFile/<Language>.xml` file into the matching configured language item's assigned `XML` asset path. Create placeholder XML assets and assign them before fetching. Remove stale `Local-LocalizationFile` outputs before online-only fetches if the assigned local XML assets must not be overwritten.
130
130
 
131
131
  Inspector visibility: `Worksheet Key` is shown only when at least one fetch type is `FromGoogleSheets`. CSV-only import does not require `worksheetKey`.
132
132
 
@@ -189,7 +189,7 @@ If both `xmlRef` and `onlineLocalizationUrl` are configured, both async loads ru
189
189
  | `XmobiTea Tools/Localization/Open Settings` | creates or selects `Assets/Resources/XmobiTea LocalizationSettings.asset` |
190
190
  | `XmobiTea Tools/Localization/Show LocalizationComponentWindows` | opens bulk UI text binding window |
191
191
  | `XmobiTea Tools/Localization/Generate LocalizationConstantId.cs` | generates constants from the first language item's local XML |
192
- | `XmobiTea Tools/Localization/Fetch Localization` | imports local/online XML files from configured editor sources, copies any existing local output files into assigned XML assets, then regenerates constants |
192
+ | `XmobiTea Tools/Localization/Fetch Localization` | imports local/online XML files from configured editor sources, copies any existing local output files into assigned XML assets, then regenerates constants |
193
193
 
194
194
  Inspector buttons on `LocalizationManager` and `LocalizationSettings` mirror the window, generate, and fetch actions.
195
195
 
@@ -276,7 +276,7 @@ Text replacements after XML read:
276
276
  - Missing key: `GetText(key)` returns `key`.
277
277
  - Empty key: `GetText(key)` returns `key`.
278
278
  - Duplicate XML key: logs an error and overwrites with the later value.
279
- - Missing local XML: local sync load is skipped; optional Addressables or online sources may still update later if configured.
280
- - Missing first language XML during constant generation: generator can throw while reading or parsing.
281
- - Missing CSV asset or missing CSV language columns during fetch: editor code can throw before generating XML.
282
- - Stale `Local-LocalizationFile/<Language>.xml` files can be copied into assigned local XML assets by any later fetch run, including online-only fetches.
279
+ - Missing local XML: local sync load is skipped; optional Addressables or online sources may still update later if configured.
280
+ - Missing first language XML during constant generation: generator can throw while reading or parsing.
281
+ - Missing CSV asset or missing CSV language columns during fetch: editor code can throw before generating XML.
282
+ - Stale `Local-LocalizationFile/<Language>.xml` files can be copied into assigned local XML assets by any later fetch run, including online-only fetches.
package/AI_BEHAVIOR.md CHANGED
@@ -185,14 +185,14 @@ Current constraints:
185
185
 
186
186
  - `Fetch Localization` checks `worksheetKey` only when a Google Sheets fetch type is selected.
187
187
  - CSV-only import can leave `worksheetKey` empty.
188
- - The custom inspector hides `worksheetKey` unless a Google Sheets fetch type is selected.
189
- - Empty Google sheet-name fields are passed to the fetch executable as default tab names: `local` for local XML and `online` for online XML. The inspector still warns when they are empty.
190
- - Google sheet tab names are not quoted in the command-line arguments, so names with spaces are unsafe.
191
- - CSV assets are not null-checked before `.text`.
192
- - CSV row lengths are not validated before language-column indexing.
193
- - Local XML target assets are assumed to exist when a `Local-LocalizationFile/<Language>.xml` file is copied back.
194
- - After every `Fetch Localization` run, the editor copies any existing `Local-LocalizationFile/<Language>.xml` file over the matching language item's assigned local `xml` asset, even when the current local fetch type is `None` or only online output was requested. Clear stale local output files before online-only fetches if local XML must remain untouched.
195
- - Runtime never reads CSV files.
188
+ - The custom inspector hides `worksheetKey` unless a Google Sheets fetch type is selected.
189
+ - Empty Google sheet-name fields are passed to the fetch executable as default tab names: `local` for local XML and `online` for online XML. The inspector still warns when they are empty.
190
+ - Google sheet tab names are not quoted in the command-line arguments, so names with spaces are unsafe.
191
+ - CSV assets are not null-checked before `.text`.
192
+ - CSV row lengths are not validated before language-column indexing.
193
+ - Local XML target assets are assumed to exist when a `Local-LocalizationFile/<Language>.xml` file is copied back.
194
+ - After every `Fetch Localization` run, the editor copies any existing `Local-LocalizationFile/<Language>.xml` file over the matching language item's assigned local `xml` asset, even when the current local fetch type is `None` or only online output was requested. Clear stale local output files before online-only fetches if local XML must remain untouched.
195
+ - Runtime never reads CSV files.
196
196
 
197
197
  ### FromGoogleSheets
198
198
 
@@ -200,13 +200,13 @@ When either fetch type is `FromGoogleSheets`, the editor:
200
200
 
201
201
  1. finds the package folder in `Library/PackageCache` or `Assets`;
202
202
  2. runs the bundled platform `GetLocalization` executable;
203
- 3. passes credentials path, worksheet key, local/online booleans, sheet names, and configured languages; empty sheet names are sent as `local` or `online`;
203
+ 3. passes credentials path, worksheet key, local/online booleans, sheet names, and configured languages; empty sheet names are sent as `local` or `online`;
204
204
  4. expects output files under `Local-LocalizationFile/<Language>.xml` and/or `Online-LocalizationFile/<Language>.xml`;
205
205
  5. copies existing local output files over each language item's configured local `XML` asset;
206
206
  6. refreshes assets;
207
207
  7. regenerates `LocalizationConstantId.cs`.
208
208
 
209
- Sheet tab names are passed as command-line arguments without quoting. Avoid spaces.
209
+ Sheet tab names are passed as command-line arguments without quoting. Avoid spaces.
210
210
 
211
211
  ### FromCsv
212
212
 
@@ -1,97 +1,97 @@
1
- # AI Bind UI Text
2
-
3
- Use this when a task needs to localize fixed UI copy such as labels, titles, descriptions, tabs, button captions, or popup text.
4
-
5
- ## Default Rule
6
-
7
- Use localization components for fixed UI text.
8
-
9
- Do not generate a custom script that only does:
10
-
11
- ```csharp
12
- text.text = LocalizationManager.GetText(key);
13
- ```
14
-
15
- ## Component Choice
16
-
17
- | Target | Use |
18
- | --- | --- |
19
- | `UnityEngine.UI.Text` | `LocalizationComponent` |
20
- | `TMP_Text` | `TMP_LocalizationComponent` |
21
-
22
- `TMP_LocalizationComponent` exists only when TextMesh Pro support defines `UNITY_USING_TMPRO`.
23
-
24
- ## Bind One Object
25
-
26
- Checklist:
27
-
28
- - add the correct localization component to the same `GameObject` as the target text when possible;
29
- - set `key`;
30
- - keep the target reference on the component if the text is not on the same object;
31
- - call `LocalizationManager.ChooseLanguage(...)` during startup so the component receives translated text.
32
-
33
- Inspector helpers:
34
-
35
- - `Reload Text` forces one preview refresh;
36
- - the key dropdown uses generated `LocalizationConstantId` values;
37
- - missing-key warnings compare the assigned key against generated constants.
38
-
39
- ## Bulk Bind Existing UI
40
-
41
- Open:
42
-
43
- ```text
44
- XmobiTea Tools/Localization/Show LocalizationComponentWindows
45
- ```
46
-
47
- Use the window to:
48
-
49
- - scan a parent object;
50
- - add `LocalizationComponent` or `TMP_LocalizationComponent`;
51
- - assign keys;
52
- - remove an incorrect localization component.
53
-
54
- ## Dynamic Or Composed Text
55
-
56
- Use custom code only for:
57
-
58
- - text built from runtime values;
59
- - non-UI cached state;
60
- - custom rendering outside `Text` and `TMP_Text`.
61
-
62
- Pattern:
63
-
64
- ```csharp
65
- private void OnEnable()
66
- {
67
- LocalizationManager.OnUpdateText -= Refresh;
68
- LocalizationManager.OnUpdateText += Refresh;
69
- Refresh();
70
- }
71
-
72
- private void OnDisable()
73
- {
74
- LocalizationManager.OnUpdateText -= Refresh;
75
- }
76
- ```
77
-
78
- ## Key Safety
79
-
80
- After adding, removing, or renaming keys, run:
81
-
82
- ```text
83
- XmobiTea Tools/Localization/Generate LocalizationConstantId.cs
84
- ```
85
-
86
- Use generated constants when available:
87
-
88
- ```csharp
89
- localizationComponent.key = LocalizationConstantId.Home_Title;
90
- ```
91
-
92
- ## Hard No
93
-
94
- - Do not bind fixed UI copy through one-off scripts when a localization component is enough.
95
- - Do not assume the component will find a target on another object automatically.
96
- - Do not rely on key dropdown warnings before constants are generated.
97
- - Do not forget that components can refresh more than once after one language switch.
1
+ # AI Bind UI Text
2
+
3
+ Use this when a task needs to localize fixed UI copy such as labels, titles, descriptions, tabs, button captions, or popup text.
4
+
5
+ ## Default Rule
6
+
7
+ Use localization components for fixed UI text.
8
+
9
+ Do not generate a custom script that only does:
10
+
11
+ ```csharp
12
+ text.text = LocalizationManager.GetText(key);
13
+ ```
14
+
15
+ ## Component Choice
16
+
17
+ | Target | Use |
18
+ | --- | --- |
19
+ | `UnityEngine.UI.Text` | `LocalizationComponent` |
20
+ | `TMP_Text` | `TMP_LocalizationComponent` |
21
+
22
+ `TMP_LocalizationComponent` exists only when TextMesh Pro support defines `UNITY_USING_TMPRO`.
23
+
24
+ ## Bind One Object
25
+
26
+ Checklist:
27
+
28
+ - add the correct localization component to the same `GameObject` as the target text when possible;
29
+ - set `key`;
30
+ - keep the target reference on the component if the text is not on the same object;
31
+ - call `LocalizationManager.ChooseLanguage(...)` during startup so the component receives translated text.
32
+
33
+ Inspector helpers:
34
+
35
+ - `Reload Text` forces one preview refresh;
36
+ - the key dropdown uses generated `LocalizationConstantId` values;
37
+ - missing-key warnings compare the assigned key against generated constants.
38
+
39
+ ## Bulk Bind Existing UI
40
+
41
+ Open:
42
+
43
+ ```text
44
+ XmobiTea Tools/Localization/Show LocalizationComponentWindows
45
+ ```
46
+
47
+ Use the window to:
48
+
49
+ - scan a parent object;
50
+ - add `LocalizationComponent` or `TMP_LocalizationComponent`;
51
+ - assign keys;
52
+ - remove an incorrect localization component.
53
+
54
+ ## Dynamic Or Composed Text
55
+
56
+ Use custom code only for:
57
+
58
+ - text built from runtime values;
59
+ - non-UI cached state;
60
+ - custom rendering outside `Text` and `TMP_Text`.
61
+
62
+ Pattern:
63
+
64
+ ```csharp
65
+ private void OnEnable()
66
+ {
67
+ LocalizationManager.OnUpdateText -= Refresh;
68
+ LocalizationManager.OnUpdateText += Refresh;
69
+ Refresh();
70
+ }
71
+
72
+ private void OnDisable()
73
+ {
74
+ LocalizationManager.OnUpdateText -= Refresh;
75
+ }
76
+ ```
77
+
78
+ ## Key Safety
79
+
80
+ After adding, removing, or renaming keys, run:
81
+
82
+ ```text
83
+ XmobiTea Tools/Localization/Generate LocalizationConstantId.cs
84
+ ```
85
+
86
+ Use generated constants when available:
87
+
88
+ ```csharp
89
+ localizationComponent.key = LocalizationConstantId.Home_Title;
90
+ ```
91
+
92
+ ## Hard No
93
+
94
+ - Do not bind fixed UI copy through one-off scripts when a localization component is enough.
95
+ - Do not assume the component will find a target on another object automatically.
96
+ - Do not rely on key dropdown warnings before constants are generated.
97
+ - Do not forget that components can refresh more than once after one language switch.
@@ -1,7 +1,7 @@
1
- fileFormatVersion: 2
2
- guid: 1d94a22a4df04055a673d6ddc188052e
3
- TextScriptImporter:
4
- externalObjects: {}
5
- userData:
6
- assetBundleName:
7
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: 1d94a22a4df04055a673d6ddc188052e
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant: