Edward_jie

for you, my Hall of Frame

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  92 随笔 :: 45 文章 :: 539 评论 :: 43万 阅读
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

The title of an application appears in the application list and on the application Tile when the user pins the application to the Start screen. Localizing the application title is optional. Some developers may want to not localize the application title for branding reasons.

To localize the application title that is displayed in the application list or application Tile, you must create a resource-only DLL for each display language that your application targets. For a full list of display languages that Windows Phone supports, see Culture and Language Support for Windows Phone. The resource-only DLL should contain only the resource strings used to localize the application title in the application list and on the application Tile.

The following screenshots show where an application title is used in the context of an application list and an application Tile.

 

The title in the application list:

The title on the application Tile pinned to the Start screen:

App List With Localized Title Start Screen with Localized Title

To complete these procedures, you need a Windows Phone application project. You can use an existing project, or you can create an empty Silverlight Windows Phone application to use to test these procedures. For more information about creating a new project, see How to: Create Your First Silverlight Application for Windows Phone.

The following sections walk you through the process of localizing the application title for use in the application list and application Tile.

In this procedure, you create a project to generate a resource-only DLL named AppResLib.dll.

Note Note:

There is more than one way to organize your Windows Phone application and resource DLL projects and files for localization. The method presented here is a simple method that works well for all editions of Visual Studio.

To create a language resource DLL project

  1. On the File menu, point to New and then click Project.

    The New Project dialog appears.

  2. In the left pane, click Installed Templates, expand Visual C++ and then click Win32.

  3. In the list of project types, click Win32 Project.

  4. In the Name box, type AppResLib.

  5. In the Location box, enter a location for your project.

    Note Note:

    For the purposes of this procedure, you can create the AppResLib project anywhere.

  6. Click OK.

    The Win32 Application Wizard appears.

  7. In the left pane, click Application Settings.

  8. Under Application type, select DLL.

  9. Under Additional options, select Empty project.

  10. Click Finish.

    The new DLL project is created and opens in Visual Studio.

  11. In Solution Explorer, select the new DLL project.

  12. On the Project menu, click Properties.

    The Property Pages dialog appears.

  13. In the left pane, expand Configuration Properties, expand Linker, and then click Advanced.

  14. Select the No Entry Point property, click the drop-down arrow to the right of the property value, and then click Yes (/NOENTRY).

    Note Note:

    /NOENTRY prevents the linker from linking a reference to _main into the DLL; this option is required to create a resource-only DLL.

  15. Click OK.

  16. Save and build the project.

In this procedure, you add a resource string table to the DLL project that contains the language-neutral name of your application.

To create the language-neutral resource strings for your application

  1. In Solution Explorer, select the new DLL project.

  2. On the Project menu, click Add Resource.

    The Add Resource dialog appears.

  3. In the Resource type list, select String Table and then click New.

    The resource string table opens.

  4. Create two resource strings with the following properties.

     

    ID

    Value

    Caption

    AppTitle

    100

    The language-neutral name of your application to be displayed in the application list.

    AppTileString

    200

    The language-neutral name of your application to be displayed in the application Tile when pinned to Start.

  5. Save and build the DLL project.

  6. In Windows Explorer, locate the file AppResLib.dll that you just built.

  7. Copy the file AppResLib.dll to the directory that contains your Windows Phone application project file.

    Tip Tip:

    If you are using the default Windows Phone project structure, this is the same directory that contains the file App.xaml.

In this procedure, you edit the resource string table to contain specific language names. You rename the DLL file, and copy it to the appropriate location.

To create the first specific language resource strings for your application

  1. Edit the resource strings, setting the properties as follows.

     

    ID

    Value

    Caption

    AppTitle

    100

    The English (United States) name of your application to be displayed in the application list.

    AppTileString

    200

    The English (United States) name of your application to be displayed in the application Tile when pinned to Start.

  2. Save and build the DLL project.

  3. In Windows Explorer, locate the file AppResLib.dll that you just built.

  4. Rename the DLL file to AppResLib.dll.0409.mui.

  5. Copy the file AppResLib.dll.0409.mui to the directory that contains your Windows Phone application project file.

    Tip Tip:

    You can use a post-build event to rename and move the file. Copy the following string into the Project Properties, under Configuration Properties, Build Events, Post-Build Events: copy "$[OutputPath]$[DLLProjectName].dll" "$[WindowsPhoneApplicationPath]\AppResLib.dll.0409.mui"

