Reputation: 11
I have two resource files
strings.resx and strings.fr-CA.resx
Both are embedded as a resource in Monodevelop
The english string is loaded properly. When I change the culture, I get an exception thrown in Resource Manager.
System.Resources.ResourceManager mgr = new System.Resources.ResourceManager("Mobile.Res.strings",System.Reflection.Assembly.GetAssembly(typeof(RC)));
var str = mgr.GetString("PROJECTLIST", Thread.CurrentThread.CurrentCulture);
An exception is thrown in the following system code when the resource is supposed to be loaded. This is found in System.Resources.ResourceManager.
string filename = GetResourceFileName (resourceCulture);
if (!resourceCulture.Equals (CultureInfo.InvariantCulture))
{
/* Try a satellite assembly */
Version sat_version = GetSatelliteContractVersion(MainAssembly);
try
{
Assembly a = MainAssembly.GetSatelliteAssemblyNoThrow(
resourceCulture,
sat_version);
if (a != null)
{
stream = a.GetManifestResourceStream (filename);
if (stream == null)
{
stream = GetManifestResourceStreamNoCase (a, filename);
}
}
}
catch (Exception)
{
// Ignored
}
Assembly a is always null for the other culture resource files and throws an exception.
Am I missing project settings?
This seems to work when I do this in Visual Studio on a normal .net solution.
When I create this in a test .net windows environment, I get folders created in my output directory called fr-CA.
UPDATE:
I have made a little progress with this. I have now created the fr-CA folders using windows and a desktop project. I then copied the folder created by Visual Studio into my .app bundle. After doing this The french resource is used properly in the simulator. I'm not sure if this approach is going to work for an actual device.
Upvotes: 1
Views: 752
Reputation: 19335
This is not going to work on device right now due to this bug. You can CC yourself on that bug to get notified when it's fixed.
I'll try to fix it as soon as possible, but it will take some time until it reaches a released version (if you contact support you can likely get hotfixes though once it's actually fixed).
Upvotes: 1