【特性】新增java,Python,Typescript,Lua的动态本地化支持
parent
93214633b8
commit
67fce760c4
|
|
@ -68,8 +68,8 @@ Luban适合有以下需求的开发者:
|
||||||
- **本地化支持**
|
- **本地化支持**
|
||||||
- 支持时间本地化。datetime类型数据会根据指定的timezone,转换为目标地区该时刻的UTC时间,方便程序使用。
|
- 支持时间本地化。datetime类型数据会根据指定的timezone,转换为目标地区该时刻的UTC时间,方便程序使用。
|
||||||
- 支持文本静态本地化。导出时所有text类型数据正确替换为最终的本地化字符串。绝大多数的业务功能不再需要运行根据本地化id去查找文本的内容,简化程序员的工作。
|
- 支持文本静态本地化。导出时所有text类型数据正确替换为最终的本地化字符串。绝大多数的业务功能不再需要运行根据本地化id去查找文本的内容,简化程序员的工作。
|
||||||
|
- 支持文本动态本地化。运行时动态切换所有text类型数据为目标本地化字符串。
|
||||||
- 支持 main + patches 数据合并。在基础数据上,施加差分数据,生成最终完整数据,适用于制作有细微不同的多地区的配置数据。
|
- 支持 main + patches 数据合并。在基础数据上,施加差分数据,生成最终完整数据,适用于制作有细微不同的多地区的配置数据。
|
||||||
- [TODO] 支持文本动态本地化。运行时动态切换所有text类型数据为目标本地化字符串。
|
|
||||||
- [TODO] 【独创】 支持任意粒度和任意类型数据(如int,bean,list,map)的本地化。
|
- [TODO] 【独创】 支持任意粒度和任意类型数据(如int,bean,list,map)的本地化。
|
||||||
- 支持主流的游戏开发语言
|
- 支持主流的游戏开发语言
|
||||||
- c++ (11+)
|
- c++ (11+)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
using Luban.Job.Cfg.Datas;
|
||||||
using Luban.Job.Common.Types;
|
using Luban.Job.Common.Types;
|
||||||
using Luban.Job.Common.TypeVisitors;
|
using Luban.Job.Common.TypeVisitors;
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -75,7 +76,7 @@ namespace Luban.Job.Cfg.TypeVisitors
|
||||||
|
|
||||||
public string Accept(TText type, string json, string x)
|
public string Accept(TText type, string json, string x)
|
||||||
{
|
{
|
||||||
return $"{x} = {json}.getAsString();";
|
return $"{json}.getAsJsonObject().get(\"{DText.KEY_NAME}\").getAsString(); {x} = {json}.getAsJsonObject().get(\"{DText.TEXT_NAME}\").getAsString();";
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Accept(TBean type, string json, string x)
|
public string Accept(TBean type, string json, string x)
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ namespace Luban.Job.Cfg.TypeVisitors
|
||||||
|
|
||||||
public string Accept(TText type, string bufName, string fieldName)
|
public string Accept(TText type, string bufName, string fieldName)
|
||||||
{
|
{
|
||||||
return $"{fieldName} = {bufName}.readString();";
|
return $"{bufName}.readString(); {fieldName} = {bufName}.readString();";
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Accept(TBean type, string bufName, string fieldName)
|
public string Accept(TBean type, string bufName, string fieldName)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
using Luban.Job.Cfg.Datas;
|
||||||
using Luban.Job.Common.Types;
|
using Luban.Job.Common.Types;
|
||||||
using Luban.Job.Common.TypeVisitors;
|
using Luban.Job.Common.TypeVisitors;
|
||||||
|
|
||||||
|
|
@ -74,7 +75,7 @@ namespace Luban.Job.Cfg.TypeVisitors
|
||||||
|
|
||||||
public string Accept(TText type, string jsonVarName, string fieldName)
|
public string Accept(TText type, string jsonVarName, string fieldName)
|
||||||
{
|
{
|
||||||
return $"{fieldName} = {jsonVarName}";
|
return $"{fieldName} = {jsonVarName}['{DText.TEXT_NAME}']";
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Accept(TBean type, string jsonVarName, string fieldName)
|
public string Accept(TBean type, string jsonVarName, string fieldName)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
using Luban.Job.Cfg.Datas;
|
||||||
using Luban.Job.Common.Types;
|
using Luban.Job.Common.Types;
|
||||||
using Luban.Job.Common.TypeVisitors;
|
using Luban.Job.Common.TypeVisitors;
|
||||||
|
|
||||||
|
|
@ -74,7 +75,7 @@ namespace Luban.Job.Cfg.TypeVisitors
|
||||||
|
|
||||||
public string Accept(TText type, string jsonVarName, string fieldName)
|
public string Accept(TText type, string jsonVarName, string fieldName)
|
||||||
{
|
{
|
||||||
return $"{fieldName} = {jsonVarName}";
|
return $"{fieldName} = {jsonVarName}['{DText.TEXT_NAME}']";
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Accept(TBean type, string jsonVarName, string fieldName)
|
public string Accept(TBean type, string jsonVarName, string fieldName)
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,11 @@ namespace Luban.Job.Common.TypeVisitors
|
||||||
return $"{type.Apply(LuaDeserializeMethodNameVisitor.Ins)}({x})";
|
return $"{type.Apply(LuaDeserializeMethodNameVisitor.Ins)}({x})";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string Accept(TText type, string bufName)
|
||||||
|
{
|
||||||
|
return $"readString({bufName}) and readString({bufName})";
|
||||||
|
}
|
||||||
|
|
||||||
public override string Accept(TArray type, string x)
|
public override string Accept(TArray type, string x)
|
||||||
{
|
{
|
||||||
return $"readArray({x}, {type.ElementType.Apply(LuaDeserializeMethodNameVisitor.Ins)})";
|
return $"readArray({x}, {type.ElementType.Apply(LuaDeserializeMethodNameVisitor.Ins)})";
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,11 @@ namespace Luban.Job.Common.TypeVisitors
|
||||||
return $"{type.Apply(LuaSerializeMethodNameVisitor.Ins)}({bufName}, {fieldName})";
|
return $"{type.Apply(LuaSerializeMethodNameVisitor.Ins)}({bufName}, {fieldName})";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string Accept(TText type, string bufName, string fieldName)
|
||||||
|
{
|
||||||
|
return $"readString({bufName}); {fieldName} = readString({bufName})";
|
||||||
|
}
|
||||||
|
|
||||||
public override string Accept(TArray type, string bufName, string fieldName)
|
public override string Accept(TArray type, string bufName, string fieldName)
|
||||||
{
|
{
|
||||||
return $"writeArray({bufName}, {fieldName}, {type.ElementType.Apply(LuaSerializeMethodNameVisitor.Ins)})";
|
return $"writeArray({bufName}, {fieldName}, {type.ElementType.Apply(LuaSerializeMethodNameVisitor.Ins)})";
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ namespace Luban.Job.Common.TypeVisitors
|
||||||
|
|
||||||
public string Accept(TText type, string bufName, string fieldName)
|
public string Accept(TText type, string bufName, string fieldName)
|
||||||
{
|
{
|
||||||
return $"{fieldName} = {bufName}.ReadString()";
|
return $" {bufName}.ReadString(); {fieldName} = {bufName}.ReadString()";
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract string Accept(TBean type, string bufVarName, string fieldName);
|
public abstract string Accept(TBean type, string bufVarName, string fieldName);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue