@@ -609,24 +609,29 @@ private static void GenerateLocalizationMethod(
609
609
string tabString )
610
610
{
611
611
sb . Append ( $ "{ tabString } public static string { ls . Key } (") ;
612
+
613
+ // Get parameter string
612
614
var parameters = ls . Params . ToList ( ) ;
613
615
sb . Append ( string . Join ( ", " , parameters . Select ( p => $ "{ p . Type } { p . Name } ") ) ) ;
614
616
sb . Append ( ") => " ) ;
615
-
616
617
var formatArgs = parameters . Count > 0
617
618
? $ ", { string . Join ( ", " , parameters . Select ( p => p . Name ) ) } "
618
619
: string . Empty ;
619
620
620
621
if ( isCoreAssembly )
621
622
{
622
623
sb . AppendLine ( parameters . Count > 0
623
- ? $ "string.Format(InternationalizationManager.Instance.GetTranslation(\" { ls . Key } \" ){ formatArgs } );"
624
+ ? ! ls . Format ?
625
+ $ "string.Format(InternationalizationManager.Instance.GetTranslation(\" { ls . Key } \" ){ formatArgs } );"
626
+ : $ "string.Format(System.Globalization.CultureInfo.CurrentCulture, InternationalizationManager.Instance.GetTranslation(\" { ls . Key } \" ){ formatArgs } );"
624
627
: $ "InternationalizationManager.Instance.GetTranslation(\" { ls . Key } \" );") ;
625
628
}
626
629
else if ( pluginInfo ? . IsValid == true )
627
630
{
628
631
sb . AppendLine ( parameters . Count > 0
629
- ? $ "string.Format({ pluginInfo . ContextAccessor } .API.GetTranslation(\" { ls . Key } \" ){ formatArgs } );"
632
+ ? ! ls . Format ?
633
+ $ "string.Format({ pluginInfo . ContextAccessor } .API.GetTranslation(\" { ls . Key } \" ){ formatArgs } );"
634
+ : $ "string.Format(System.Globalization.CultureInfo.CurrentCulture, { pluginInfo . ContextAccessor } .API.GetTranslation(\" { ls . Key } \" ){ formatArgs } );"
630
635
: $ "{ pluginInfo . ContextAccessor } .API.GetTranslation(\" { ls . Key } \" );") ;
631
636
}
632
637
else
@@ -669,6 +674,8 @@ public class LocalizableString
669
674
public string Value { get ; }
670
675
public string Summary { get ; }
671
676
public IEnumerable < LocalizableStringParam > Params { get ; }
677
+
678
+ public bool Format => Params . Any ( p => ! string . IsNullOrEmpty ( p . Format ) ) ;
672
679
673
680
public LocalizableString ( string key , string value , string summary , IEnumerable < LocalizableStringParam > @params )
674
681
{
0 commit comments