国际化Web应用程序的最佳做法? [英] Best practices for internationalizing web applications?

查看:87
本文介绍了国际化Web应用程序的最佳做法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

国际化Web应用程序似乎总是很麻烦.无论您对可插拔语言有多大的计划,总是会遇到编码问题,不适合您模板的时髦措词以及其他问题.

Internationalizing web apps always seems to be a chore. No matter how much you plan ahead for pluggable languages, there's always issues with encoding, funky phrasing that doesn't fit your templates, and other problems.

我认为,获得SO社区的意见对于程序员在决定对其Web应用程序进行国际化时应注意的事项很有用.

I think it would be useful to get the SO community's input for a set of things that programmers should look out for when deciding to internationalize their web apps.

推荐答案

国际化很困难,这是我与两个使用20多种不同语言的网站合作时学到的东西:

Internationalization is hard, here's a few things I've learned from working with 2 websites that were in over 20 different languages:

  • 在任何地方都使用UTF-8.没有例外. HTML,服务器端语言(尤其是PHP),数据库等.
  • 除非需要大量工作,否则图像中没有文本.如有必要,请使用CSS将文字放在图片上.
  • 将配置与本地化分开.这样,本地化人员便可以翻译文本,并且您可以针对每个语言环境处理不同的配置(功能,布局等).您不希望本地化人员能够干扰您的应用.
  • 确保您的布局可以处理的文本长度是英语的2-3倍.而且比英语要少50%(日语和中文通常要短一些).
  • 某些语言需要更大的字体(日语,中文)
  • 颜色也是特定于语言环境的.红色和绿色并不意味着到处都是同一件事!
  • 在您的文档的主体标签中添加一个类名称,该类名称是语言环境名称.这样,您可以轻松地在CSS文件中指定特定语言环境的布局.
  • 当心变量替换.不要分裂你的弦.将它们完整保留为:您有X条新消息",并用#代替"X".
  • 不同的语言具有不同的多元性. 0、1、2-4、5-7、7-无穷大.很难应付.
  • 上下文很难.有时本地化人员需要知道在哪里/如何使用字符串以确保正确翻译.
  • Use UTF-8 everywhere. No exceptions. HTML, server-side language (watch out for PHP especially), database, etc.
  • No text in images unless you want a ton of work. Use CSS to put text over images if necessary.
  • Separate configuration from localization. That way localizers can translate the text and you can deal with different configurations per locale (features, layout, etc). You don't want localizers to have the ability to mess with your app.
  • Make sure your layouts can deal with text that is 2-3 times longer than English. And also 50% less than English (Japanese and Chinese are often shorter).
  • Some languages need larger font sizes (Japanese, Chinese)
  • Colors are locale-specific also. Red and green don't mean the same thing everywhere!
  • Add a classname that is the locale name to the body tag of your documents. That way you can specify a specific locale's layout in your CSS file easily.
  • Watch out for variable substitution. Don't split your strings. Leave them whole like this: "You have X new messages" and replace the 'X' with the #.
  • Different languages have different pluralization. 0, 1, 2-4, 5-7, 7-infinity. Hard to deal with.
  • Context is difficult. Sometimes localizers need to know where/how a string is used to make sure it's translated correctly.

资源:

  • http://interglacial.com/~sburke/tpj/as_html/tpj13.html
  • http://www.ryandoherty.net/2008/05/26/quick-tips-for-localizing-web-apps/
  • http://ed.agadak.net/2007/12/one-potato-two-potato-three-potato-four

这篇关于国际化Web应用程序的最佳做法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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