全球化指導方針Guidelines for globalization

設計及開發您的應用程式,使其能夠在不同語言和文化設定的系統上正常運作。Design and develop your app in such a way that it functions appropriately on systems with different language and culture configurations. 使用 Globalization API 格式化資料,避免在您的程式碼中假設語言、地區、字元分類、書寫系統、日期/時間格式、數字、貨幣、重量及排序規則。Use Globalization APIs to format data; and avoid assumptions in your code about language, region, character classification, writing system, date/time formatting, numbers, currencies, weights, and sorting rules.

建議Recommendation 描述Description
在操縱和比較字串時將文化納入考量。Take culture into account when manipulating and comparing strings. 例如,不要在比較他們之前變更字串的大小寫。For example, don't change the case of strings before comparing them. 請參閱字串使用建議See Recommendations for String Usage.
在整理 (排序) 字串和其他資料時,不要假設該作業總是按照字母順序進行。When collating (sorting) strings and other data, don't assume that it's is always done alphabetically. 針對並非使用拉丁文書寫體的語言,整理是以像是發音或筆畫數等要素作為基礎的。For languages that don't use Latin script, collation is based on factors such as pronunciation, or number of pen strokes. 即使是使用拉丁文書寫體的語言,也不一定會依字母順序排序。Even languages that do use Latin script don't always use alphabetic sorting. 例如,在某些文化特性中,電話簿可能不是依字母順序排序。For example, in some cultures, a phone book might not be sorted alphabetically. Windows 可以為您處理排序,但是如果您建立自己的排序演算法,則務必將目標市場所使用的排序方法納入考量。Windows can handle sorting for you, but if you create your own sorting algorithm then be sure to take into account the sorting methods used in your target markets.
使用適當格式的數字、日期、時間、地址及電話號碼。Appropriately format numbers, dates, times, addresses, and phone numbers. 這些格式在不同文化、地區、語言和市場間都有所不同。These formats vary between cultures, regions, languages, and markets. 若要顯示這些資料,請使用 Globalization API 取得適用於特定對象的適當格式。If you're displaying these data then use Globalization APIs to get the format appropriate for a particular audience. 請參閱全球化您的日期/時間/數字格式See Globalize your date/time/number formats. 姓氏與名稱顯示的順序,以及地址的格式等也會有所不同。The order in which family and given names are displayed, and the format of addresses, can differ as well. 請使用標準日期、時間及數字顯示。Use standard date, time, and number displays. 請使用標準日期和時間選擇器控制項。Use standard date and time picker controls. 請使用標準地址資訊。Use standard address information.
支援國際度量單位和貨幣。Support international units of measurement and currency. 即使最普遍的是公制系統和英制系統,但是,不同的國家或地區還是會使用不同的單位和比例。Different units and scales are used in different countries, although the most popular are the metric system and the imperial system. 如果您處理像是長度、溫度或面積等度量,請務必支援正確系統度量單位。Be sure to support the correct system measurement if you deal with measurements such as length, temperature, and area. 使用 GeographicRegion.CurrenciesInUse 屬性取得在特定地區中使用的貨幣組。Use the GeographicRegion.CurrenciesInUse property to get the set of currencies in use in a region.
使用 Unicode 進行字元編碼。Use Unicode for character encoding. 根據預設,Microsoft Visual Studio 會使用 Unicode 字元編碼所有文件。By default, Microsoft Visual Studio uses Unicode character encoding for all documents. 如果您使用不同的編輯器,務必以適當的 Unicode 字元編碼儲存來源檔案。If you're using a different editor, be sure to save source files in the appropriate Unicode character encodings. 所有 Windows 執行階段 API 都會傳回 UTF-16 編碼的字串。All Windows Runtime APIs return UTF-16 encoded strings.
支援國際紙張大小。Support international paper sizes. 最常用的紙張大小會因為國家或地區而不同,所以,如果您包含根據紙張大小而定的功能 (例如,列印),請確定可支援常用的國際紙張大小並加以測試。The most common paper sizes differ between countries, so if you include features that depend on paper size, such as printing, be sure to support and test common international sizes.
記錄鍵盤或 IME 的語言。Record the language of the keyboard or IME. 當您的應用程式要求使用者輸入文字時,記錄目前啟用之鍵盤配置或輸入法編輯器 (IME) 的語言標記。When your app asks the user for text input, record the language tag for the currently enabled keyboard layout or Input Method Editor (IME). 這可確保在稍後顯示輸入時,會以正確的格式顯示給使用者。This ensures that when the input is displayed later it's presented to the user with the appropriate formatting. 使用 Language.CurrentInputMethodLanguageTag 屬性取得目前的輸入語言。Use the Language.CurrentInputMethodLanguageTag property to get the current input language.
請不要使用語言來假設使用者的地區;也請不要使用地區來假設使用者的語言。Don't use language to assume a user's region; and don't use region to assume a user's language. 語言和地區是不同的概念。Language and region are separate concepts. 使用者可以使用語言的特殊地區變體 (例如,en-GB 是英國使用的英文,但是使用者可能在完全不同的國家或地區)。A user can speak a particular regional variant of a language, like en-GB for English as spoken in the UK, but the user might be in an entirely different country or region. 考量您的應用程式是否需要關於使用者語言 (例如針對 UI 文字) 或地區 (例如針對授權問題) 的知識。Consider whether your app requires knowledge about the user's language (for UI text, for example), or region (for licensing, for example). 如需詳細資訊,請參閱了解使用者設定檔語言和應用程式資訊清單語言For more info, see Understand user profile languages and app manifest languages.
比較語言標記的規則並非簡易規則。The rules for comparing language tags are non-trivial. BCP-47 語言標記很複雜。BCP-47 language tags are complex. 在比較語言標記時會產生許多問題,包括比對指令碼資訊、傳統標記及多個地區變體的問題。There are a number of issues when comparing language tags, including issues with matching script information, legacy tags, and multiple regional variants. Windows 中的資源管理系統會為您處理比對工作。The Resource Management System in Windows takes care of matching for you. 您可以使用任何語言指定一組資源,系統就會為使用者和應用程式選擇適當的資源。You can specify a set of resources in any languages, and the system chooses the appropriate one for the user and the app. 請參閱應用程式資源和資源管理系統資源管理系統如何比對語言標記See App resources and the Resource Management System and How the Resource Management System matches language tags.
建議您將您的 UI 設計為可容納不同文字長度和文字大小的標籤和文字輸入控制項。Design your UI to accommodate different text lengths and font sizes for labels and text input controls. 翻譯成不同語言的字串長度可能會大幅改變,因此您需要將您的 UI 控制項設為可根據其內容動態調整尺寸。Strings translated into different languages can vary greatly in length, so you'll need your UI controls to dynamically size to their content. 在其他語言中常見的字元包含位於英文中常用字母上方或下方的標記 (例如 Å 或 Ņ)。Common characters in other languages include marks above or below what is typically used in English (such as Å or Ņ). 使用標準字型大小和列高提供適當的垂直空間。Use the standard font sizes and line heights to provide adequate vertical space. 請注意,適用於其他語言的字型可能會需要較大的最小字型大小,以保持在可閱讀的情況。Be aware that fonts for other languages may require larger minimum font sizes to remain legible. 請參閱 Windows.Globalization.Fonts 命名空間中的類別。See the classes in the Windows.Globalization.Fonts namespace.
支援閱讀順序的鏡像。Support the mirroring of reading order. 文字對齊和閱讀順序可以是由左至右 (例如,英文),或由右至左 (RTL) (例如,阿拉伯文或希伯來文)。Text alignment and reading order can be left to right (as in English, for example), or right to left (RTL) (as in Arabic or Hebrew, for example). 如果您正在將產品當地語系化為使用和您自己的語言不同閱讀順序的語言,請確定 UI 元素的配置支援鏡像。If you are localizing your product into languages that use a different reading order than your own, then be sure that the layout of your UI elements supports mirroring. 像是返回按鈕、UI 轉換效果及影像等項目都可能需要鏡像。Even items such as back buttons, UI transition effects, and images might need to be mirrored. 如需詳細資訊,請參閱調整配置和字型及支援 RTLFor more info, see Adjust layout and fonts, and support RTL.
正確顯示文字和字型。Display text and fonts correctly. 理想的字型、字型大小和文字的方向會根據不同市場而有所不同。The ideal font, font size, and direction of text varies between different markets. 如需詳細資訊,請參閱調整配置和字型及支援 RTL國際字型For more info, see Adjust layout and fonts, and support RTL and International fonts.

重要 APIImportant APIs

 

範例Samples