简体   繁体   English

梯形校正上的多语言字段

[英]Multi language field on keystone

I have an String field like this on a kestonejs model. 我在kestonejs模型上有一个像这样的String字段。

text: { type: String },

¿What is the best way for supporting multi language in that field? 在该领域支持多语言的最佳方法是什么?

You should use the mongoose-intl Mongoose plugin to have your String properties support languages other than English. 您应该使用mongoose-intl Mongoose插件使String属性支持英语以外的其他语言。 Keystone supports Mongoose plugins , so you should be able to associate the plugin with your Keystone model as you would a normal Mongoose model. Keystone 支持Mongoose插件 ,因此您应该能够将插件与Keystone模型相关联,就像普通的Mongoose模型一样。

字段可能不是答案,但是您可以尝试使用键=>值系统(例如http://i18next.com/docs/),这将帮助您检测用户的语言,并根据需要在路由或模板中翻译服务器端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM