11using Elements . Core ;
22using FrooxEngine ;
33using HarmonyLib ;
4- using System ;
5- using System . Collections . Generic ;
6- using System . Linq ;
7- using System . Reflection ;
8- using System . Text ;
9- using System . Threading . Tasks ;
4+
105using EngineLocaleHelper = FrooxEngine . LocaleHelper ;
116
127namespace MonkeyLoader . Resonite . Locale
@@ -32,15 +27,21 @@ private static void AddFallbackMessage(IField<string> field, LocaleStringDriver
3227 [ HarmonyPatch ( nameof ( EngineLocaleHelper . DriveLocalized ) , [ typeof ( IField < string > ) , typeof ( string ) , typeof ( string ) , typeof ( Dictionary < string , object > ) ] ) ]
3328 private static void DriveLocalizedPostfix ( IField < string > field , string key , string ? format , Dictionary < string , object > ? arguments , LocaleStringDriver __result )
3429 {
35- if ( arguments is not null && arguments . ContainsKey ( LocaleExtensions . ModLocaleStringIndicatorArgumentName ) )
30+ if ( arguments is null || field . World . IsUserspace ( ) )
31+ return ;
32+
33+ if ( arguments . ContainsKey ( LocaleExtensions . ModLocaleStringIndicatorArgumentName ) )
3634 AddFallbackMessage ( field , __result , string . Format ( format ?? "{0}" , key ) , key . AsLocaleKey ( format , arguments : arguments ) . FormatWithFallback ( ) ! ) ;
3735 }
3836
3937 [ HarmonyPostfix ]
4038 [ HarmonyPatch ( nameof ( EngineLocaleHelper . DriveLocalized ) , [ typeof ( IField < string > ) , typeof ( string ) , typeof ( string ) , typeof ( ( string , object ) [ ] ) ] ) ]
4139 private static void DriveLocalizedPostfix ( IField < string > field , string key , string ? format , ( string , object ) [ ] ? args , LocaleStringDriver __result )
4240 {
43- if ( args is not null && args . Any ( arg => arg . Item1 == LocaleExtensions . ModLocaleStringIndicatorArgumentName ) )
41+ if ( args is null || field . World . IsUserspace ( ) )
42+ return ;
43+
44+ if ( args . Any ( arg => arg . Item1 == LocaleExtensions . ModLocaleStringIndicatorArgumentName ) )
4445 AddFallbackMessage ( field , __result , string . Format ( format ?? "{0}" , key ) , key . AsLocaleKey ( format , args ) . FormatWithFallback ( ) ! ) ;
4546 }
4647 }
0 commit comments