Groups | Blog | Home
all groups > dotnet internationalization > december 2004 >

dotnet internationalization : Win2k Terminal Server, CurrentCulture, and .NET.


Eric D. Wilson
12/9/2004 11:53:05 AM
I have an issue where a .NET application is not seeing the correct culture of
a server as defined within the "Regional Options" settings of Control Panel.
I've gone through and set all of the options to German, but when my app
executes it reports the CurrentCulture (of the active thread) as English.
What am I missing? The server is a Win2k Terminal O/S.

Thanks
Eric

P.S. I know I can manually set the culture for the thread in code, but it
Michael \(michka\) Kaplan [MS]
12/9/2004 10:42:46 PM
The one you see in Regional Options on a server is not necessarily the one
that an application would see -- if that account is running under another
user account and/or the profile is not loaded, the settings would not apply.

Can you give some more info about the application, the context in which it
is running, etc.?


--
MichKa [MS]
NLS Collation/Locale/Keyboard Technical Lead
Globalization Infrastructure, Fonts, and Tools
Microsoft Windows International Division

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


[quoted text, click to view]

Eric D. Wilson
12/10/2004 11:25:09 AM
It's a service running under the System account. When the service first
starts I check the culture of the current thread and no matter what's set in
Control Panel it always reports English.

[quoted text, click to view]
Michael \(michka\) Kaplan [MS]
12/10/2004 11:45:00 AM
That is entirely expected. When you look at Regional Options you are not
logged in under the system account; you are logged in as you. Therefore,
what you set there has no impact on what the system account settings are.


--
MichKa [MS]
NLS Collation/Locale/Keyboard Technical Lead
Globalization Infrastructure, Fonts, and Tools
Microsoft Windows International Division

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



[quoted text, click to view]

Eric D. Wilson
12/10/2004 12:47:03 PM
Ok, so that begs the question "How do you set the regional settings for the
System account?" When I made the changes, I was logged in as Administrator.

[quoted text, click to view]
Michael \(michka\) Kaplan [MS]
12/10/2004 2:15:11 PM
The user named "Administrator" is not the system account (you can run a
service as "Administrator" so clearly they are different things).

There is no UI method to set the system accounts in Windows 2000 -- the
principal reason thast XP added an "apply all settings to the current user
account and to the defsult user profile" checkbox.

On the whole is the wrong choice to try to byild the site with a dependence
on the server's settings -- after all, another site might have a similar
requirement for a totally different locale. The "hack" to set the
information is best considered the feature of a site, as it makes the site
independent of the whims of anyone who changes settings.


--
MichKa [MS]
NLS Collation/Locale/Keyboard Technical Lead
Globalization Infrastructure, Fonts, and Tools
Microsoft Windows International Division

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



[quoted text, click to view]

Eric D. Wilson
12/10/2004 2:45:15 PM
Well, that's a problem since the account that most services use to execute is
the system account. It doesn't make a whole lot of sense that you can
essentially set a box up to run as a localized OS for everything except the
system account. What's the point?

Thanks for your help.
Eric

[quoted text, click to view]
Michael \(michka\) Kaplan [MS]
12/10/2004 5:37:24 PM
Well, that is one of the reason why the functionality was added in XP and
beyond.

But the localized OS does not have this problem -- if all the settings are
for some other language then all accounts will be as well. It is only when
you are changing the setting for your user account and expecting it to go
everywhere (even though it is called the "user locale"). That is not a
scenario that came up heavily until after Windows 2000 had shipped.

You are no really localizing an operating system when you change the user
locale, though. You are making a change in preferences, and you pronbably
should not ever have this setting be hardcoded to anything since users may
want to log on and change theur preferences.

If you make the appropriate changes in the .DEFAULT subkey, if you mount
the ntuser.dat hives of all of the appropriate accounts and modivy them as
well, then you can make it work. Its a non-trivial effort, which is why that
single small checkbox is a bit misleading in terms of the complexity of the
issue.

Microsoft has to do more than handle the specific scenario you have here --
we have to handle web servers with hundreds of sites, all of whom might want
different behavior. The plan you envision is not very scalable since even a
second user's preference would mess up an entire web site's processing. In
that sense, the plan is not as very good one since even moving to a new
server meansd you are right back in a tough situation.

If you want to make changes, your best answer (and certainly the most
supported answer!) is to set it in your website.


--
MichKa [MS]
NLS Collation/Locale/Keyboard Technical Lead
Globalization Infrastructure, Fonts, and Tools
Microsoft Windows International Division

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


[quoted text, click to view]

Eric D. Wilson
12/13/2004 11:59:02 AM
Ok, one more question. If I create a parameter in my .config file that
controls the culture will I have to set the Culture manually for every thread
in the managed thread pool, or can I simply set the culture from the main
thread in the service and have it propegated to everything else in the
AppDomain?

Thanks again.
Eric

[quoted text, click to view]
Michael \(michka\) Kaplan [MS]
12/13/2004 12:38:01 PM
I believe the intention of the setting in the config file is to affect all
threads. But I would suggest testing it first to make sure the
implementation matches my vague recollection of the intention. :-)


--
MichKa [MS]
NLS Collation/Locale/Keyboard Technical Lead
Globalization Infrastructure, Fonts, and Tools
Microsoft Windows International Division

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


[quoted text, click to view]
AddThis Social Bookmark Button