从SQL Server检索多种语言的数据 [英] retrieve data in multiple languages from sql server

查看:85
本文介绍了从SQL Server检索多种语言的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网页,其中包含一个文本框-
用户必须在此文本框中输入一些英语文本,
此数据将

1.存储(按提交时)到SQL Server数据库中 2.稍后,我必须从数据库中检索此数据,并以中文或英语显示在网页中.
当他从下拉列表中选择语言时.

I have a web page, that contains a text box -
users have to enter some ENGLISH text into this textbox,
this data is to be

1. stored (when submit pressed)into SQL server database
2. Later I have to retrieve this data from database and show into a web page in the Chienes or English language.
as he select the language from dropdownlist.
how it is possible

推荐答案

您正在发布相同的问题 [
You are posting the same question again[^].

Modify the existing question rather than creating a new one.


UPDATE SM:
Abinav''s reply earlier: This[^] third party might help you.


您不能即时将某些数据从一种语言转换为另一种语言.您以英语存储数据,因此以任何语言进行检索只会给您英文文本.即使您对数据库进行了本地化,它也只会使用该本地化语言对数据进行打孔,而不会转换任何来自另一种语言的数据.

如果需要数据转换,则需要自己在代码中进行处理,然后将其存储.或翻译后再显示.通常,定义的单词或句子可以很容易地本地化,但是翻译自由形式的文本(用户可以输入的任何内容)将很难做到.
You cannot convert some data on the fly from one language to other. You are storing the data in English and so retrieving in any language would give you English text only. Even if you localize your database - it will just hole the data in that localized language and not convert anything coming into it from another language.

If you need translation of data then you need to do it by yourself in code and then store the same. Or translate it before showing back. Generally, defined words or sentences can be easily localized but translating a free form text which can be anything entered by the user would be difficult to do.


对于我曾经使用过的我的一个项目,google翻译服务.尽管不是很准确,但是只要您的网站上的语法非常严格,"da beatz是da streetz上的jammin"就很可能行不通.

但是通过这种方式,您无需建立数据库,因为数据库会不断完善.

但是,如果您要使用多语言选项并自己做.您需要为每个内容变体包含一个语言外键,并将外键与当前主键结合.

例如:

内容表
字段:
id(pk)
langid(fk)(pk)
内容


语言表
字段:
langid(pk)
名称
For one of my projects i once used google translate services. Though not very accurate, as long as your grammar is very strict on your website "da beatz is jammin on da streetz" will most likely not work.

But this way you dont need to set up a database as it is constantly improved.

But if you are going for the multilingual option and doing it yourself. you are going to need to for each content variation include a foreign key to language and combine the foreign key with the current primary key.

eg:

Content table
Fields:
id (pk)
langid (fk)(pk)
content


Language table
Fields:
langid(pk)
name


这篇关于从SQL Server检索多种语言的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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