eviloli
01-03-2005, 08:38 AM
Hi,
I tried using the ResourceSetMessageSource with multiple ResourceManagers (build 118) and could not manage to make it work.
It worked when I used only one ResourceManager.
Here is an extract of my config file :
<object name="messageSource" class="Spring.Context.Support.ResourceSetMessageSource, Spring.Core">
<property name="ResourceManagers">
<list>
<value>SyfShop.Persistence.Strings, SyfShop.Persistence</value>
<value>SyfShop.Domain.Strings, SyfShop.Domain</value>
<value>SyfShop.Test.Strings, SyfShop.Test</value>
</list>
</property>
</object>
The problem seems to come from the following code in method Resolve() of class ResourceSetMessageSource (line 107) :
currentResourceSet = (ResourceSet)_cachedResourceSets[cultureInfo];
if ( currentResourceSet == null )
{
//ResourceManager resourceMgr = new ResourceManager(baseName, baseAssembly );
currentResourceSet = resourceMgr.GetResourceSet(cultureInfo, true, true);
_cachedResourceSets.Add( cultureInfo, currentResourceSet );
}
The cache does not take care of the ResourceManager. So there is only one cached ResourceManager for one CultureInfo. I modified the code (dirty hack) so that my spring test project could work. Here is the code :
currentResourceSet = (ResourceSet)_cachedResourceSets[cultureInfo.Name+resourceMgr.BaseName];
if ( currentResourceSet == null )
{
//ResourceManager resourceMgr = new ResourceManager(baseName, baseAssembly );
currentResourceSet = resourceMgr.GetResourceSet(cultureInfo, true, true);
_cachedResourceSets.Add( cultureInfo.Name+resourceMgr.BaseName, currentResourceSet );
}
I don't know if it's a bug or if I am misunderstanding the use of ResourceSetMessageSource, that's why I post this comment here.
By the way, I would like to thank you for the great job you're doing (you and the NHibernate guys).
Best Regards,
Olivier.
I tried using the ResourceSetMessageSource with multiple ResourceManagers (build 118) and could not manage to make it work.
It worked when I used only one ResourceManager.
Here is an extract of my config file :
<object name="messageSource" class="Spring.Context.Support.ResourceSetMessageSource, Spring.Core">
<property name="ResourceManagers">
<list>
<value>SyfShop.Persistence.Strings, SyfShop.Persistence</value>
<value>SyfShop.Domain.Strings, SyfShop.Domain</value>
<value>SyfShop.Test.Strings, SyfShop.Test</value>
</list>
</property>
</object>
The problem seems to come from the following code in method Resolve() of class ResourceSetMessageSource (line 107) :
currentResourceSet = (ResourceSet)_cachedResourceSets[cultureInfo];
if ( currentResourceSet == null )
{
//ResourceManager resourceMgr = new ResourceManager(baseName, baseAssembly );
currentResourceSet = resourceMgr.GetResourceSet(cultureInfo, true, true);
_cachedResourceSets.Add( cultureInfo, currentResourceSet );
}
The cache does not take care of the ResourceManager. So there is only one cached ResourceManager for one CultureInfo. I modified the code (dirty hack) so that my spring test project could work. Here is the code :
currentResourceSet = (ResourceSet)_cachedResourceSets[cultureInfo.Name+resourceMgr.BaseName];
if ( currentResourceSet == null )
{
//ResourceManager resourceMgr = new ResourceManager(baseName, baseAssembly );
currentResourceSet = resourceMgr.GetResourceSet(cultureInfo, true, true);
_cachedResourceSets.Add( cultureInfo.Name+resourceMgr.BaseName, currentResourceSet );
}
I don't know if it's a bug or if I am misunderstanding the use of ResourceSetMessageSource, that's why I post this comment here.
By the way, I would like to thank you for the great job you're doing (you and the NHibernate guys).
Best Regards,
Olivier.