全球化asp.net应用程序需要了解什么?

时间:2022-07-07 04:17:25

I'm writing an asp.net application that will need to be localized to several regions other than North America. What do I need to do to prepare for this globalization? What are your top 1 to 2 resources for learning how to write a world ready application.

我正在编写一个asp.net应用程序,需要本地化到北美以外的几个地区。为了应对这种全球化,我需要做些什么?学习如何编写世界级应用程序的最佳1到2资源是什么?

7 个解决方案

#1


23  

A couple of things that I've learned:

我学到了几件事:

  • Absolutely and brutally minimize the number of images you have that contain text. Doing so will make your life a billion percent easier since you won't have to get a new set of images for every friggin' language.

    绝对和粗暴地减少包含文本的图像数量。这样做可以让您的生活更轻松十亿,因为您不必为每种friggin语言获取一组新的图像。

  • Be very wary of css positioning that relies on things always remaining the same size. If those things contain text, they will not remain the same size, and you will then need to go back and fix your designs.

    要非常小心css定位依赖于总是保持相同大小的东西。如果这些内容包含文本,则它们将不会保持相同的大小,然后您需要返回并修复您的设计。

  • If you use character types in your sql tables, make sure that any of those that might receive international input are unicode (nchar, nvarchar, ntext). For that matter, I would just standardize on using the unicode versions.

    如果在sql表中使用字符类型,请确保可能接收国际输入的任何字符都是unicode(nchar,nvarchar,ntext)。就此而言,我只会标准化使用unicode版本。

  • If you're building SQL queries dynamically, make sure that you include the N prefix before any quoted text if there's any chance that text might be unicode. If you end up putting garbage in a SQL table, check to see if that's there.

    如果您正在动态构建SQL查询,请确保在任何引用文本之前包含N前缀,如果文本可能是unicode的话。如果您最终将垃圾放入SQL表中,请检查是否存在。

  • Make sure that all your web pages definitively state that they are in a unicode format. See Joel's article, mentioned above.

    确保所有网页明确声明它们采用unicode格式。请参阅上面提到的Joel的文章。

  • You're going to be using resource files a lot for this project. That's good - ASP.NET 2.0 has great support for such. You'll want to look into the App_LocalResources and App_GlobalResources folder as well as GetLocalResourceObject, GetGlobalResourceObject, and the concept of meta:resourceKey. Chapter 30 of Professional ASP.NET 2.0 has some great content regarding that. The 3.5 version of the book may well have good content there as well, but I don't own it.

    你将为这个项目大量使用资源文件。这很好 - ASP.NET 2.0对此有很大的支持。您将需要查看App_LocalResources和App_GlobalResources文件夹以及GetLocalResourceObject,GetGlobalResourceObject和meta:resourceKey的概念。 Professional ASP.NET 2.0的第30章有一些很好的内容。这本书的3.5版本也可能有很好的内容,但我不拥有它。

  • Think about fonts. Many of the standard fonts you might want to use aren't unicode capable. I've always had luck with Arial Unicode MS, MS Gothic, MS Mincho. I'm not sure about how cross-platform these are, though. Also, note that not all fonts support all of the Unicode character definition. Again, test, test, test.

    想想字体。您可能想要使用的许多标准字体都不支持unicode。我一直很幸运,有Arial Unicode MS,MS Gothic,MS Mincho。不过,我不确定这些是跨平台的。另请注意,并非所有字体都支持所有Unicode字符定义。再次,测试,测试,测试。

  • Start thinking now about how you're going to get translations into this system. Go talk to whoever is your translation vendor about how they want data passed back and forth for translation. Think about the fact that, through your local resource files, you will likely be repeating some commonly used strings through the system. Do you normalize those into global resource files, or do you have some sort of database layer where only one copy of each text used is generated. In our recent project, we used resource files which were generated from a database table that contained all the translations and the original, english version of the resource files.

    现在开始考虑如何翻译这个系统。与您的翻译供应商讨论他们希望数据来回传递的翻译方式。想想通过本地资源文件,您可能会通过系统重复一些常用的字符串。是否将这些规范化为全局资源文件,或者您是否具有某种数据库层,其中仅生成每个文本的一个副本。在我们最近的项目中,我们使用了从包含所有翻译的数据库表生成的资源文件以及资源文件的原始英文版本。

  • Test. Generally speaking I will test in German, Polish, and an Asian language (Japanese, Chinese, Korean). German and Polish are wordy and nearly guaranteed to stretch text areas, Asian languages use an entirely different set of characters which tests your unicode support.

    测试。一般来说,我将用德语,波兰语和亚洲语言(日语,中文,韩语)进行测试。德语和波兰语是罗嗦的,几乎可以保证伸展文本区域,亚洲语言使用完全不同的字符集来测试你的unicode支持。

#2


3  

Learn about the System.Globalization namespace:

了解System.Globalization命名空间:

System.Globalization

System.Globalization

