diff --git a/CLUNL.Localization/CLUNL.Localization.csproj b/CLUNL.Localization/CLUNL.Localization.csproj index d75b24c..b3ab73f 100644 --- a/CLUNL.Localization/CLUNL.Localization.csproj +++ b/CLUNL.Localization/CLUNL.Localization.csproj @@ -3,7 +3,7 @@ netstandard2.1 True - 0.0.6.0 + 0.0.7.0 https://github.com/creeperlv/CLUNL https://github.com/creeperlv/CLUNL diff --git a/CLUNL.Localization/LocalizedString.cs b/CLUNL.Localization/LocalizedString.cs index 68f5fff..a0c3fcb 100644 --- a/CLUNL.Localization/LocalizedString.cs +++ b/CLUNL.Localization/LocalizedString.cs @@ -10,15 +10,18 @@ namespace CLUNL.Localization /// public class LocalizedString { + object[] arguments; /// /// Initialize the string with LanguageID and fallback. /// /// /// - public LocalizedString(string ID,string Fallback) + /// + public LocalizedString(string ID, string Fallback, params object[] arguments) { this.ID = ID; this.Fallback = Fallback; + this.arguments = arguments; } private string ID; private string Fallback; @@ -29,12 +32,15 @@ public LocalizedString(string ID,string Fallback) [MethodImpl(MethodImplOptions.AggressiveInlining)] public override string ToString() { - return Language.Find(ID, Fallback); + if (arguments != null) + return String.Format(Language.Find(ID, Fallback), arguments); + else return Language.Find(ID, Fallback); } /// /// Return the value from ToString(); /// /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static implicit operator string(LocalizedString L) { return L.ToString();