多语言网站的设计模式?
假设我正在设计一个网站,其中有英语、法语、西班牙语、德语和韩语(我没有,但让我们假装我有)。
我不能依赖谷歌翻译等服务,因为该网站的本质不是娱乐而是商业。假设我可以联系专业翻译人员,他们可以将上下文中的内容翻译成另一种语言,然后给我该文本。
通过网站提供多种语言的内容有哪些已知且简单的方法?
有很多选择,例如单独的页面、使用数据库等等......但我无法真正决定什么是最好的,概念如何扩展,需要考虑什么,以及如何处理缺失的翻译?
这方面有没有行之有效的做法?
Lets say I'm designing a website where we have English, French, Spanish, German, and Korea (I'm not, but lets pretend I am).
I cannot rely upon services such as google translate, as the nature of the website is not for entertainment but business. Lets say I have access to professional translators that can translate something in context to another language and give me that text.
What are some known and simple ways to serve up content over multiple languages with a website?
There's lots of options, such as separate pages, using a database, and so forth... but I can't really decide what's best, how the concept would scale, what needs to be considered, and how to deal with missing translations?
Are there any well-established practices for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您所询问的广泛主题称为“国际化和本地化”(或简称 I18N 和 L10N)。需要记住的重要一点是,这不仅仅是翻译消息。网站国际化还有很多其他因素。
您需要的更明显的东西是:
你需要的其他东西需要考虑:
String message = "Please fix the following error" + (errors.size() > 1 ? "s" : "");
在国际化程序中不起作用。我能找到的最佳资源是ICU 库的用户指南。如果您使用 Java,则可以使用该库。
希望这个答案是一个有用的开始!
The broad topic you're asking about is called "Internationalization and Localization" (or I18N and L10N for short). The important thing to remember is that it's not just about translating messages. There are many other things that go into internationalizing a website.
The more obvious things you will need are:
Other things you need to consider:
String message = "Please fix the following error" + (errors.size() > 1 ? "s" : "");
just doesn't work in an internationalized program.The best resource I can find for this is the ICU library's User guide. If you use Java, this is the library to use.
Hopefully this answer is a helpful start!
查看 Google 针对多区域和多语言网站。希望这些信息能派上用场。祝你好运。
Take a look at google's recommendations for Multi-regional and multilingual sites. Hope that information comes in handy. Best of luck.
完全同意@Michael D 和其他发布答案的开发人员的观点。虽然这个问题已经被接受,但我认为一个小选项,例如 :lang() 伪类也有助于创建多语言网站。 :lang() 伪类允许确定各种文档中的语言。
CSS 代码:
HTML 代码:
输出将如下所示:
请注意,我们谈论的是文档,而不是一段文本,因为它们执行复杂的格式设置。
Totally agree with @Michael D and other developers who posted their answers. Although the for this question is already accepted but I think one small option such as the :lang() pseudo class can be helpfull for createing multilingual sites as well. The :lang() pseudo class allows to determine the language in various documents.
CSS code:
HTML code:
And the output will be like this:
Please note that we are talking about documents, not a piece of text, as they perform complex formatting.
我们在磁盘上有一组文件,其中包含给定小部件/模块/任何内容中的所有字符串,以及每种语言的单独文件,即:
根据客户端的 Accept-Language 标头,我们确定他想要哪种语言。
当第一次请求给定语言时,我们会访问文件系统来构建该语言的大字符串映射,然后将其缓存在内存中。如果 fr-CA 中没有定义给定的字符串,我们会将堆栈跳转到 fr,然后最终
动态生成通用页面,并根据用户的语言标头(以及其他)缓存每个 url 的生成版本。事物)。
希望有帮助
We have a set of files on disk that contain all the strings in a given widget/module/whatever, and separate files per language, i.e.:
Based on the client's Accept-Language header, we determine which language he wants.
When a given language is first requested, we hit the file system to build up the big string mapping for that language, then cache it in memory. If a given string isn't defined in fr-CA, we'll hop up the stack to fr, then eventually to the generic
Pages are generated dynamically and the generated version of each url is cached depending on the user's language headers (among other things).
Hope that helps