Also, a good book is NET Internationalization: The Developer's Guide to Building Global Windows and Web Applications

另外,一本好书是NET国际化:开发人员指南,用于构建全局Windows和Web应用程序

#3


2  

Would be good to refresh a bit on Unicodes if you are targeting other cultures,languages.

如果你的目标是其他文化,语言,那么在Unicodes上刷新一下会很好。

The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)

绝对最低每个软件开发人员绝对必须知道Unicode和字符集(没有借口!)

#4


2  

This is a hard problem. I live in Canada, so multilingualism is a big issue. In all my years of doing software development, I've never seen a solution that I liked. I've seen a lot of solutions that worked, and got the job done, but they've always felt like a big kludge. I would go with @harriyott, and make sure that none of your strings are actually in code. A resource file works well for desktop applications. However in ASP.Net, I'd recommend using the database. @John Christensen also has some good pointers.

这是一个难题。我住在加拿大,所以多语言是一个大问题。在我多年的软件开发过程中,我从未见过我喜欢的解决方案。我已经看到了许多有效的解决方案,并完成了工作,但他们总觉得自己是一个很大的障碍。我会选择@harriyott,并确保你的所有字符串都不在代码中。资源文件适用于桌面应用程序。但是在ASP.Net中,我建议使用数据库。 @John Christensen也有一些很好的指示。

#5


2  

Make sure you're compiling with Code Analysis turned on, and pay attention to the Globalization warnings that it gives you. Keep data in an invariant format (CultureInfo.InvariantCulture) until you display it to the user (then use CultureInfo.CurrentCulture).

确保您在启用代码分析时进行编译,并注意它为您提供的全球化警告。将数据保持为不变格式(CultureInfo.InvariantCulture),直到将其显示给用户(然后使用CultureInfo.CurrentCulture)。

#6


1  

I would seriously consider reading the following code project article:

我会认真考虑阅读以下代码项目文章:

Globalization and localization demystified in ASP.NET 2.0

全局化和本地化在ASP.NET 2.0中揭开神秘色彩

It covers everything from Cultures and Locales, setting the threads current culture, resource files, encodings, you name it!

它涵盖了文化和语言环境中的所有内容,设置线程当前文化,资源文件,编码,您的名字!

And of course it's loaded with pretty pictures and examples :-). Good luck!

当然,它载有漂亮的图片和例子:-)。祝你好运!

#7


0  

I would suggest:

我会建议:

  1. Put all strings in either the database or resource files.
  2. 将所有字符串放在数据库或资源文件中。
  3. Allow extra space for translated text, as some (e.g. German) are wordier.
  4. 为翻译的文本留出额外的空间,因为有些(例如德语)比较啰嗦。

#1


23  

A couple of things that I've learned:

我学到了几件事:

  • Absolutely and brutally minimize the number of images you have that contain text. Doing so will make your life a billion percent easier since you won't have to get a new set of images for every friggin' language.

    绝对和粗暴地减少包含文本的图像数量。这样做可以让您的生活更轻松十亿,因为您不必为每种friggin语言获取一组新的图像。

  • Be very wary of css positioning that relies on things always remaining the same size. If those things contain text, they will not remain the same size, and you will then need to go back and fix your designs.

    要非常小心css定位依赖于总是保持相同大小的东西。如果这些内容包含文本,则它们将不会保持相同的大小,然后您需要返回并修复您的设计。

  • If you use character types in your sql tables, make sure that any of those that might receive international input are unicode (nchar, nvarchar, ntext). For that matter, I would just standardize on using the unicode versions.

    如果在sql表中使用字符类型,请确保可能接收国际输入的任何字符都是unicode(nchar,nvarchar,ntext)。就此而言,我只会标准化使用unicode版本。

  • If you're building SQL queries dynamically, make sure that you include the N prefix before any quoted text if there's any chance that text might be unicode. If you end up putting garbage in a SQL table, check to see if that's there.

    如果您正在动态构建SQL查询,请确保在任何引用文本之前包含N前缀,如果文本可能是unicode的话。如果您最终将垃圾放入SQL表中,请检查是否存在。

  • Make sure that all your web pages definitively state that they are in a unicode format. See Joel's article, mentioned above.

    确保所有网页明确声明它们采用unicode格式。请参阅上面提到的Joel的文章。

  • You're going to be using resource files a lot for this project. That's good - ASP.NET 2.0 has great support for such. You'll want to look into the App_LocalResources and App_GlobalResources folder as well as GetLocalResourceObject, GetGlobalResourceObject, and the concept of meta:resourceKey. Chapter 30 of Professional ASP.NET 2.0 has some great content regarding that. The 3.5 version of the book may well have good content there as well, but I don't own it.

    你将为这个项目大量使用资源文件。这很好 - ASP.NET 2.0对此有很大的支持。您将需要查看App_LocalResources和App_GlobalResources文件夹以及GetLocalResourceObject,GetGlobalResourceObject和meta:resourceKey的概念。 Professional ASP.NET 2.0的第30章有一些很好的内容。这本书的3.5版本也可能有很好的内容,但我不拥有它。

  • Think about fonts. Many of the standard fonts you might want to use aren't unicode capable. I've always had luck with Arial Unicode MS, MS Gothic, MS Mincho. I'm not sure about how cross-platform these are, though. Also, note that not all fonts support all of the Unicode character definition. Again, test, test, test.

    想想字体。您可能想要使用的许多标准字体都不支持unicode。我一直很幸运,有Arial Unicode MS,MS Gothic,MS Mincho。不过,我不确定这些是跨平台的。另请注意,并非所有字体都支持所有Unicode字符定义。再次,测试,测试,测试。

  • Start thinking now about how you're going to get translations into this system. Go talk to whoever is your translation vendor about how they want data passed back and forth for translation. Think about the fact that, through your local resource files, you will likely be repeating some commonly used strings through the system. Do you normalize those into global resource files, or do you have some sort of database layer where only one copy of each text used is generated. In our recent project, we used resource files which were generated from a database table that contained all the translations and the original, english version of the resource files.

    现在开始考虑如何翻译这个系统。与您的翻译供应商讨论他们希望数据来回传递的翻译方式。想想通过本地资源文件,您可能会通过系统重复一些常用的字符串。是否将这些规范化为全局资源文件,或者您是否具有某种数据库层,其中仅生成每个文本的一个副本。在我们最近的项目中,我们使用了从包含所有翻译的数据库表生成的资源文件以及资源文件的原始英文版本。

  • Test. Generally speaking I will test in German, Polish, and an Asian language (Japanese, Chinese, Korean). German and Polish are wordy and nearly guaranteed to stretch text areas, Asian languages use an entirely different set of characters which tests your unicode support.

    测试。一般来说,我将用德语,波兰语和亚洲语言(日语,中文,韩语)进行测试。德语和波兰语是罗嗦的,几乎可以保证伸展文本区域,亚洲语言使用完全不同的字符集来测试你的unicode支持。

