可本地化性檢閱
在地化可能性審查是開發全球化準備應用程式的中間步驟。 它會確認全球化應用程式已準備好進行當地語系化,並識別需要特殊處理之使用者介面的任何程式代碼或任何層面。 此步驟也有助於確保當地語系化程式不會將任何功能缺陷引入您的應用程式。 當可當地語系化性檢閱所引發的所有問題都已解決時,您的應用程式便已準備好進行當地語系化。 如果在地化審查徹底,就不應該在在地化過程期間修改任何原始程式碼。
可本地化性檢閱包含下列三項檢查:
實作全球化建議
如果您已考慮當地語系化來設計和開發應用程式,而且如果您已遵循 全球化 一文中討論的建議,當地語系化能力檢閱基本上會是品質保證通行證。 否則,在此階段中,您應該檢閱並實作 全球化的建議,並修正原始程式碼中防止本地化的錯誤。
處理文化敏感特性
.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.
測試您的應用程式
在本地化應用程式之前,您應該先使用國際版作系統上的國際數據進行測試。 雖然目前大部分的使用者介面都不會當地語系化,但您將能夠偵測到下列問題:
無法在不同操作系統版本之間正確反序列化的序列化數據。
未反映目前文化特性慣例的數值數據。 例如,數位可能會以不正確的群組分隔符、小數分隔符或貨幣符號來顯示。
未反映目前文化特性慣例的日期和時間數據。 例如,代表月份和日的數位可能會以錯誤的順序顯示、日期分隔符可能不正確,或時區資訊可能不正確。
找不到的資源,因為您尚未識別應用程式的預設文化特性。
在特定文化中以不尋常順序顯示的字串。
傳回非預期結果的字串比較或相等性比較。
如果您在開發應用程式時遵循全球化建議,正確處理區分文化特性的功能,並識別並解決測試期間出現的當地語系化問題,您可以繼續進行下一個步驟,本地化。