Can't change default language of an assembly in Visual Studio 2017 - visual-studio

My application supports three languages: en, es, and fr. When I build my (clean, from a template) UWP application, I get the message:
warning PRI257: 0xdef00522 - Resources found for language(s) 'en,es,fr' but no resources found for default language(s): 'en-US'. Change the default language or qualify resources with the default language.
So then I go into the manifest and change the default language from en-US to en-GB and when I recompile I get:
warning PRI257: 0xdef00522 - Resources found for language(s) 'en,es,fr' but no resources found for default language(s): 'en-GB,en-US'. Change the default language or qualify resources with the default language.
What gives? How do I replace the default language in a UWP application so that it doesn't try to find en-US resources?

To remove the warning, you have to update the language in 2 places:
Default language in appxmanifest, which gets saved in the csproj file as <DefaultLanguage>en-GB</DefaultLanguage>
Neutral assembly language, which is saved in the AssemblyInfo file as [assembly: NeutralResourcesLanguage("en-GB")] and can also be changed through the project's properties > assembly information.
Next to that, you have to use a full language qualifier (en-US, en-GB, ...) as the default language, as 'en' gets just redirected to en-US as the default language. Other languages can be language-only qualifiers (fr).
Note that specifying your assets with a full qualifier doesn't break other regional languages from using these resources.
Windows does cross regional matching. For example, en-US matches en-US, then en, and then en-*.
Imho it's even better to use the full qualifier as your translation is done in one of the regional languages (quite often the main region), so fr-FR is more accurate to tag your resource file than just fr.

Related

Localization of Win32 Application without DLLs (VS2010)

I need to add the support for a number of languages for Win32 GUI application (ATL/WTL).
There are two restrictions:
Project is built using Visual Studio 2010 (no C++11 and also no MFC)
Result must be only ONE standalone *.exe (no additional files/DLLs)
The first and, actually, the only way I found (without DLLs) is to use STRINGTABLE in Resource-file, naming localizable strings like:
WHAT_IS_YOUR_NAME_EN = ...
WHAT_IS_YOUR_NAME_ES = ...
WHAT_IS_YOUR_NAME_DE = ...
etc...
And after, at the Application start, to detect current locale and to load correspondingly post-fixed strings from Resource STRINGTABLE (e.g., "*_DE")
But it looks ugly (no?) and difficult to maintain and to add new languages.
Please, help with alternative advice.
Thank you!

Adding other language (like VC++ ,etc) quality profiles in sonarqube

How can i set quality profile for languages like VC++ . When I am clicking on 'Create' in quality profiles it shows only java,C#,javascript in dropdown. Can I add quality profiles for languages other than these three ?
The profile creation dropdown is showing you a list of the languages recognized / loaded in your SonarQube instance. If you're not seeing C++, that means you don't have an analyzer on board that supports the language. Without an analyzer, there's no need for a profile because the analyzer:
parses the language
computes basic metrics
provides the rules that would go into your profile
So your first step is to get set up with a code analyzer for the language (one is available as part of the Developer Edition($)). It will come with a default profile, and enable you to create additional profiles.

Using i18n with RequireJS in Visual Studio 2015 Cordova App project

I got a weird thing happening when I try to run the Windows application produced by the Cordova project in Visual Studio 2015.
The application uses the third-party libs i18n along with RequireJS to translate any text based on the language chosen by the user. The problem is that no text is loaded without any form of error or whatsoever. The same exact code works for Android and iOS builds just fine.
I went into debug to find out something weird, whatever language I submit will return the value undefined. Even weirder, if I require specifically the root file manually, it will load the english version of the file.
Any help would be appreciated.
Here's a sample project that mimics the exact problem.
CordovaTest.rar
The issue you're running into with Windows is its support of qualifiers in file names to support localization.
Resource qualifiers are folder and filename modifiers that identify
the context in which a particular version of a resource should be
used.
Contexts can include locales which is what you've run into here. Long story short, here's what it looks like is happening:
Your app's default language is set to "fr" right now
When the app starts on Windows, it sees that you're running as the "fr" local and it hides any folders qualified as targeting other locales. In this case, your app has an "en" folder that is seen as a qualifier for the English language, and Windows will hide the "en" folder contents.
It's really hard to explain the first time around, so let me know if you want clarification on the above and I can try to re-phrase it.
To fix your issue, you would want to use folder names that are not seen by Windows as qualifiers. For example, you could name your "en" folder and call it "English". Then, change your RequireJS bundle configuration to define the "english" locale:
define({
"root": {
"Test" : "TestFR"
},
"english":true
});
Now when you run your app, you'll see it working.

How to use neutral language in Windows Phone

I am facing the following issue:
I have translated my application into different languages using resx files. I want to use the same resx files in other apps as well.
For different apps, I should be able to change the default language (some apps will only be available in Spanish, others only in English, and others multilingual)
I figured I could just name the resources LanguageStrings.es.resx and LanguageStrings.en.resx, and use NeutralResourcesLanguageAttribute to set the default language of the app.
However, when there is no LanguageStrings.resx (invariant file) in the app, the application seems to break (MissingManifestResourceException). I thought the Resource Manager should use the setting in NeutralResourcesLanguageAttribute to find the correct resource (for example; fall back to Spanish) instead of looking for a neutral file.
Is my assumption correct and am I running into a platform bug? I have noticed that ResourceManager.GetNeutralResourcesLanguage doesn't returned the language defined using NeutralResourcesLanguageAttribute, but invariant culture instead
Without a invariant resource file (LanguageStrings.resx), the compiler won't pick it up. You should let the English resource file (Currently LanguageStrings.en.resx) be the invariant file, ie. without .en in the filename, and then set
[assembly: NeutralResourcesLanguage("en")]
All .NET applications work this way. It's not a unique "issue" to Windows Phone.
I believe if you specify your language as supported in the element in your csproj - you need to have the resx that you are trying to use in the supported culture. If you use the language that is supposedly supported and the resx is not there - you will get a MissingManifestResourceException. Neutral language will be picked up if the current language is not supported.

Setting language for xml documentation

I have localized version of Visual Studio and in new solutions XML-documentation from Base Class Library is displayed in IntelliSense in my language. But when I open solutions downloaded from Internet, this documentation is displayed in English. How can I choose this language?
I looked over project and solution properties and but did not found such setting. Changing language of assembly does not affects this. Possibly IntelliSense language setting is stored in hidden .suo file, but is is in binary format.
Actually I need to change documentation language because I am using GhostDoc and it generates documentation for member overloads in current IntelliSense language while generating all other documentation in English. GhostDoc also does not have such setting.
A little late but the answer is:
There is no such setting.
GhostDoc searches for the documentation of the .NET assemblies which are referenced.
Therefore if an english dll is referrenced, the documentation is in english
It is even worse, existing comments for own written methods seem tobe from file code model of VS, base classes from their documentation.
So you can have the case that you try to "ghostcomment" a method and get english, and another one is displayed in spanish )...

Resources