why the language is change to English in language bar in c# - c#

When I run any project in Visual Studio 2010 the language gets automatically changed to English in language bar of win 7. And when I use the code
Message Box.Show(Thread.Current Thread.Current Culture.Name);
in button event handler. If i select English language or Arabic or any think in the language bar Message Box.Show is print only English
any one help me please

You need to create Resource file for each language, e.g., one for English, another one for Arabic and so on.
You can get more information about .NET Localization from below links:
.NET Localization, Part 1: Resource Managers
.NET Localization, Part 2: Creating Satellite Assemblies
.NET Localization, Part 3: Localizing Text
.NET Localization, Part 4: Localizing Units

Related

How to set fallback value to English on .net application resources

We have a project were we have Resources.resx, Resources.fr.resx and Resources.de.resx.
Let's say the application is set to use Swiss German de-CH. When a string resource is missing for german language I want to see that string in English in my application.
Doing several tests we have noticed that when a string is missing the fallback language string value is set to the system language value.
For example if my german string is missing I want it to being shown in english, but it is being shown in french, which is my windows current language.
Our application is an UWP application.
Does anyone know why this is happening and how to solve it?
EDIT:
I made several tests changing my system culture:
OS (windows) culture english and UWP language fallback value to french: missing translations for german are being set in french.
OS (windows) culture spanish and UWP language fallback value to english: missing translation for german are being set in english.
OS (windows) culture swiss french and UWP language fallback to english: missing translations for german are being set in french which is OS language.
For example if my German string is missing I want it to being shown in English, but it is being shown in French, which is my windows current language.
It is by design, if you have not specific app's language, and if miss translation, it will set the default language base on your system(app contains resource matched with system). And if you app does not contain the language that matched with system. it will direct to app's default language in the app's package manifeat file.
If you want to set the default as English when missing translation, you could set the app's default language as en.
For more please refer this document, and here is official code sample that you could refer.

How to change config file in c#

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.

How to localize Microsoft Bot Application?

I am creating a bot application using Microsoft Bot Framework and want to localize the bot with multiple languages. I have created resource files but I don't know how to proceed with setting the culture. I know about Localizing MVC Web Application but I am not getting how do I do this for the Dialogs in Bot Application.
Create a Resources.resx file for your default language. From there you can create another resx for other languages such as Resources.fr.resx for french. Then change the language in your c# app using something like this:
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("fr-FR");
Console.WriteLine(Properties.Resources.Hello);
To switch back to default set the culture to anything you haven't accounted for. So if you set culture to "en-EN" it will not find anything because we only have Resources.resx and Resources.fr.resx, so it will return to default (Resources.resx) which could be english, german, or anything else.

C# - Visual Studio 2013 - Not compiling in Greek Language

I have a solution in C# with Windows Forms. The property of a form is set to:
Font: Microsoft Sans Serif, 8.25pt
Design: Language-Greek, Localizable-True
I had written the text, labels etc in English and translated them to Greek.
When making the compilation the debug exe is giving the previously English texts.
Is there a way to have the "greek" version of it?
I assume this has to do with the encoding and all.
Thanks!
There is no need to have Languare or Localizable set to Greek and True.
This is used in special cases when part of the code will automatically transformed.
At the question asked, you need to write your text in Greek as normal (change the language of your OS).

How to give language option at installation time of my .NET project?

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?

Categories