如何:當地語系化功能How to: Localize a feature

依預設,功能標題和描述會使用硬式編碼的字串值。By default, feature titles and descriptions use hard-coded string values. 若要將功能標題和描述當地語系化,請將字串取代為參考當地語系化資源的運算式。To localize the feature title and description, replace the strings with expressions that reference localized resources.

將功能當地語系化Localize a feature

若要將功能當地語系化To localize a feature

  1. 方案總管 中,開啟 [ Feature1 ] 節點的快捷方式功能表,然後選擇 [ 加入功能資源]。In Solution Explorer, open the shortcut menu for the Feature1 node, and then choose Add Feature Resource.

  2. 在 [ 新增資源 ] 對話方塊中,從清單中選擇 [不區分 語言 ] 作為預設語言功能資源檔的文化特性。In the Add Resource dialog box, choose Invariant Language from the list as the culture for the default language feature resource file.

  3. 針對每種當地語系化的語言重複先前的步驟,並且針對當地語系化的功能資源檔選擇您所選擇的語言。Repeat the previous step for each localized language, choosing the languages of your choice for the localized feature resource files.

    這樣會建立不同的功能資源檔:一個用於預設語言,另一個用於要支援的每種當地語系化語言。Separate feature resource files are created: one for the default language and one for each localized language that you want to support.

  4. 在 [資源編輯器] 中開啟每個資源檔,然後輸入所有 ID 字串及其值。Open each resource file in the Resource Editor, and then enter all of the string IDs and their values.

    例如,在預設功能資源檔中,輸入 標題 值為 [ 我的功能標題] 的字串識別碼,並在 [ 描述 ] 的第二個字串識別碼中輸入值為 [ 我的功能描述]。For example, in the default feature resource file, enter a string ID of Title with a value of My Feature Title, and a second string ID of Description with a value of My Feature Description. 針對每個當地語系化的資源檔,使用預設功能資源中所使用的相同字串 ID,但要輸入值的當地語系化字串。For each localized resource file, use the same string IDs used in the default feature resource, but enter localized strings for the values.

  5. 輸入所有資源值之後,開啟功能 (的快捷方式功能表,例如 [ Feature1 ]) ,然後選擇 [ View designer ] 以開啟功能設計工具中的功能。After you enter all the resource values, open the shortcut menu for the feature (for instance, Feature1.feature), and then choose View Designer to open the feature in the Feature Designer.

  6. 若要將功能中的 [ 標題 ] 和 [ 描述 ] 欄位當地語系化,請使用下列格式,在其方塊中輸入值:To localize the Title and Description fields in the feature, use the following format to enter values in their boxes:

    $Resources: 字串識別碼$Resources: String ID

    例如,在 [功能標題] 方塊中輸入 $Resources:Title ,並在 [功能描述] 方塊中輸入 $Resources:descriptionFor example, enter $Resources:Title in the Feature Title box, and $Resources:Description in the Feature Description box.

    字串 ID 必須與資源檔中所使用的字串 ID 相符。The string IDs must match those that are used in the resource files.

  7. 選擇 F5 鍵來建立和執行應用程式。Choose the F5 key to build and run the application.

  8. 在 SharePoint 中,開啟 [ 網站動作 ] 功能表,選擇 [ 網站設定],然後在 [ 網站動作 ] 區段中選擇 [ 管理網站功能 ] 連結。In SharePoint, open the Site Actions menu, choose Site Settings, and then, in the Site Actions section choose the Manage Site Features link.

  9. 在 SharePoint 中,從預設值變更顯示語言。In SharePoint, change the display language from the default.

    當地語系化的功能標題和描述會出現在應用程式中。The localized feature title and description appear in the application. 若要顯示當地語系化的資源,SharePoint 伺服器必須安裝符合資源檔文化特性的語言套件。To display localized resources, the SharePoint server must have a language pack installed that matches the resource file's culture.

另請參閱See also