gaoluinn

scríbhinní ⁊ deocháin do chuallucht na Gaelainne

previous | next

Set up the UI language management infrastructure (2)

Now to see after the XML files and the scripts.

Create a directory tree

First, we have to create a directory tree to store the XML files. (If you are after using the method discussed in this article to install the localisations then you already have a suitably arborsculptured tree in place so you can bypass this step and go straight to the next one.) Create the following structure in e:\ on the DC.

Make the xml branch of the tree available over the network by sharing the subdirectory e:\teanga\xml. Make this share a hidden one (\\smuilc\xml$). Make it readable to the group Domain Users only and make it writable to no one at all.

Why set these share permissions?

Best practice: only make any resource available to user or machine accounts that need it, and only give them the lowest level of privilege they need to make use of it.

The contents of \\smuilc\xml$ need to be readable to users' domain accounts (that doesn't mean the users themselves have any business with them though) so this share needs to be readable to Domain Users but it doesn't need to be writable by them or by anything else.

Why hide the share?

Why not? This share is a purely under-the-bonnet resource belonging to the sysadmin. No other user on the network has any business in the world poking around in it so why parade it? Anyway, hiding it clears some junk out of the way for users who do have legitimate reasons to be traversing the network in Explorer. There are things users were not meant to know.

Create some XML files

Create the following files in the xml subdirectory:

cy-GB.xml

Add the following markup to this file:


<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
<!--User List-->
<gs:UserList>
<gs:User UserID="Current" />
</gs:UserList>
<!--Display Language-->
<gs:MUILanguagePreferences>
<gs:MUILanguage Value="cy-GB" />
</gs:MUILanguagePreferences>
</gs:GlobalizationServices>
		

en-IE.xml

Add the following markup to this file:


<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
<!--User List-->
<gs:UserList>
<gs:User UserID="Current" />
</gs:UserList>
<!--Display Language-->
<gs:MUILanguagePreferences>
<gs:MUILanguage Value="en-US" />
</gs:MUILanguagePreferences>
</gs:GlobalizationServices>
		

If your network is in Scotland or Wales name this file en‑GB rather than en‑IE.

ga-IE.xml

Add the following markup to this file:


<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
<!--User List-->
<gs:UserList>
<gs:User UserID="Current" />
</gs:UserList>
<!--Display Language-->
<gs:MUILanguagePreferences>
<gs:MUILanguage Value="ga-IE" />
</gs:MUILanguagePreferences>
</gs:GlobalizationServices>
		

gd-GB.xml

Add the following markup to this file:


<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
<!--User List-->
<gs:UserList>
<gs:User UserID="Current" />
</gs:UserList>
<!--Display Language-->
<gs:MUILanguagePreferences>
<gs:MUILanguage Value="gd-GB" />
</gs:MUILanguagePreferences>
</gs:GlobalizationServices>
		

As you can see, these files are all identical to each other except for the MUILanguage element. Under this localisation method, one of these files is referenced by each user's logon and logoff localisation scripts and it is the MUILanguage element that decides what UI language they get.

(If you are following on from this article on installing localisations, you'll see that these files contain mostly the same markup as the startup XML file mentioned there but that they don't include the CopySettingsToDefaultUserAcct and CopySettingsToSystemAcct elements.)

Have a close look at the file en‑IE (or en‑GB if your network is located in Scotland or Wales). You might expect to see a value of en‑IE (or en‑GB), rather than en‑US, for the MUILanguage element. I gave a good while trying to get en‑IE and en‑GB to work, or at least to find out why they wouldn't, but in the end I just had to plough on and live with en‑US since it doesn't seem to Americanise the user's login session: regional settings, as viewed in the Control Panel, and Word's primary editing language are both reported as being English (Ireland).

Having said that, I'm nearly certain that it does cause some bothersome side-effects for locale-aware applications like LibreOffice. I'll test this and document the results here as soon as I can.

Anyway, I'm not a bit happy when things 'seem' to work and I not having a clue why so I'll definitely look into this again and update the article at some point. For now, we'll say that the en‑US value is strictly a workaround.

Create some logon and logoff scripts

Now we'll create the logon and logoff scripts to assign each user's interface language.

Since logon and logoff scripts are run under users' own domain accounts, these scripts will fail if the accounts are subject to any Group Policy setting that prevents the use of the requisite Control Panel applet.

Open up these Group Policy Objects in the Group Policy Management Editor one at a time. In each one, expand 'Policies', then 'Windows Settings'. Select 'Scripts (Logon/Logoff)'. Add one logon script and one logoff script to each GPO as follows:

Comhéadan (cy)

