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.
Related
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.
I need to translate app name based on mobile culture.
i have seen many sample for that, but in most of the samples, only translate the set of language and assign in resource file.
But i need to translate app name to all mobile supported language.
Is there any solution to achieve that?
The app name should be localized in each platform.
For iOS:
iOS uses a naming standard called Localization Projects or .lproj
directories to contain image and string resources. These directories
can contain localized versions of images used in the app, and also the
InfoPlist.strings file that can be used to localize the app name.
See document here: localization#app-name-ios
There is also a sample in this thread: localized-app-name-for-xamarin-ios
For Android:
Android follows a different scheme for storing localized images using
different drawable and strings directories with a language code
suffix. When a four-letter locale code is required (such as zh-TW or
pt-BR), note that Android requires an additional r following the
dash/preceding the locale code (eg. zh-rTW or pt-rBR).
See document here: localization#app-name-android
But i need to translate app name to all mobile supported language.
You can add as many as possible resource files of different languages in your project to support the transfer of all mobile supported language.
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.
Ive been using C#s (Visual Studios) resourcing mechanism and its worked nicely. I have a need to be able to use resources but instead of using CultureInfo as the determinator use something else. This is my current setup which works fine however I have to workout which Resource Manager to use. Either Brussels or Paris. The Resource Manager then works out which resource to use within Brussels or Paris to invoke. What I want is one resource manager for both, so I dont need to decide which resource manager to use. Part of the problem is the PublicResXFileCodeGenerator Custom Tool generates the code for you (which is very nice if you use the standard approach)
This is what it currently looks like (This is working fine)
Brussels Resources
brussels.en-GB.resx
brussels.ja-JP.resx
brussels.fr-FR.resx
brussels.resx
Paris
paris.en-GB.resx
paris.ja-JP.resx
paris.fr-FR.resx
paris.resx
I dont want to use the CultureInfo but instead specify my own resx identifier. Is there a way to do this using resx file?
etc
Brussels and Paris Resources
MyResourceManager.brussels-en-GB.resx
MyResourceManager.brussels-ja-JP.resx
MyResourceManager.brussels-fr-FR.resx
MyResourceManager.paris-en-GB.resx
MyResourceManager.paris-ja-JP.resx
MyResourceManager.paris-fr-FR.resx
MyResourceManager.resx
EDIT:
An example of how I would like to use it (or something similar)
MyResourceManager.Header
instead of
brussels.Header
paris.Header
An example of a similar problem but solved through Custom Cultures can be found here.
How to load different RESX files based on some parameter
I dont want to do this however as installing cultures on different machines is not an option.
Use CultureInfo to determine the resource set to load, it will be easier since it integrates into the Thread.CurrentUICulture.
If you have cultures that are not standard out of the box supported cultures, use CultureAndRegionInfoBuilder to build any additional cultures that you need. See http://msdn.microsoft.com/en-us/library/system.globalization.cultureandregioninfobuilder.aspx. There should be ample StackOverflow examples of using this API, i.e. Create custom culture in ASP.NET.
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?