So, I want to localize my app, but I can't find any new guides or documentation, usually the guides either for .NET framework written in like 2015, or guides, that are using RESX, isn't there another way to localize the app instead of using RESX and {x:Static} binding. I know there is RESW, but it looks like that RESW is only supported in UWP.
Can't find any new guides and documentation on WPF localization
45 Views Asked by craftersmine At
1
There are 1 best solutions below
Related Questions in .NET
- file download method in visual studio 2017
- Repository manager receives the wrong connection string in .net core
- MongoDb not connecting C#
- The current .NET SDK does not support targeting .NET Core 6.0. Brand new WPF Project VS Community 2022 17.9.5
- Why Scanning GSI on DynamoDb doesnt work as fast as expected when using CONTAINS?
- Are "blittable types" really unmanaged types for StructLayout Sequential
- Failed to fetch dynamically imported module on Blazor JS Interop
- Problem to upload several images per one request
- Implementing Azure AD B2C Authentication in .NET 8 Blazor Project (RenderMode: InteractiveAuto)
- Stripe connect payout - throws exceptions
- 'IOException: The cloud file provider is not running', when trying to delete 'cloud' folder
- Azure Application Insights Not Displaying Custom Logs for Azure Functions with .NET 8
- Convert C# DateTime.Ticks to Bigquery DateTime Format
- Socket.io nodejs server .NET connection
- Producer Batching Service Bus Vs Kafka
Related Questions in WPF
- Sorting a List by its property renames all the objects in the List
- Can't open new instance of another window in my app, in WPF .NET 8
- Binding forecolour and ToolTip to a DataGrid
- how to create Infinite Upgrades in a clicker game
- Try Catch exception is not catching the unhandled exception
- Assigning an object to another doesn't raise PropertyChanged event in WPF
- Masking input in TextBox
- What should I do if Visual Studio has a restriction on creating files with a long name or a long path to these files?
- reading configuration file (mytest.exe.config)
- WPF Windows Initializing is locking the separated thread in .Net 8
- How to bind to the DataContext ViewModel of another view?
- mouse coordinates in image go below 0 and above width
- WPF pop up is behaving differently in English language PC and Japanese language PC
- Multi level project reference using dll
- Unable to unzip archive .NET framework
Related Questions in LOCALIZATION
- Difficulty with hosting Multilingual Wagtail site on alwaysdata
- Android - Localized text search using english alphabet
- Format datetime in java based on locale
- MaterialApp doesn't rebuild after changing locale
- Text overflow in Flutter localization with easy_localization package
- Translate output of function in Swift
- How to handle decimal input values in a globalized MVC app
- Some users facing issues changing app language in Android app
- Does anyone have any idea why my right-to-left (RTL) layout isn't taking effect immediately?
- Delphi 7 application not loading STRINGTABLE resources on Windows 10
- Auto add resources key/value in resx files
- Implementing Multi-language Translation in React Router DOM with i18n for Outlook Add-ins
- Swift Sort string array with german localization
- Account language setting ignored in Wagtail admin for localized model names
- Updating comments with references in .po translation
Related Questions in RESOURCES
- need help solving this resource allocation problem
- How can I know if spark application/job is idle/waiting for resources?
- Why the strings of Resources contain garbage prefixes different sizes and how to trim it?
- Reading version from resource file dll project
- Azure resource creation issue - "The subscription is not allowed to create or update the serverfarm"
- Some users facing issues changing app language in Android app
- C#: Cannot access Resources dictionary only from MainWindow.xaml.cs file
- Cloning resources group into another
- REST APIs to demonstrate borrowed books and users from library
- Problem while deploying Aks using terraform in Azure
- Visual Studio is not re-generating Resources class anymore
- Can't find any new guides and documentation on WPF localization
- visual studio c# - dynamic insertion of images via reference
- Problem with loading resource Files in JavaFX
- How to give shape to view in adnroid
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I cannot give you a definitive guide, but here is a simple way to localize strings and number/date formatting in WPF. This is the approach I cobbled together from various answers here and other websearching.
Note that, as we discussed in this example, there is no ability for the user to be able to change the language on the fly; Once the language is changed, the app must be restarted.
Suppose your app is one module, named
MyCompany.MyApp. You put all of your strings into a RESX file namedMyStrings.resx. When you build it the output folder might look like thisThis works fine for English but you want to add... French and Japanese. You want not only strings translated into whichever of those languages is current, but you also want number/date formatting to follow that language's default culture.
First, create two new RESX files.
MyStrings.fr.resxandMyStrings.ja.resx, right alongside the mainMyStrings.resx. The key is to use the two-letter lanugage code in the name. You can delete the backing .CS file from these new files; You only need it for the main one.Each of these will hold the translations of every string in
MyStrings.resxfor that language.Next, come up with some way to save to settings an identifier for the lanuguage configured.
At application startup, before you do anything else, get that saved language code from your settings and then obtain (from the system) the
CultureInfofor that language. Use it to set thread cultures. You can useResourceManager.GetResourceSetto obtain it the various cultures. Once you have obtained theCultureInfofor the language that is going to be used, set the thread cultures in this way.What the above buys you is automatic selection of the appropriate string from the appropriate .RESX file based upon the language culture you chose at startup. So if your C# code refers to a string resource in
MyStrings.resxlike this...or if your XAML refers to it like this
The string chosen will be automatically selected from the appropriate .RESX file. If the current language you set up is Japanese, it will be chosen from
MyStrings.ja.resx. If it is French it will be chosen fromMyStrings.fr.resx. if it is English or if it is some culture that you do not have a .RESX file for, it will be chosen fromMyStrings.resxFinally, to deal with number/date formatting, you need to Set this language on the FrameworkElement class metadata. To illustrate, assume that
languageCulturebelow is theCultureInfoof the currently configured language which you obtained at startup.Again, this must be one early before any UI shows. But once you do this, every single call to
IValueConverter.ConvertorIMultiValueConverter.Convertwill receive a CultureInfo that is appropriate for the configured language, regardless of the OS configuration.When you build your project, you will see new subdirectories in the build output. Each subdirectory holds the resource DLLs for a single language. Like this
You will want to ship these with your installed project.
Every time you need to add a new language, all you need is a new .RESX file, you'll get a new subdirectory.
I'm sure there are better ways, more sophisticated ways. But this suits our purpose. Our strings are translated and our number/date formatting looks good