Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议优化key生成规则以及翻译长度限制机制 #18

Open
bobolau opened this issue Feb 23, 2024 · 0 comments
Open

建议优化key生成规则以及翻译长度限制机制 #18

bobolau opened this issue Feb 23, 2024 · 0 comments

Comments

@bobolau
Copy link

bobolau commented Feb 23, 2024

不太适应key为中文的做法,特别是界面上容易有歧义,相同中文对应不同位置的英文翻译可能不一样。
希望能做一些针对key生成规则的优化,以vue2+element-ui为例,分析可能需要翻译内容
假设已知模块名(module可在目录中配置,写在index中或者单独文件,或者全局按目录进行配置)
页面:页面标题 [module].[pagefile].title
列表: 列名 [module].[listname].[column] 或 [module].[column] 允许选择通用或者不同列表单独配置
表单: 字段一般需要翻译 label/placeholder/alt/tip等明确属性,通常存在prop类似属性可确定字段名称 field
label/alt: [module].[field], placeholder:[module].[field]Ph, tip: [module].[field]Tip
不一一列举,总体思路就是通过常用需要翻译的文字,去找到对应模型对应的模型名或字段名,生成符合本来业务含义的key。

另外title/label/button 除了翻译外,可能还涉及到长度的限制,不同语言的差别较大,
可考虑方案: 方案1-增加长度限制的参数作为参考,或者 方案2-整理类似normal正常/small小/large大 三种类型分别翻译
前端根据UI样式来选择对应的翻译版本

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant