diff --git a/src/Luban.Core/Defs/DefAssembly.cs b/src/Luban.Core/Defs/DefAssembly.cs index 7e033be8..53de0d4d 100644 --- a/src/Luban.Core/Defs/DefAssembly.cs +++ b/src/Luban.Core/Defs/DefAssembly.cs @@ -373,7 +373,7 @@ protected TType CreateNotContainerType(string module, string rawType, bool conta return TString.Create(nullable, tags); case "text": tags.Add("text", "1"); - return TString.Create(nullable, tags); + return TInt.Create(nullable, tags); case "time": case "datetime": return TDateTime.Create(nullable, tags); diff --git a/src/Luban.L10N/DataTarget/TextKeyListCollectorVisitor.cs b/src/Luban.L10N/DataTarget/TextKeyListCollectorVisitor.cs index c2aa0832..188ab207 100644 --- a/src/Luban.L10N/DataTarget/TextKeyListCollectorVisitor.cs +++ b/src/Luban.L10N/DataTarget/TextKeyListCollectorVisitor.cs @@ -32,7 +32,10 @@ public void Accept(DShort data, TType type, TextKeyCollection x) public void Accept(DInt data, TType type, TextKeyCollection x) { - + if (data != null && type.HasTag("text")) + { + x.AddKey(data.Value.ToString()); + } } public void Accept(DLong data, TType type, TextKeyCollection x) diff --git a/src/Luban.L10N/TextValidator.cs b/src/Luban.L10N/TextValidator.cs index 1ae02f41..7f767f21 100644 --- a/src/Luban.L10N/TextValidator.cs +++ b/src/Luban.L10N/TextValidator.cs @@ -13,9 +13,9 @@ public class TextValidator : DataValidatorBase public override void Compile(DefField field, TType type) { - if (type is not TString) + if (type is not TInt) { - throw new Exception($"field:{field} text validator supports string type only"); + throw new Exception($"field:{field} text validator supports int type only"); } } @@ -27,7 +27,7 @@ public override void Validate(DataValidatorContext ctx, TType type, DType data) { return; } - string key = ((DString)data).Value; + string key = ((DInt)data).Value.ToString(); if (string.IsNullOrEmpty(key)) { return;