all groups > dotnet internationalization > september 2006 >
You're in the

dotnet internationalization

group:

Satellites not found for manually loaded assemblies


Satellites not found for manually loaded assemblies Jan
9/6/2006 9:28:01 PM
dotnet internationalization: Hi,
my application loads assemblies with sub features by Assembly.LoadFrom,
depending on what features user chooses to run.

Each assembly needs to be localized. I'm using satellite resource assemblies
in subfolders. But the satellites are not found by program and defaults are
used. FUSLOGVW shows that they are searched only in appbase and private path
of the main application but the sub assemblies are not directly there.

Is it somehow possible to use the standard resource lookup in this way or do
I have to load also resource assemblies with Assembly.LoadFrom and forget
help of framework ?
I don't want to modify .config of the main application, nothing is known
about the sub assemblies in advance.

Thanks,
RE: Satellites not found for manually loaded assemblies aldod NO[at]SPAM online.microsoft.com (
10/12/2006 10:07:59 PM
Hi Jan,
I have tried and in my test the proper resources were loaded for the sub features' assemblies, regardless if they were in a different folder.
Are you just testing the resource loading by setting the CurrentUICulture on the main application? In this case, the CurrentUICulture does not propagate to different threads or child apps you might load with
LoadFrom and might be the reason why the sub features' resources are not loaded.

thanks,
Aldo


-- This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
| Thread-Topic: Satellites not found for manually loaded assemblies
| thread-index: AcbSNgFJF2ifpAhkTAqzB4wtfvmExg==
| X-WBNR-Posting-Host: 81.27.194.73
| From: =?Utf-8?B?SmFu?= <Jan@discussions.microsoft.com>
| Subject: Satellites not found for manually loaded assemblies
| Date: Wed, 6 Sep 2006 21:28:01 -0700
| Lines: 17
| Message-ID: <206E86AC-3BFD-43D8-AF6B-3ADFEE5DAA5B@microsoft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
| Newsgroups: microsoft.public.dotnet.internationalization
| Path: TK2MSFTNGXA01.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.internationalization:2483
| NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
| X-Tomcat-NG: microsoft.public.dotnet.internationalization
|
| Hi,
| my application loads assemblies with sub features by Assembly.LoadFrom,
| depending on what features user chooses to run.
|
| Each assembly needs to be localized. I'm using satellite resource assemblies
| in subfolders. But the satellites are not found by program and defaults are
| used. FUSLOGVW shows that they are searched only in appbase and private path
| of the main application but the sub assemblies are not directly there.
|
| Is it somehow possible to use the standard resource lookup in this way or do
| I have to load also resource assemblies with Assembly.LoadFrom and forget
| help of framework ?
| I don't want to modify .config of the main application, nothing is known
| about the sub assemblies in advance.
|
| Thanks,
| Jan
|

RE: Satellites not found for manually loaded assemblies aldod NO[at]SPAM online.microsoft.com (
10/12/2006 10:34:16 PM
Hi again Jan,
during a second test I have noticed that the assembly that you load with LoadFrom is actually getting the same Thread.CurrentThread.CurrentUICulture object as the main application and it's loading resources
appropriately. So I'm not sure what's happening in your case.

From the main assembly I have invoked the sub DLL as follows

Thread.CurrentThread.CurrentUICulture = new CultureInfo("it");

Assembly c = Assembly.LoadFrom(@"C:\Test\D\D\bin\Debug\D.dll");
Object o = c.CreateInstance("D.Class1", true);
MethodInfo m = c.GetType("D.Class1").GetMethods()[0];
Object o2 = m.Invoke(o,null);

the main assembly is in a different location than the sub DLL and they both load their appropriate resources from their respective locations (the sub DLL loads its Italian resources)

Aldo

-- This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
| X-Tomcat-ID: 548411376
| References: <206E86AC-3BFD-43D8-AF6B-3ADFEE5DAA5B@microsoft.com>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: aldod@online.microsoft.com ("Aldo Donetti [MS]")
| Organization: Microsoft
| Date: Thu, 12 Oct 2006 22:07:59 GMT
| Subject: RE: Satellites not found for manually loaded assemblies
| X-Tomcat-NG: microsoft.public.dotnet.internationalization
| Message-ID: <olaDirk7GHA.4348@TK2MSFTNGXA01.phx.gbl>
| Newsgroups: microsoft.public.dotnet.internationalization
| Lines: 59
| Path: TK2MSFTNGXA01.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.internationalization:2518
| NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
|
| Hi Jan,
| I have tried and in my test the proper resources were loaded for the sub features' assemblies, regardless if they were in a different folder.
| Are you just testing the resource loading by setting the CurrentUICulture on the main application? In this case, the CurrentUICulture does not propagate to different threads or child apps you might load with
| LoadFrom and might be the reason why the sub features' resources are not loaded.
|
| thanks,
| Aldo
|
|
| -- This posting is provided "AS IS" with no warranties, and confers no rights.
|
|
| --------------------
| | Thread-Topic: Satellites not found for manually loaded assemblies
| | thread-index: AcbSNgFJF2ifpAhkTAqzB4wtfvmExg==
| | X-WBNR-Posting-Host: 81.27.194.73
| | From: =?Utf-8?B?SmFu?= <Jan@discussions.microsoft.com>
| | Subject: Satellites not found for manually loaded assemblies
| | Date: Wed, 6 Sep 2006 21:28:01 -0700
| | Lines: 17
| | Message-ID: <206E86AC-3BFD-43D8-AF6B-3ADFEE5DAA5B@microsoft.com>
| | MIME-Version: 1.0
| | Content-Type: text/plain;
| | charset="Utf-8"
| | Content-Transfer-Encoding: 7bit
| | X-Newsreader: Microsoft CDO for Windows 2000
| | Content-Class: urn:content-classes:message
| | Importance: normal
| | Priority: normal
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
| | Newsgroups: microsoft.public.dotnet.internationalization
| | Path: TK2MSFTNGXA01.phx.gbl
| | Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.internationalization:2483
| | NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
| | X-Tomcat-NG: microsoft.public.dotnet.internationalization
| |
| | Hi,
| | my application loads assemblies with sub features by Assembly.LoadFrom,
| | depending on what features user chooses to run.
| |
| | Each assembly needs to be localized. I'm using satellite resource assemblies
| | in subfolders. But the satellites are not found by program and defaults are
| | used. FUSLOGVW shows that they are searched only in appbase and private path
| | of the main application but the sub assemblies are not directly there.
| |
| | Is it somehow possible to use the standard resource lookup in this way or do
| | I have to load also resource assemblies with Assembly.LoadFrom and forget
| | help of framework ?
| | I don't want to modify .config of the main application, nothing is known
| | about the sub assemblies in advance.
| |
| | Thanks,
| | Jan
| |
|
|
|

RE: Satellites not found for manually loaded assemblies Jan
10/13/2006 3:21:01 AM
Hi Aldo,
thanks for answer.

I need to read localized strings. The dll project contains embedded
resource.resx with English texts and resource.cs.resx with Czech ones. Build
creates localized *.resources.dll in subfolder "cs".

I try to load strings in the program like this:
System.Threading.Thread.CurrentThread.CurrentUICulture = new
System.Globalization.CultureInfo("cs");
System.Resources.ResourceManager resourceManager = new
System.Resources.ResourceManager("namespace.resource",
this.GetType().Assembly);
string txt = resourceManager.GetString("stringID");

FUSLOGVW shows that the resource manager searches for the cs resource dll in
subforlers of the main application, not at the dll location.

Should I do it in different way ?

Regards,
Jan

[quoted text, click to view]
RE: Satellites not found for manually loaded assemblies aldod NO[at]SPAM online.microsoft.com (
11/9/2006 3:25:03 AM
Sorry for the delay Jan - you must have figured it out by now, but if not, you can manually load resources by either:

1. manually locate and load the DLL with LoadFrom, then use a resourceManager on that, as in
string p = Application.StartupPath;
Assembly c = Assembly.LoadFrom(p + @"\cs\LoadResourcesManually.resources.dll");
System.Resources.ResourceManager rm = new System.Resources.ResourceManager("LoadResourcesManually.Form1.cs", c);
string txt = rm.GetString("label1.Text");
note that in this case you don't need to set a UICulture because you're loading the DLL containing resources manually

2. do what the Windows Forms' code-behind does and use the ComponentResourceManager
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("cs");
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
string txt = resources.GetString("label1.Text");

3. use the "old" way
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("cs");
System.Resources.ResourceManager rm = new System.Resources.ResourceManager(typeof(Form1));
string txt = rm.GetString("label1.Text");

HTH
Aldo

-- This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
| Thread-Topic: Satellites not found for manually loaded assemblies
| thread-index: AcbusUhsYyfUXZiBTqux93bt0FnAOQ==
| X-WBNR-Posting-Host: 212.111.31.254
| From: =?Utf-8?B?SmFu?= <Jan@discussions.microsoft.com>
| References: <206E86AC-3BFD-43D8-AF6B-3ADFEE5DAA5B@microsoft.com> <olaDirk7GHA.4348@TK2MSFTNGXA01.phx.gbl> <pwyWP6k7GHA.4348@TK2MSFTNGXA01.phx.gbl>
| Subject: RE: Satellites not found for manually loaded assemblies
| Date: Fri, 13 Oct 2006 03:21:01 -0700
| Lines: 123
| Message-ID: <A3934409-0993-4158-9611-68630E7FBA21@microsoft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
| Newsgroups: microsoft.public.dotnet.internationalization
| Path: TK2MSFTNGXA01.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.internationalization:2523
| NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
| X-Tomcat-NG: microsoft.public.dotnet.internationalization
|
| Hi Aldo,
| thanks for answer.
|
| I need to read localized strings. The dll project contains embedded
| resource.resx with English texts and resource.cs.resx with Czech ones. Build
| creates localized *.resources.dll in subfolder "cs".
|
| I try to load strings in the program like this:
| System.Threading.Thread.CurrentThread.CurrentUICulture = new
| System.Globalization.CultureInfo("cs");
| System.Resources.ResourceManager resourceManager = new
| System.Resources.ResourceManager("namespace.resource",
| this.GetType().Assembly);
| string txt = resourceManager.GetString("stringID");
|
| FUSLOGVW shows that the resource manager searches for the cs resource dll in
| subforlers of the main application, not at the dll location.
|
| Should I do it in different way ?
|
| Regards,
| Jan
|
[quoted text, click to view]
|
| > Hi again Jan,
| > during a second test I have noticed that the assembly that you load with LoadFrom is actually getting the same Thread.CurrentThread.CurrentUICulture object as the main application and it's loading resources
| > appropriately. So I'm not sure what's happening in your case.
| >
| > From the main assembly I have invoked the sub DLL as follows
| >
| > Thread.CurrentThread.CurrentUICulture = new CultureInfo("it");
| >
| > Assembly c = Assembly.LoadFrom(@"C:\Test\D\D\bin\Debug\D.dll");
| > Object o = c.CreateInstance("D.Class1", true);
| > MethodInfo m = c.GetType("D.Class1").GetMethods()[0];
| > Object o2 = m.Invoke(o,null);
| >
| > the main assembly is in a different location than the sub DLL and they both load their appropriate resources from their respective locations (the sub DLL loads its Italian resources)
| >
| > Aldo
| >
| > -- This posting is provided "AS IS" with no warranties, and confers no rights.
| >
| >
| > --------------------
| > | X-Tomcat-ID: 548411376
| > | References: <206E86AC-3BFD-43D8-AF6B-3ADFEE5DAA5B@microsoft.com>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain
| > | Content-Transfer-Encoding: 7bit
| > | From: aldod@online.microsoft.com ("Aldo Donetti [MS]")
| > | Organization: Microsoft
| > | Date: Thu, 12 Oct 2006 22:07:59 GMT
| > | Subject: RE: Satellites not found for manually loaded assemblies
| > | X-Tomcat-NG: microsoft.public.dotnet.internationalization
| > | Message-ID: <olaDirk7GHA.4348@TK2MSFTNGXA01.phx.gbl>
| > | Newsgroups: microsoft.public.dotnet.internationalization
| > | Lines: 59
| > | Path: TK2MSFTNGXA01.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.internationalization:2518
| > | NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
| > |
| > | Hi Jan,
| > | I have tried and in my test the proper resources were loaded for the sub features' assemblies, regardless if they were in a different folder.
| > | Are you just testing the resource loading by setting the CurrentUICulture on the main application? In this case, the CurrentUICulture does not propagate to different threads or child apps you might load with
| > | LoadFrom and might be the reason why the sub features' resources are not loaded.
| > |
| > | thanks,
| > | Aldo
| > |
| > |
| > | -- This posting is provided "AS IS" with no warranties, and confers no rights.
| > |
| > |
| > | --------------------
| > | | Thread-Topic: Satellites not found for manually loaded assemblies
| > | | thread-index: AcbSNgFJF2ifpAhkTAqzB4wtfvmExg==
| > | | X-WBNR-Posting-Host: 81.27.194.73
| > | | From: =?Utf-8?B?SmFu?= <Jan@discussions.microsoft.com>
| > | | Subject: Satellites not found for manually loaded assemblies
| > | | Date: Wed, 6 Sep 2006 21:28:01 -0700
| > | | Lines: 17
| > | | Message-ID: <206E86AC-3BFD-43D8-AF6B-3ADFEE5DAA5B@microsoft.com>
| > | | MIME-Version: 1.0
| > | | Content-Type: text/plain;
| > | | charset="Utf-8"
| > | | Content-Transfer-Encoding: 7bit
| > | | X-Newsreader: Microsoft CDO for Windows 2000
| > | | Content-Class: urn:content-classes:message
| > | | Importance: normal
| > | | Priority: normal
| > | | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
| > | | Newsgroups: microsoft.public.dotnet.internationalization
| > | | Path: TK2MSFTNGXA01.phx.gbl
AddThis Social Bookmark Button