Re: ResourceManager testbed by Patrick
Patrick
Thu Apr 21 03:11:03 CDT 2005
Hi Chuck,
When calling GetString you should specify the desired culture.
E.g. GetString("MESSAGE_QUEUE_EMPTY", Thread.CurrentThread.CurrentCulture);
Then when changing the regional, your language goes along.
Regards,
Patrick
"Chuck Shuhler" <ChuckShuhler@discussions.microsoft.com> wrote in message
news:8641AB04-F0C2-4DF9-9AFA-B2D33A8D4E8B@microsoft.com...
> Patrick,
>
> The initial declaration instances a static resource manager for the class
> library as follows:
>
> private static ResourceManager resources = null;
>
> public static ResourceManager Resources
> {
> get
> {
> if (resources == null)
> {
> resources = new ResourceManager("ASNDATA.StringTable",
> Assembly.GetExecutingAssembly());
> }
> return resources;
> }
> }
>
> When requesting a string from the table, the following code is invoked:
>
> string message;
>
> message = <DLL Namespace (Name changed to protect the
> innocent)>.Data.Internal.Resources.GetString("MESSAGE_QUEUE_EMPTY");
>
> Where MESSAGE_QUEUE_EMPTY is a tag in the string table.
>
> Now, I have a default resource, English resource, and German resource, and
> for testing purposes, I've made the string in each .resx corresponding to
> this tag different. When the string is retrieved, regardless of the
> regional
> settings, the English satellite assembly is loaded and used.
> ----------------------------------------------------------------------------------
>
>
> "Patrick" wrote:
>
>> Hi Chuck,
>>
>> Could you please add some code of how you retrieve the string.
>>
>> Regards,
>>
>> Patrick
>>
>> "Chuck Shuhler" <Chuck Shuhler@discussions.microsoft.com> wrote in
>> message
>> news:83F2A104-2177-4619-AC6E-7DA4585683E0@microsoft.com...
>> > This is my first experience using the ResourceManager to localize UI
>> > elements. I have created a culture neutral .resx, a German (de) .resx,
>> > and
>> > an English (en) .resx. My goal is to initially test this to make sure
>> > that
>> > it pulls the correct strings based on the local culture. To do this, I
>> > changed my regional options to German, however it still shows the
>> > English
>> > version when I run.
>> >
>> > Is this a correct testbed for this, or is there something
>> > more/different
>> > that needs to be done? It seems like, although I've changed the
>> > regional
>> > settings in the control panel, it still senses the culture as English.
>>
>>
>>