@@ -609,24 +609,29 @@ private static void GenerateLocalizationMethod(
609609 string tabString )
610610 {
611611 sb . Append ( $ "{ tabString } public static string { ls . Key } (") ;
612+
613+ // Get parameter string
612614 var parameters = ls . Params . ToList ( ) ;
613615 sb . Append ( string . Join ( ", " , parameters . Select ( p => $ "{ p . Type } { p . Name } ") ) ) ;
614616 sb . Append ( ") => " ) ;
615-
616617 var formatArgs = parameters . Count > 0
617618 ? $ ", { string . Join ( ", " , parameters . Select ( p => p . Name ) ) } "
618619 : string . Empty ;
619620
620621 if ( isCoreAssembly )
621622 {
622623 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 } );"
624627 : $ "InternationalizationManager.Instance.GetTranslation(\" { ls . Key } \" );") ;
625628 }
626629 else if ( pluginInfo ? . IsValid == true )
627630 {
628631 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 } );"
630635 : $ "{ pluginInfo . ContextAccessor } .API.GetTranslation(\" { ls . Key } \" );") ;
631636 }
632637 else
@@ -669,6 +674,8 @@ public class LocalizableString
669674 public string Value { get ; }
670675 public string Summary { get ; }
671676 public IEnumerable < LocalizableStringParam > Params { get ; }
677+
678+ public bool Format => Params . Any ( p => ! string . IsNullOrEmpty ( p . Format ) ) ;
672679
673680 public LocalizableString ( string key , string value , string summary , IEnumerable < LocalizableStringParam > @params )
674681 {
0 commit comments