From 2f33dab4c364f223c09a6f94cdd6a2bf205d3b0e Mon Sep 17 00:00:00 2001 From: Andre Kraemer Date: Thu, 22 Feb 2024 17:18:24 +0100 Subject: [PATCH] Enhance DatePicker localization guidance for Windows platforms (#2079) * Enhance DatePicker localization guidance for Windows platforms This commit updates the documentation to provide a more detailed and clarified guidance on how to localize the `DatePicker` control for Windows applications within .NET MAUI. It includes an explanation on declaring supported languages in the `Package.appxmanifest` file, ensuring developers have clear instructions on configuring their apps for multiple locales. The commit is related to https://github.com/dotnet/maui/issues/10805 * Fixed Linter issues * Next try to fix the linter issues * Edit pass. * Fix my typo. --------- Co-authored-by: David Britch --- docs/user-interface/controls/datepicker.md | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/docs/user-interface/controls/datepicker.md b/docs/user-interface/controls/datepicker.md index a22a34d2..c98c51bc 100644 --- a/docs/user-interface/controls/datepicker.md +++ b/docs/user-interface/controls/datepicker.md @@ -81,3 +81,36 @@ However, this is not recommended. Depending on the setting of the `Format` prope + +## Localize a DatePicker on Windows + +For apps targeting Windows, ensuring that the displays dates in a format that's localized to the user's settings, including the names of months and days in the picker's dialog, requires specific configuration in your project's *Package.appxmanifest* file. Localizing the elements in the package manifest improves the user experience by adhering to the cultural norms of the user's locale. + +Localizing the date formats and strings in the `` requires declaring the supported languages within your *Package.appxmanifest* file. + +Follow these steps to configure your for localization on Windows: + +1. Locate the Resources section. + + Navigate to the `Platforms\Windows` folder of your project and open the *Package.appxmanifest* file in a code editor or Visual Studio. If using Visual Studio, ensure you're viewing the file's raw XML. Look for the `` section, which may initially include: + + ```xml + + + + ``` + +1. Specify the supported languages. + + Replace the `` with `` elements for each of your supported languages. The language code should be in the form of a BCP-47 language tag, such as `en-US` for English (United States), `es-ES` for Spanish (Spain), `fr-FR` for French (France) or `de-DE` for German (Germany). For example, to add support for both English (United States) and Spanish (Spain), your `` section should be modified to look like this: + + ```xml + + + + + ``` + +This configuration ensures that the will display date formats, months, and days according to the user's locale, significantly enhancing the app's usability and accessibility across different regions. + +For more information about localization in .NET MAUI apps, see [Localization](~/fundamentals/localization.md).