To create additional language resource strings for your application

  • Repeat the previous procedure, renaming the DLL files using the information in the following table. Each DLL file name has the format AppResLib.dll.[locale ID].mui.

    Note Note:

    For a full list of which display languages are supported on which version of Windows Phone, see Culture and Language Support for Windows Phone.

     

    Culture name

    Culture code

    DLL file name

    Chinese Simplified (PRC)

    zh-CN

    AppResLib.dll.0804.mui

    Chinese Traditional (Taiwan)

    zh-TW

    AppResLib.dll.0404.mui

    Czech (Czech Republic)

    cs-CZ

    AppResLib.dll.0405.mui

    Danish (Denmark)

    da-DK

    AppResLib.dll.0406.mui

    Dutch (Netherlands)

    nl-NL

    AppResLib.dll.0413.mui

    English (United Kingdom)

    en-GB

    AppResLib.dll.0809.mui

    English (United States)

    en-US

    AppResLib.dll.0409.mui

    Finnish (Finland)

    fi-FI

    AppResLib.dll.040b.mui

    French (France)

    fr-FR

    AppResLib.dll.040c.mui

    German (Germany)

    de-DE

    AppResLib.dll.0407.mui

    Greek (Greece)

    el-GR

    AppResLib.dll.0408.mui

    Hungarian (Hungary)

    hu-HU

    AppResLib.dll.040e.mui

    Italian (Italy)

    it-IT

    AppResLib.dll.0410.mui

    Japanese (Japan)

    ja-JP

    AppResLib.dll.0411.mui

    Korean (Korea)

    ko-KR

    AppResLib.dll.0412.mui

    Norwegian (Norway)

    nb-NO

    AppResLib.dll.0414.mui

    Polish (Poland)

    pl-PL

    AppResLib.dll.0415.mui

    Portuguese (Brazil)

    pt-BR

    AppResLib.dll.0416.mui

    Portuguese (Portugal)

    pt-PT

    AppResLib.dll.0816.mui

    Russian (Russia)

    ru-RU

    AppResLib.dll.0419.mui

    Spanish (Spain)

    es-ES

    AppResLib.dll.0c0a.mui

    Swedish (Sweden)

    sv-SE

    AppResLib.dll.041d.mui

    Caution note Caution:

    Don’t forget to copy the MUI files to the directory that contains your Windows Phone application project file.

To use the localized resource strings in your Windows Phone application

  1. In Solution Explorer, select your Windows Phone application project.

  2. On the Project menu, click Add Existing Item.

    The Add Existing Item dialog appears.

  3. Select the AppResLib.dll file and all the AppResLib.dll.*.mui files, and then click Add.

    The files are added to your Windows Phone application project.

  4. In Solution Explorer, select the imported DLL files, and in the Properties window, set the Build Action properties to Content.

  5. In Solution Explorer, expand Properties and then double-click WMAppManifest.xml.

  6. Modify the WMAppManifest.xml file to use the AppTitle resource string from the satellite DLLs for the application title used in the application list. The code is highlighted in the following:

     
    Copy
    <App xmlns=""
         ProductID="{product id}"
         Title="@AppResLib.dll,-100"
         RuntimeType="Silverlight"
         Version="1.0.0.0"
         Genre="apps.normal"
         Author="author"
         Description="description"
         Publisher="publisher">
    
    
  7. Modify the WMAppManifest.xml file to use the AppTileString resource string from the satellite DLLs for the application title used in the application Tile. The code is highlighted in the following:

     
    Copy
    <PrimaryToken TokenID="WindowsPhoneApplicationToken" TaskName="_default">
      <TemplateType5>
        <BackgroundImageURI IsRelative="true" IsResource="false">Background.png</BackgroundImageURI>
        <Count>0</Count>
        <Title>@AppResLib.dll,-200</Title>
      </TemplateType5>
    </PrimaryToken>
    
  8. Save and build the Windows Phone application.

To test your localized application title, follow the steps listed at How to: Test a Localized Application for Windows Phone.

posted on   Edward_诺  阅读(702)  评论(0编辑  收藏  举报
编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· .NET周刊【3月第1期 2025-03-02】
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· [AI/GPT/综述] AI Agent的设计模式综述
点击右上角即可分享
微信分享提示