翻译不同语言,在数据库中的字符串 [英] Translate string in different language that is in database

查看:233
本文介绍了翻译不同语言,在数据库中的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好朋友我已经在我在我的应用程序读取从database.All数据数据应用程序从database.I来已在英语这个应用程序,但现在我想我的印地文和其他语言的应用程序转换too.Actually如果我使用的XML字符串,然后我做出不同的string.xml每种语言,然后设置的语言环境这不是问题,但在数据库转换字符串,然后fetch.so请建议我怎么能采取这种idea.Any帮助将AP preciable。

Hello friends I have made an application in which I have fetched data from database.All data in my application is coming from database.I have made this application in English language but now I want to convert my application in Hindi and other languages too.Actually if I used XML for string then I make different string.xml for every language and then set locale it was not the issue but converting string in database and then fetch.so please suggest me how can I adopt this idea.Any help would be appreciable.

推荐答案

您可以:


  • 添加列你的表与翻译:

  • Add columns to your tables with the translations:

TABLE消息:ID,内容,CONTENT_FR,CONTENT_ES,...

TABLE messages : ID, CONTENT, CONTENT_FR, CONTENT_ES, ...

然后根据设备设置(如果语言环境是FR,然后使用列CONTENT_FR,如果语言环境是尚未被应用程序所提供的东西,回退到内容栏)

Then you select the column according to the locale set in the device (if locale is FR, then use the column CONTENT_FR, if the locale is something not yet provided by the app, fallback to the CONTENT column)


  • 使用几个DB文件(如果你的数据库是静态的,将不会被更新):

加载对应于用户区域数据库文件。然后,你的查询将保持不变。

Load the DB file that corresponds to the user locale. Then your queries will remain unchanged.

这篇关于翻译不同语言,在数据库中的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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