#2


3  

Learn about the System.Globalization namespace:

了解System.Globalization命名空间:

System.Globalization

System.Globalization

Also, a good book is NET Internationalization: The Developer's Guide to Building Global Windows and Web Applications

另外,一本好书是NET国际化:开发人员指南,用于构建全局Windows和Web应用程序

#3


2  

Would be good to refresh a bit on Unicodes if you are targeting other cultures,languages.

如果你的目标是其他文化,语言,那么在Unicodes上刷新一下会很好。

The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)

绝对最低每个软件开发人员绝对必须知道Unicode和字符集(没有借口!)

#4


2  

This is a hard problem. I live in Canada, so multilingualism is a big issue. In all my years of doing software development, I've never seen a solution that I liked. I've seen a lot of solutions that worked, and got the job done, but they've always felt like a big kludge. I would go with @harriyott, and make sure that none of your strings are actually in code. A resource file works well for desktop applications. However in ASP.Net, I'd recommend using the database. @John Christensen also has some good pointers.

这是一个难题。我住在加拿大,所以多语言是一个大问题。在我多年的软件开发过程中,我从未见过我喜欢的解决方案。我已经看到了许多有效的解决方案,并完成了工作,但他们总觉得自己是一个很大的障碍。我会选择@harriyott,并确保你的所有字符串都不在代码中。资源文件适用于桌面应用程序。但是在ASP.Net中,我建议使用数据库。 @John Christensen也有一些很好的指示。

#5


2  

Make sure you're compiling with Code Analysis turned on, and pay attention to the Globalization warnings that it gives you. Keep data in an invariant format (CultureInfo.InvariantCulture) until you display it to the user (then use CultureInfo.CurrentCulture).

确保您在启用代码分析时进行编译,并注意它为您提供的全球化警告。将数据保持为不变格式(CultureInfo.InvariantCulture),直到将其显示给用户(然后使用CultureInfo.CurrentCulture)。

#6


1  

I would seriously consider reading the following code project article:

我会认真考虑阅读以下代码项目文章:

Globalization and localization demystified in ASP.NET 2.0

全局化和本地化在ASP.NET 2.0中揭开神秘色彩

It covers everything from Cultures and Locales, setting the threads current culture, resource files, encodings, you name it!

它涵盖了文化和语言环境中的所有内容,设置线程当前文化,资源文件,编码,您的名字!

And of course it's loaded with pretty pictures and examples :-). Good luck!

当然,它载有漂亮的图片和例子:-)。祝你好运!

#7


0  

I would suggest:

我会建议:

  1. Put all strings in either the database or resource files.
  2. 将所有字符串放在数据库或资源文件中。
  3. Allow extra space for translated text, as some (e.g. German) are wordier.
  4. 为翻译的文本留出额外的空间,因为有些(例如德语)比较啰嗦。