myriadstones

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

1.        The structure of your application determines the files and resources that you will deploy to your server. These components vary depending on your application's complexity and resource usage patterns. For example, your application might be entirely self-contained within a single application package file. Alternately, it might use a variety of separate resources, such as data or media files, deep-zoom image collections, or Web services.

2.        When you create a localized application, you also create one or more satellite assemblies that contain resources localized for specific cultures and locales. You can deploy all satellite assemblies within a single application package, or create application packages that target one or more cultures and provide logic on the server that downloads the appropriate package to each user.

3.        Globalization is closely related to localization. It involves designing and developing applications that support localized user interfaces and regional data for users in multiple cultures.

4.        The invariant culture is loosely based on the English language but is culture-independent.

5.        CultureInfo.CurrentCulture returns a CultureInfo object that represents the user's current culture. The current culture can be set on a per-thread basis and is used in operations such as parsing, formatting, and culture-sensitive casing, sorting, and string comparison.

6.        CultureInfo.CurrentUICulture returns a CultureInfo object that represents the user's current user interface (UI) culture. The current UI culture can be set on a pre-thread basis and is used in retrieving resources from satellite assemblies.

7.        If you retrieve a CultureInfo object that represents either the current culture or the current UI culture, or if you instantiate a new CultureInfo object that represents the user's current culture, the CultureInfo object will reflect any customizations that the user has made.

8.        The .NET Framework for Silverlight provides data for the invariant culture, but it retrieves information about all other cultures from the operating system. This means that the information that is available to a specific culture may differ across operating systems or even across versions of the same operating system. In some cases, data may even be unavailable, in which case data from the invariant culture will be used instead. The developer should make no fixed assumptions about the values of particular properties or particular objects returned by specific cultures.

9.        The document is returned using the default serialization format, which is Atom. When the browser is used to query the data service, this is the only format supported.

10.    The .NET Framework for Silverlight retrieves the CultureInfo object from two properties: CultureInfo.CurrentCulture, which is used in text casing and comparisons, as well as in formatting dates and numbers; and CultureInfo.CurrentUICulture, which is used to retrieve user interface resources.

11.    In some cases, you may want to change the current culture or the current UI culture of your Silverlight-based application. However, the CultureInfo.CurrentCulture and CultureInfo.CurrentUICulture properties are read-only. Therefore, they cannot be used to change the current culture. To change the current culture, you must assign a new CultureInfo object to the Thread.CurrentCulture property of the current thread.

12.    In the .NET Framework for Silverlight, a customized CultureInfo object can be created only by modifying an existing object. You cannot create a new custom CultureInfo object from scratch. To customize the values of a read-only CultureInfo object, you must make a copy of the original object by calling the CultureInfo.Clone method. This method returns a read/write copy of the original CultureInfo object. Unlike most Clone methods, it also returns an enhanced shallow copy of the objects returned by the CultureInfo.DateTimeFormat, CultureInfo.NumberFormat, CultureInfo.Calendar, and CultureInfo.TextInfo properties.

13.    The culture that is returned by the CultureInfo.InvariantCulture property represents neither a neutral nor a specific culture. It represents a third type of culture that is culture-insensitive. This culture is associated with the English language, but it is not associated with a country or region. You can use the InvariantCulture property with almost any method in the System.Globalization namespace that requires a culture.

14.    Use the invariant culture for operations that require culture-independent results. In other cases, it might produce results that are linguistically incorrect or culturally inappropriate.

15.    The XAML parser in SilverLight always uses the English ("en") culture. This means that, if your application generates XAML dynamically and then loads it at run time by using the XamlReader.Load method, any numeric data should be formatted using the conventions of the "en" culture rather than the current culture.

16.    Visual Studio and the .NET Framework common language runtime handle most of the details of compiling the resource files and loading the appropriate resource for the user's current culture, provided that the resource files have been named correctly and the project has been configured properly.

17.    When the project is compiled, the resources for the default culture are included in the main assembly for the Silverlight-based application, which is included in the .xap file. In addition, the satellite assembly for each culture that is specified by the <SupportedCultures> property in the project file is included in the application's .xap file. Each satellite assembly is also listed in the <Deployment.Parts> section of the AppManifest.xml file.

18.    In the application's .xap file, each satellite assembly is packaged in a subdirectory of the application directory. The individual satellite assemblies are all named applicationName.Resources.dll and are stored in a subdirectory whose name specifies the culture that is represented by the satellite assembly's resources. For example, resources for the German (Germany) culture ("de-DE") are stored in the de-DE subdirectory.

19.    This approach creates a download that includes all the localizable resources of a Silverlight-based application. If an application has been localized for many cultures or the size of localized resources is significant, this method of deployment will increase the size of the application and lengthen its download time. Instead, you can create separate versions of a Silverlight-based application that target specific cultures.

20.    Making XAML localizable is similar to localizing code: You place all the localizable strings into a separate resource (.resx) file, and you use XAML code that extracts the strings from that file. To extract the strings, you use the {Binding} markup extension to bind a XAML property to the strongly typed wrapper that Visual Studio generates for resource files.

21.    You can also make XML content, rich text, non-string values, and non-dependency properties localizable.

22.    To support localized out-of-browser applications, you have to create a new .xap file for each localized culture or locale that your application supports. In Visual Studio, you can do this by creating new build configurations.

23.    You may also want to make the window title, shortcut name, and description of the out-of-browser application localizable. Ordinarily, an out-of-browser application retrieves its window settings from the application's OutOfBrowserSettings.xml configuration file. To localize the application's window settings, you create a unique OutOfBrowserSettings.xml file for each culture that you support.

24.    A translated string may take more room on the screen than the original string. For this reason, it is recommended that you use automatic layout for elements that contain localized text.

25.    Avoid the Canvas control, which uses hard-coded sizes and positions. Instead, use the Grid control, the StackPanel, or other panel elements that support automatic layout.

26.    To properly display Chinese, Japanese, and Korean text, Silverlight needs to know which language it is displaying, because the same Unicode characters are displayed differently depending on language. Silverlight determines the language from the FrameworkElement.Language property or from the xml:lang attribute. If your XAML applies to only a single language, you can simply set the property at the top of the file.

27.    If you want your XAML to be localizable, you want to set the Language property to a localized value. To do this, create an entry such as Language in your resource file, and assign it a value that is the name of the localized language or culture. Change the XAML to use a {Binding} markup extension in the same way that you would localize any other property.

28.    In most cases, you want users to download a Silverlight-based application that contains only the resources of their neutral and specific culture, instead of the resources in the complete set of localized satellite assemblies. You can use Visual Studio to create a localized Silverlight-based application that contains a designated subset of your application's satellite assemblies. You can then use ASP.NET to deploy the application based on the user's culture.

29.    Determining the User's Culture; Retrieving Specific Localized Resources.

posted on 2009-08-10 09:13  卞磊  阅读(671)  评论(0编辑  收藏  举报