I have a program that gets its language preference from the config file. I want to be able to translate the data in config file whenever a user selects preferred language from a control box in the user interface screen. what kind of function or method do ı need. I just need to change 1 word in the config file from for example English to French
If you are building a .net desktop application that should work in multiple languages, you should check what is available out of the box for globalizing and localizing your application code:
https://learn.microsoft.com/en-us/dotnet/standard/globalization-localization/
And specially the Best practices for developing world-ready applications section.
Related
In My Project, there are different web pages and My requirement is when a User logs on based on user's language,page has to be displayed in user language.
I have googled it,but does not get proper solution.
I have got Satellite Asssemblies as a solution,but how to implement it?
MSDN documentation of ASP.NET localization is good place to start reading about it. Basic steps are as follows:
Localize your web pages - these would create language specific resources that will yield satellite assemblies for supported languages.
Localize other aspects within application e.g. date/time formatting and input, images, user messages etc
Set the culture and UI culture within your web pages as per needs (e.g. based on browser settings or user preference or user selection etc.). See this for how to do it.
See this walk-through that would quickly walks through basic steps.
I have a multi-language windows application that uses standard .net localization in resx files.
Now I have a request to add a possibility for user to create his own language files that are not originally supported and add them to the application without recompiling it.
What's the best approach to achieve this?
I'm considering moving the languages to database and then crating a second tool that'll add translations to the database, but would rather keep the current approach, if it's possible to add resx files dynamically.
This is exactly why I don’t use .NET localization but wrote my own.
I store the translations in files separate from the EXE, have a Windows-Forms-based GUI for translation that I can embed in any application (and working on a WPF clone of it), and allow users to switch languages without restarting the application.
I don’t get why anyone would want it any different and why Microsoft created such a bad and limited system.
Unfortunately, I cannot publish my system right now, but I’m hoping I’ll be able to soon.
One option you can use is keep the translations in an XML file. This way, the user can just drop his own XML file into the folder where the translation exists.
You could write the translations to .resx file and just add the location of that file to the database and then when you want to translate some label just go to the database to see where that file is and then read from it. I'm not sure though how it would fit with a localisation lib...
I am writing a desktop application using MVVM and Prism and I have the following problem. As well as the labels etc it is also necessary to store data in different languages.
For example, in the USA a user might be able to login using either English or Spanish (as they are a native speaker).
If the user logs in using Spanish when they go into a product details
form the product description will be saved to the database against
the Spanish language.
If they log in using English the product description will be saved to
the database and related to the English language.
At the moment my only ideas is as below:-
- a globally accessible ApplicationViewModel that contains a
CurrentLoggedInUser property
What I would like to know is how I go about saving the currently logged in user's chosen language when using MVVM, particularly in a desktop application?
N.B the chosen language can be different to the language and locale that the operating system is in
How do other people go about resolving this and maintaining the user's "session" across different windows / user controls when using MVVM?
All you need to do is store the current language somewhere, maybe as an LCID.
Generally this is used to load a language specific resource file, which takes care of most language dependant situations. Controls etc just store all their strings in resources, so they don't need direct access to the current language.
For situations where you do need access to the language, such as knowing where to save your database string, then yes, the language should be exposed either as some static/singleton, or more desirably, should be injected into whatever ViewModels need it.
I want to add culture to window application so that it can be used globally.
For this I want to use Only one Resource File.
Right now what I do is adds control manually to that file and reads them at page load.
I want this thing to become automated.
How should I proceed
The .Net model is to use a different dll per culture, so if I understand correctly, you're not going to be able to use .NET i18n.
I created one desktop project in C#.
I want to know about how it could be used for different languages.
I created an resx file for all the forms like that:
select particular form goes to the property window set localiztion true select language in which I want to show in particular language. Convert all labels text and other functionality in selected language and build it.
After building one another resx file created other than default resx. This process is done for all the form. So now each form having to resx file. First is hi.resx for hindi and another is default resx.
Now my question is that:
How to give language selection option at installation time?
And when user choose any language then my application is converted in that language. That means particular language resx file set life time whenever user uninstall that application.
Easy to do using NSIS.
Not possible using Windows Installer without a bootstrapper.
What are you wanting to use?