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.
Related
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.
i've started using Bing API translator. all the things is ok but when I tried to translate to it with culture code 'fr-ca',fr-FR then it is translating only using language code 'fr' not with culture code (ca, FR) 'fr-ca', 'fr-FR'.
When I called this API method to translate
translationQuery.Execute().ToList();
throws this exception :
--------An error occurred while processing this request.
and the inner exception is :
--------"Parameter: To has an invalid pattern of characters"
source : System.Data.Services.Client
can any one help me about this problem? and tell me how to translate text with culture code with anyway either API or something else ?
Thanks In advance
sunil
Thanks for your response.
I have more than 10 files and each files have 1000 words that needs to transalate into another languages on bases of culture code not only language code.
English en-GB British English
en-US American English
en-CA Canadian English
Spanish es-ES Castilian Spanish (as written and spoken in Spain)
es-MX Mexican Spanish
es-AR Argentine Spanish
es-CO Colombian Spanish
Portuguese pt-PT European Portuguese (as written and spoken in Portugal)
pt-BR Brazilian Portuguese
Chinese zh-CN Mainland China, simplified characters
zh-TW Taiwan, traditional characters
zh-HK Hong Kong, traditional characters
Instead of doing translation manually is there any others way to translate e.g(es-ES,es-MX,es-CO, es-AR ) ?. since its langauge code is same for all eg:-(es) but have different culture code for each languages. So it may be case that some words have different meaning in es-es and have diffent means in es-MX, es-Co etc.
it would be helpful if found a way to translate on bases of culture code?
Thanks in Advance
Sunil
The reason is that Bing translator doesn't support Canadian French, only Standard French:
http://msdn.microsoft.com/en-us/library/hh456380.aspx
Microsoft Translator continually adds to the list of supported languages for the Translation and Text to Speech methods. You can always obtain the current list of available language codes using the
GetLanguagesForTranslate() or GetLanguagesForSpeak() methods. These methods will return a language code. You can translate that language code into a friendly name in any of the supported languages using the GetLanguageNames() method. Below are the friendly names in English - you can retrieve them in any of the listed languages using GetLanguageNames(). Here is the list (as of February 2014):
...
fr French
If you want to use Canadian French, you'll have to perform the relevant word swaps afterwards manually.
Ss an aside, Google Translate also only supports Standard French.
I have a software developed in C#, which is a pure sentefic application. Howver the German users found this software stopped working from time to time, when it is installed on German computers. The temporary solution is to change the Language setting in the control panel, and it works fine after we change the language setting from German to English. This is just a kind of engineering sofware, and the software have nothing relalted to the German or English language. Also, as suggested from other posts in msdn, I have checked the "InitializeComponent()" in the source does several times. There are not strange codes in the "InitializeComponent()" function.
When you change locale, you change the meaning of ',' (comma) and '.' (full-stop) when used in numbers. Could it be that you are trying to parse text containing these characters into numbers?
Does your program attempt to initialize numeric fields with formatted numbers, perhaps?
You need to make sure that your code is sensitive to the user's culture when parsing and formatting text. You also need to make sure you use a consistent culture (e.g. the InvariantCulture) when reading data stored to file or sent over a network.
If you are using .NET Framework 4.5, you might be interested to read about the CultureInfo.DefaultThreadCurrentCulture Property.
In the .NET Framework 4 and previous versions, by default, the culture
of all threads is set to the Windows system culture. For applications
whose current culture differs from the default system culture, this
behavior is often undesirable.
The examples and their explanations on the page could be quite helpful for your issue.
Also, as a side note, try{...}catch{...} blocks are always welcome.
I have a question about Windows Phone localization. I checked culture and language support for windows phone, for English, there's only English (United States) and English (United Kingdom). I also want to ad English support for Canada and Australia, so how can I do that? Also The display language setting in emulator only has English (United States) and English (United Kingdom) for English, so how can I test other English countries such as Canada and Australia? Thanks!
Fei
Windows Phone 7 has a limited support matrix right now for culture/language combinations. You can see this language support list on MSDN. I would recommend coding to en-CA for Canada if you desire it.
There's some guidance on how to support non-supported languages in WP7 from Microsoft if you view "How do I localize for a language that isn't supported?" section. You're not going to like it though. Here's the snippet of the steps.
Hard code your app to be written in the unsupported language, if you don't plan on supporting more languages in the future. OR, create
your default AppResources.resx file and put your unsupported language
strings in there, if you plan on supporting more languages in the
future or will support additional languages in your submission.
Set your neutral language to one of the supported display languages. For example, 'English (United States)'.
On App Hub, you will be prompted to input metadata and a description for the neutral language you chose (for the above example,
you'll be prompted for English). You must include the following three
items in the 'Detailed description' field to pass certification:
A note, such as ‘The language of this application is [unsupported
language name]’. This note must be written in the same language as the
neutral language. For example, if you chose 'English (United States)'
as your neutral language, the note must be written in English (United
States). This note must be the first item in the ‘Detailed
description’ field. Your app description, in the same language as the
neutral language. Your app description, in the unsupported language.
I would also recommend sticking it in an en-CA file so you can easily swap to it if/when support comes.
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