本地化评审是开发世界就绪应用程序的中间步骤。 它验证全球化应用程序是否已准备好进行本地化,并标识需要特殊处理的用户界面的任何代码或任何方面。 此步骤还有助于确保本地化过程不会在应用程序中引入任何功能缺陷。 如果解决了可本地化性评审引发的所有问题,则应用程序已准备好进行本地化。 如果本地化评审是彻底的,则不应在本地化过程中修改任何源代码。
可本地化评审包括以下三项检查:
实施全球化建议
如果你在设计并开发应用程序时考虑到了本地化,并且如果你遵循 了全球化 文章中讨论的建议,则可本地化性评审基本上是一个质量保证通行证。 否则,在此阶段,应查看并实施 全球化 建议,并修复源代码中阻止本地化的错误。
处理区分区域性的功能
.NET 在许多方面都不提供编程支持,而且各区域性之间差别很大。 在大多数情况下,必须编写自定义代码来处理功能区域,如下所示:
地址
电话号码
纸张大小
用于长度、权重、面积、体积和温度的度量单位
虽然 .NET 不提供在度量单位之间进行转换的内置支持,但可以使用 RegionInfo.IsMetric 该属性来确定特定国家或地区是否使用指标系统,如以下示例所示。
string[] cultureNames = { "en-US", "en-GB", "fr-FR", "ne-NP", "es-BO", "ig-NG" }; foreach (string cultureName in cultureNames) { RegionInfo region = new(cultureName); string usesMetric = region.IsMetric ? "uses" : "does not use"; Console.WriteLine($"{region.EnglishName} {usesMetric} the metric system."); } // 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.
测试应用程序
在本地化应用程序之前,应使用国际版作系统上的国际数据对其进行测试。 尽管大多数用户界面此时不会本地化,但可以检测以下问题:
在操作系统版本之间无法正确执行反序列化的序列化数据。
不反映当前区域性的约定的数值数据。 例如,可以使用不准确的分组分隔符、小数分隔符或货币符号显示数字。
不反映当前文化惯例的日期和时间数据。 例如,表示月份和日期的数字可能按错误顺序显示,日期分隔符可能不正确,或者时区信息可能不正确。
由于您未为应用程序识别默认文化,导致无法找到资源。
以特定区域性中的异常顺序显示的字符串。
返回意外结果的字符串比较或相等比较。
如果在开发应用程序时遵循了全球化建议,正确处理了区分区域性的功能,并识别并解决了测试过程中出现的本地化问题,则可以继续执行下一步“ 本地化”。