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.
Related
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!
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.
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.
My application doesn't support localization , it support only usEnglish. Whenever i opened the apk details it shows Localizations:default + 50 languages. Why it is showing like this.
If you use Android library projects that included other languages (eg. strings.xml in values-fr), then Google Play would detect the partial translation for other languages and take it as a supported language. The only way to correct this is probably to remove strings from language-specific values directories from all the Android lib projects your project uses.
The XNA game that I am working on for WP7 supports multiple languages. However, something seems to be happening during the obfuscation process which seems to cause the language to always be set to English (the default language, in this case), at least according to the Resource class.
For example, each resource pack contains the following definition:
RESOURCE_IDX -> #
And each resource pack is given a different #. In an un-obfuscated build, the correct index is pulled out based on the device's current language. However once obfuscation occurs, the Resource class automatically selects the value associated with English even if the device is set to Spanish.
Is there a setting that I'm missing in the obfuscation process that is causing this?
It would appear that my issue was related to the renaming of the Resource class. That class is simply a set of auto-generated getters based on the contents of the resource packs. Somehow, subjecting that class to renaming during obfuscation caused the improper value to be returned (I won't speculate on why).
Once I prevented that class from being renamed, the rest of the application worked as expected.