peterhaneve / ONIMods

Peter Han's mods for Oxygen Not Included
Other
316 stars 64 forks source link

Mod Translations Fail #108

Closed lanfeicui closed 3 years ago

lanfeicui commented 3 years ago

Hi,peter

the translation occurs after all mods load, Call: PLocalization.LocalizeAll(locale); No method was called Strings.Add (key,text) So localized failed,The UI Text is still the initial value.

Register a mod for translation by using PLocalization.Register(); LocString.CreateLocStringKeys(typeof(PLSStrings)); in OnLoad.

Still failed.The local language pack file (. PO) is not accessed at this time because of the wrong execution order.

Suggestions: After executing the calling function:PLocalization.LocalizeAll(locale);, we can call LocString.CreateLocStringKeys(typeof(my_mod_string));

thanks.

Output Log

[12:24:43.456] [1] [INFO] [PLib] Mod PrintListSelect initialized, version 1.1.9.0 [12:24:43.458] [1] [INFO] [PLib/PrintListSelect] Registered mod options class PrintListSelectOptions for PrintListSelect [12:24:43.460] [1] [INFO] [PLib/PrintListSelect] Translation LocString Key/Text : PrintListSelect.PLSStrings.MULTIPLIER / Multiplier ............................................. [12:24:43.461] [1] [INFO] [PLib/PrintListSelect] Translation LocString Key/Text : PrintListSelect.PLSStrings.NOT_SUPPORT_TIP / Setting in the game interface is not supported. This module can be set in the module management interface. [12:24:43.461] [1] [INFO] [PLib/PrintListSelect] Localizing assembly PrintListSelect using base namespace PrintListSelect [12:24:43.461] [1] [INFO] Loading mod content DLL [Mod Updater:2018291283] (provides DLL) [12:24:43.462] [1] [INFO] Loading MOD dll: ModUpdateDate.dll [12:24:43.894] [1] [INFO] [PLib] Mod ModUpdateDate initialized, version 1.12.0.0 [12:24:43.895] [1] [INFO] [PLib/ModUpdateDate] Registered mod options class ModUpdateInfo for ModUpdateDate [12:24:43.905] [1] [INFO] Loading mod content DLL [Blueprints:1814341183] (provides DLL) [12:24:43.905] [1] [INFO] Loading MOD dll: Blueprints.dll [12:24:43.946] [1] [INFO] [PLib/Blueprints] Registered mod options class BlueprintsOptions for Blueprints [12:24:43.971] [1] [INFO] Blueprints Loaded: Version 2.3.360.35 [12:24:43.986] [1] [INFO] [PKeyBinding] Registering 1 key bind(s) for mod Pliers [12:24:43.986] [1] [INFO] [PKeyBinding] Registering 10 key bind(s) for mod Blueprints [12:24:43.994] [1] [INFO] Creating SteamManager. [12:24:44.128] [1] [INFO] Localization.Initialize! [12:24:44.129] [1] [INFO] Localization Initialize... Preinstalled localization [12:24:44.129] [1] [INFO] -> zh_klei [12:24:44.181] [1] [INFO] -> Locale is now zh:Chinese:LeftToRight:NotoSansCJKsc-Regular [12:24:44.660] [1] [INFO] PrintListSelect: Setting up mod. [12:24:44.661] [1] [INFO] PrintListSelect: Found valid mod_info.yaml in folder 'root': VANILLA_ID, EXPANSION1_ID at 20210122 [12:24:44.661] [1] [INFO] PrintListSelect: No archived_versions for this mod, using root version directly. [12:24:44.661] [1] [INFO] PrintListSelect: Successfully loaded from path 'root' with content 'DLL'. [12:24:44.661] [1] [INFO] Subscribe to mod PrintListSelect [12:24:44.688] [1] [INFO] Test Data Location / docs / C:\Users\Administrator\Documents\Klei\OxygenNotIncluded [12:24:44.688] [1] [INFO] Test Data Location / local / C:\Users\Administrator\AppData\Local\Klei\OxygenNotIncluded [12:24:44.690] [1] [INFO] Test Data Locations / C:\Users\Administrator\Documents\Klei\OxygenNotIncluded\test / write True / read True / removed True [12:24:44.690] [1] [INFO] Test Data Locations / C:\Users\Administrator\AppData\Local\Klei\OxygenNotIncluded\test / write True / read True / removed True [12:24:44.696] [1] [INFO] [PLibPatches] Using version 3.13.3.0 [12:24:44.728] [1] [INFO] [PLib/PrintListSelect] Created delegate for struct field PlanScreen+PlanInfo.data with type System.Object [12:24:44.733] [1] [INFO] [PLib/PrintListSelect] Localizing 3 mods to locale zh [12:24:44.839] [1] [INFO] [PLibPatches] PLib patches applied

@peterhaneve

peterhaneve commented 3 years ago

[12:24:44.733] [1] [INFO] [PLib/PrintListSelect] Localizing 3 mods to locale zh The mods are not localized until this message is printed. Therefore, logging Translation LocStrings during OnLoad when you did will not work, as language packs might not be loaded until after OnLoad has executed.