本地化评审Localizability review

本地化分析检查是全球通用应用程序开发中的一个中间步骤。The localizability review is an intermediate step in the development of a world-ready application. 它验证全球化应用程序是否已准备好进行本地化,以及是否能够识别需要特别处理的所有代码或所有用户界面元素。It verifies that a globalized application is ready for localization and identifies any code or any aspects of the user interface that require special handling. 此步骤还有助于确保本地化过程不会将任何功能缺陷引入应用程序。This step also helps ensure that the localization process will not introduce any functional defects into your application. 一旦本地化分析检查提出的所有问题都得到解决,就意味着可以对应用程序进行本地化了。When all the issues raised by the localizability review have been addressed, your application is ready for localization. 如果本地化分析评审详尽彻底,则在本地化过程中应该不需要修改任何源代码。If the localizability review is thorough, you should not have to modify any source code during the localization process.

本地化分析检查包括以下三项检查:The localizability review consists of the following three checks:

实现全球化建议Implement globalization recommendations

如果在设计和开发应用时考虑了本地化因素,并且遵循了全球化一文中给出的建议,那么可本地化评审在很大程度上就会成为质量保证关口。If you have designed and developed your application with localization in mind, and if you have followed the recommendations discussed in the Globalization article, the localizability review will largely be a quality assurance pass. 否则,请在此阶段评审并实现全球化建议,修复源代码中妨碍本地化的错误。Otherwise, during this stage you should review and implement the recommendations for globalization and fix the errors in source code that prevent localization.

处理区分区域性的功能Handle culture-sensitive features

.NET 在许多方面都不提供编程支持,而且各区域性之间差别很大。.NET does not provide programmatic support in a number of areas that vary widely by culture. 大多数情况下,你必须编写自定义代码来处理诸如以下方面的功能特性:In most cases, you have to write custom code to handle feature areas like the following:

  • 地址Addresses

  • 电话号码Telephone numbers

  • 纸张大小Paper sizes

  • 用于长度、重量、面积、体积和温度的度量单位Units of measure used for lengths, weights, area, volume, and temperatures

    虽然 .NET 不对度量单位之间的转换提供内置支持,但可以使用 RegionInfo.IsMetric 属性确定特定国家或地区是否使用公制,如下面的示例所示。Although .NET does not offer built-in support for converting between units of measure, you can use the RegionInfo.IsMetric property to determine whether a particular country or region uses the metric system, as the following example illustrates.

    using System;
    using System.Globalization;
    
    public class Example
    {
       public static void Main()
       {
          string[] cultureNames = { "en-US", "en-GB", "fr-FR",
                                    "ne-NP", "es-BO", "ig-NG" };
          foreach (var cultureName in cultureNames) {
             RegionInfo region = new RegionInfo(cultureName);
             Console.WriteLine("{0} {1} the metric system.", region.EnglishName,
                               region.IsMetric ? "uses" : "does not use");
          }
       }
    }
    // The example displays the following output:
    //       United States does not use the metric system.
    //       United Kingdom uses the metric system.
    //       France uses the metric system.
    //       Nepal uses the metric system.
    //       Bolivia uses the metric system.
    //       Nigeria uses the metric system.
    
    Imports System.Globalization
    
    Module Example
        Public Sub Main()
            Dim cultureNames() As String = {"en-US", "en-GB", "fr-FR",
                                             "ne-NP", "es-BO", "ig-NG"}
            For Each cultureName In cultureNames
                Dim region As New RegionInfo(cultureName)
                Console.WriteLine("{0} {1} the metric system.", region.EnglishName,
                                  If(region.IsMetric, "uses", "does not use"))
            Next
        End Sub
    End Module
    ' The example displays the following output:
    '       United States does not use the metric system.
    '       United Kingdom uses the metric system.
    '       France uses the metric system.
    '       Nepal uses the metric system.
    '       Bolivia uses the metric system.
    '       Nigeria uses the metric system.
    

测试应用程序Test your application

在本地化应用程序之前,应当使用国际数据在操作系统的国际版本上对其进行测试。Before you localize your application, you should test it by using international data on international versions of the operating system. 虽然此时不会对大部分用户界面进行本地化,但可以检测到如下问题:Although most of the user interface will not be localized at this point, you will be able to detect problems such as the following:

  • 在操作系统版本之间无法正确执行反序列化的序列化数据。Serialized data that does not deserialize correctly across operating system versions.

  • 不反映当前区域性的约定的数值数据。Numeric data that does not reflect the conventions of the current culture. 例如,显示的数字可能带有错误的组分隔符、小数分隔符或货币符号。For example, numbers may be displayed with inaccurate group separators, decimal separators, or currency symbols.

  • 不反映当前区域性的约定的日期和时间数据。Date and time data that does not reflect the conventions of the current culture. 例如,表示月和日的数字可能会以错误的顺序出现,日期分隔符可能不正确,或者时区信息可能不正确。For example, numbers that represent the month and day may appear in the wrong order, date separators may be incorrect, or time zone information may be incorrect.

  • 找不到的资源,因为尚未确定应用程序的默认区域性。Resources that cannot be found because you have not identified a default culture for your application.

  • 以特定区域性中的异常顺序显示的字符串。Strings that are displayed in an unusual order for the specific culture.

  • 返回意外结果的字符串比较或相等比较。String comparisons or comparisons for equality that return unexpected results.

如果在开发应用时遵循了全球化建议,并正确处理了区域性敏感型功能,同时还发现并解决了测试期间出现的本地化问题,就可以执行下一步本地化If you've followed the globalization recommendations when developing your application, handled culture-sensitive features correctly, and identified and addressed the localization issues that arose during testing, you can proceed to the next step, Localization.

另请参阅See also