Create the logon script cyIsteach.vbs and the logoff script cyAmach.vbs and add the following VBScript to the two of them:


Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c control intl.cpl,, /f:""\\smuilc\xml$\cy-GB.xml""", 0, True
		

Comhéadan (en)

Create the logon script enIsteach.vbs and the logoff script enAmach.vbs and:

If you're in Ireland add the following VBScript to the two of them.


Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c control intl.cpl,, /f:""\\smuilc\xml$\en-IE.xml""", 0, True
		

If you're in Scotland or Wales add this VBScript to them instead.


Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c control intl.cpl,, /f:""\\smuilc\xml$\en-GB.xml""", 0, True
			

Comhéadan (ga)

Create the logon script gaIsteach.vbs and the logoff script gaAmach.vbs and add the following VBScript to the two of them:


Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c control intl.cpl,, /f:""\\smuilc\xml$\ga-IE.xml""", 0, True
		

Comhéadan (gd)

Create the logon script gdIsteach.vbs and the logoff script gdAmach.vbs and:

If you're in Ireland add the following VBScript to the two of them.


Dim objWMI, objItem, colItems, leaganCO, WshShell
' Obtain information about the operating system
Set objWMI = GetObject("winmgmts:\\.\root\cimv2")
Set colItems = objWMI.ExecQuery("Select * from Win32_OperatingSystem",,48)
' Find out what version of Windows it is
For Each objItem in colItems
	leaganCO = Left(objItem.Version,3)
Next
Set WshShell = CreateObject("WScript.Shell")
If (leaganCO = "6.2") Then
	' It is Windows 8, and so has a Scottish Gaelic Localisation
	WshShell.Run "cmd.exe /c control intl.cpl,, /f:""\\smuilc\xml$\gd-GB.xml""", 0, True
ElseIf (leaganCO = "6.1") Then
	' It is Windows 7, and so has no Scottish Gaelic Localisation
	' Fall back on English
	WshShell.Run "cmd.exe /c control intl.cpl,, /f:""\\smuilc\xml$\en-IE.xml""", 0, True
End If
		

If you're in Scotland or Wales add this VBScript to them instead.


Dim objWMI, objItem, colItems, leaganCO, WshShell
' Obtain information about the operating system
Set objWMI = GetObject("winmgmts:\\.\root\cimv2")
Set colItems = objWMI.ExecQuery("Select * from Win32_OperatingSystem",,48)
' Find out what version of Windows it is
For Each objItem in colItems
	leaganCO = Left(objItem.Version,3)
Next
Set WshShell = CreateObject("WScript.Shell")
' Find out what version of Windows it is
If (leaganCO = "6.2") Then
	' It is Windows 8, and so has a Scottish Gaelic Localisation
	WshShell.Run "cmd.exe /c control intl.cpl,, /f:""\\smuilc\xml$\gd-GB.xml""", 0, True
ElseIf (leaganCO = "6.1") Then
	' It is Windows 7, and so has no Scottish Gaelic Localisation
	' Fall back on English
	WshShell.Run "cmd.exe /c control intl.cpl,, /f:""\\smuilc\xml$\en-GB.xml""", 0, True
End If
			

(There's no technical reason why English has to be the fallback language for Scottish Gaelic speakers on Windows 7, although it will of course be the only realistic option most of the time. But if your network's in Scotland and you do have a user who's preferred second working language is Irish or Welsh just tweak gdIsteach.vbs and gdAmach.vbs accordingly.)

Anyway, once you have all these scripts in place, close the Group Policy Management Editor and that's it. You have the management infrastructure deployed and Group Policy set up to dynamically enable and enforce UI localisations at login.

But why not use neat GP?

There's a Group Policy Object setting called 'Restricts the UI languages Windows should use for the selected user'. This lives in User Configuration / Policies / Administrative Templates / Control Panel / Regional and Language Options and looked so promising. Unfortunately, as you can see in the screenshot, it seems to be limited to a fixed list that includes neither Irish nor any other Celtic Language. (This list might be of languages associated with language packs rather than language interface packs. It is only a guess though.) I would have looked into the possibility of tackling this with a custom administrative template but I was caught for time so I had to be pragmatic and do the job with a script instead.

The Group Policy console dropdown list of the languages available under this Group Policy setting. The list clearly does not include any Celtic language.

Rummaging users

Some users might be inclined to go rummaging in the Control Panel to try and set their UI language manually and are likely to get cranky when they realise they can't because the scripts override them. Unless you have a good reason not to, it might be no harm to hide regional and language options altogether.

If you want to do this, create a new Group Policy Object and link it as appropriate, then drill down through User Configuration / Policies / Administrative Templates / Control Panel / Regional and Language Options until you reach "Hide regional and Language Options administrative options".

Be sure to change the GPO Status from 'Enabled' to 'Computer configeration settings disabled'. There's no point in wasting CPU cycles processing empty computer configurations.

(Or you might already have an existing GPO suitable for the job.)

previous | next