国际化后端或前端 [英] internationalization backend or frontend

查看:129
本文介绍了国际化后端或前端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个带有前端angularJs和后端Java API服务器的网站.我已经在API服务器中完成了错误消息的国际化,但是我想知道我是否应该在服务器端进行api结果的翻译?例如如果法国用户请求苹果对象,我应该退还他翻译的苹果对象,还是让前端为他翻译苹果对象?

I'm creating a website with front-end angularJs and back-end Java API server. I've already done error message internationalization in API server, but I'm wondering if I should do the translation of api result in server-side? e.g. if a french user requests an apple object, should I return him translated apple object, or just let front-end translate the apple object for him?

推荐答案

通过在rest调用中发送语言环境在后端处理错误消息,对于模板的前端,请使用带有AOT编译功能的Angular i18n.更好的表现 https://angular.io/guide/i18n

Do it at the backend for the error messages by sending the locale in the rest call, for front end in the templates go for the Angular i18n with AOT compilation for a better performance https://angular.io/guide/i18n

这篇关于国际化后端或前端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