Installing supplemental langauge support programatically

Sorting it all Out
Michael Kaplan's random stuff of dubious value
Be sure to read the disclaimer here first!

Installing supplemental langauge support programatically

  • Comments 47

Paul Langton asked via the contact link:

Gday Michael,

Firstly, love the blog and though a lot of it is waaaay over my head its always a great read, I'd go so far to say the best of all the MSDN blogs that I've sampled.

OK suck up out of the way, I have a VB script that does the same function as ticking the two tickboxes in "Supplemental language support" - i.e. "Install files for complex script and right to left languages (including Thai)" and "Install Files for East Asian Languages":

Dim oShell ' Windows Scripting Host shell
Dim oFSO ' File system object
Dim sCurDir ' Script path
Dim sWinDir ' Windows root path

'=======================================================================
' Main
'On Error Resume Next

Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")

sCurDir = Left(WScript.ScriptFullName, InStrRev(WScript.ScriptFullName, "\") - 1)
sWinDir = oShell.ExpandEnvironmentStrings ("%WinDir%")

' Install "Supplemental Language Support"

oShell.Run sWinDir & "\system32\rundll32.exe advpack.dll,LaunchINFSection " & sCurDir & "\intl.inf,LANGUAGE_COLLECTION.COMPLEX.INSTALL", 1, 1

oShell.Run sWinDir & "\system32\rundll32.exe advpack.dll,LaunchINFSection " & sCurDir & "\intl.inf,LANGUAGE_COLLECTION.EXTENDED.INSTALL", 1, 1

My question is - what is the best way to detect if these are already enabled so when it is run it doesn't reinstall all this stuff?

Rgds,
Paul

Ok, first of all -- Paul, don't ever do this!

The code that does the installation of these components does indeed perform these steps, but it also does more than that -- and if you do only these things then you will probably findout at some point that not everything works as you want it to.

This is obviously bad.

The way to get this done is to use the method given in KB article 289125. Just install one of the East Asian and one of the Complex script locales and it will perform ALL of the installation steps, rather than just the ones you want.

And now to the actual question -- how to know when to skip this due to the installation already happening?

Well, you can actually use the old IsValidLocale function on any of the locales that is within one of the language groups in question (e.g. 0x0411 which is Japanese or 0x041e which is Thau) using the LCID_INSTALLED flag, or the IsValidLanguageGroup function to check the actual language groups and see if they are installed.

Now all of this is useful to remember, especially in the context of What isn't in the default install for NLS and Language groups -- the vestigial tail of NLS, especially since they give some use for language groups. :-)

But please try to avoid depending on anything in the INFs, since that is undocumented, unsupported, subject to change, and is changing massively in Vista....

 

This post brought to you by "ૐ" (U+0ad0, a.k.a. GUJARATI OM)

Comment on the blather
Leave a Comment
  • Please add 6 and 6 and type the answer here:
  • Post
Blog - Comment List
  • Hmmm, not sure the link you gave me will help in my situation, that is for how to create an unattended installation of Windows that includes these things. I have various boxes already installed out there that need to have these two checkboxes enabled. Rebuilding them/reinstalling Windows isn't an option (of course, that would be waaaaay too easy).

    I should also say, I'm not a vb programmer, I'm an "application packager" (MSI stuff) so vbscript is probably the extend of my coding "skills", so using the IsValidLocale is beyond my skill set (unless you can call it via VBscript, which it doesn't look like you can)
  • Hi Paul,

    The link I gave you will work just fine -- the unattend syntax works for post-setup scenarios just fine -- try it if you don't believe me.... it works very well!

    For the other, there are many programming languages that are supported in the MSI framework, and lots of them support LCIDs and locales -- you can look to many of VBScript's methods like SetLocale that will fail on invalid LCIDs (for example) to get the job done.

    But stay away for the INF -- it simply is a really bad way to go!
  • Hi Michael,

    Sorry to bother you with this continually...

    I've read various people trying this with success, but I'm not having any luck - I'm assuming that its because where I work, we don't give users direct access to the i386 directory (you'll notice in my vbscript I specify the path to the i386 directory). I have to assume this is the problem, as there are no errors presented, it just runs and does nothing.

    Is there an extra option for the "rundll32.exe shell32,Control_RunDLL intl.cpl,,/f:"c:\regopts.txt"" where I can tell it where to find the i386 directory?

    Rgds

    Paul
  • Hi Paul,

    You can use the /s param to give a pointer to the dir where the install files would be found....
  • Again, sorry to bother you but I still can't get this working, whats the syntax you specify the path... I've tried with "" without "", UNC, non-UNC and still not having any luck. Do I point it to the root of the i386 directory or the directory that contains the i386 directory I've tried both of these too to no avail).

    Does it keep a log somewhere of what its trying to do and any errors it encounters?

    Also, I've noted that if the user has the Regional Settings control panel open then this command line totally fails, it just brings that window to the front. I really need an enterprise solution to this issue, and this seems like something that hasn't been thought through. Any more hints?

  • Paul, the files it is looking for are not in the i386 directory, they are in the lang subdirectory of the i386 directory. That is where you should point it to.

    As for the rest, in the enterprise scenario it is done at logon or in unattended setup, none of which have an intl.cpl loaded already. So it is well thought out for the scenarios where it is intended
  • Hi Michael,

    I'm saying this with the utmost respect for your work, I really do love your blog and the effort and dedication you have for what you do is truly inspiring, and I do appreciate your very quick feedback to my lack of knowledge :)

    But in my mind, to have the deployment options limited to logon or unattended setup, relying on (as far as I'm aware) undocumented command line options (I still haven't seen an example of the /s option) isn't exactly what I'd call an enterprise solution.

    But its more than likely this stems from my own ignorance rather than any issue with the technology.

    Thanks again for your help, I'll continue plugging away (still having issues with the /s option)

    Cheers

    Paul
  • Actually I'll provide exact details on what I'm doing and perhaps you can point out my stupidity to me :) I know I'm doing something really really wrong but I've no idea what.

    I've created a text file called c:\regopts.txt that is trying to install Japanese (I got the input locale code from http://www.microsoft.com/globaldev/reference/winxp/xp-lcid.mspx)


    [RegionalSettings]
    LanguageGroup=1,2,3,4,5
    SystemLocale=e0010411
    UserLocale=e0010411
    InputLocale=0411:e0010411

    I have a copy of the i386 directory on I:\i386

    the command lines I have tried are:

    rundll32.exe shell32,Control_RunDLL intl.cpl,/s:"I:\I386\lang",/f:"c:\regopts.txt"

    rundll32.exe shell32,Control_RunDLL intl.cpl,,/f:"c:\regopts.txt",/s:"I:\Install\I386\lang"

    rundll32.exe shell32,Control_RunDLL intl.cpl,,/f:"c:\regopts.txt" /s:"I:\I386\lang"

    rundll32.exe shell32,Control_RunDLL intl.cpl,/s:"\\server\share\I386\lang",/f:"c:\regopts.txt"

    Plus lots of other various combinations, all with no luck. I've tried Filemon and regmon on the process to see if its trying to access a file/regkey but can't see anything obvious in there.

    Or should I be taking this to Microsoft Support that my company pays for rather than bother you about this?
  • Well, to start with the system locale and user locale in your unattend file arae both invalid -- those are not locales -- try 00000411 here.

    The input locale is correct.

    But looking at the settings, you are not just installing EA lang sdupport -- you are setting it across the board to Japanese. This seldom szeems a good idea in a post-install enterprise scenario so I hope this is just you testing things out rather than the official plan....

    Beyond that, as I said you only need to include one language group to cover EA langs and one to cover complex scripts (assuming it is XP or Server 2003). You never need to specify five of them.

    Beyond THAT, I'd be more convinced about the respect thing if you assumed you had missed something before you questioned the professional nature of the product. :-)

    Unattend files do not need to commonly use that particular param since with the exception of international support, most of what someone needs is always in the i386 dir. But it is not unheard of in any of these cases to need to specify a dir.

    I guess if you are not convinced that this is the solution to use then you can just not get a solution that has been tested by the team that owns the component. I will leave the decision to you....
  • I do apologise, I never meant my comments of the product to reflect on yourself. You have certainly gone out of your way to assist me and I am truly appreciative, and I've obviously failed to express that coherently. The errors I am experiencing are to do with my lack of skills rather than any shortcoming on either your part or that of your team.

    I am convinced this is the solution I should be using, I'm just actually trying to use it. There is no doubt that you and your team are vastly more experienced and knowledgable in this matter than I, hence me asking for assistance (and I'll have to learn me some manners when asking for help!).

    I'll soldier on.
  • No apology needed, Paul. Thats why I had that smiley thing on the "respect" line. Just having a little fun on a Sunday. :-)

    I honestly should have thought to ask you for the  contents of your unattend file first, since the last four times someone was having trouble that is where the trouble turned out to be (and where I think it is now)....
  • HI Michael,

    No the problem is't there, I've even copied other examples you've posted on newsgroups (http://groups.google.com.au/group/microsoft.public.win32.programmer.international/browse_frm/thread/188b7396d0d6bd74/63754ad9ee134170?lnk=st&q=regopts.txt&rnum=2&hl=en#63754ad9ee134170)
    to no avail... it still starts and then stops and doesn't add any languages.

    I'm reasonably sure I'm not using the /s command line option properly, but as I don't have an example to go off and I've tried every combination I can think of I'm just trying the same things over and over again.

    A good nights sleep might help. The only alternative solution I can think of is to do a vbscript that does sendkeys to emulate clicking on those two checkboxes, I'd really rather avoid doing that though...
  • Well, how about starting small -- like with one settingg. Maybe one that does not require files to be installed. And then work your way up from there?

    The current file you listed is trying to do everything (which is probably not what you needed to do anyway). We can track down what is happening here....



  • Hi Michael,

    The other issue is definately my own ignorance, I have no idea what some of the settings in the setopts.txt file do...

    From the KB article:

    [RegionalSettings]
    Language = locale ID
    LanguageGroup = language group ID, language group ID
    SystemLocale = locale ID
    UserLocale = locale ID
    InputLocale = locale ID:keyboard layout ID, locale ID:keyboard layout ID
    UserLocale_DefaultUser = locale ID
    InputLocale_DefaultUser = locale ID:keyboard layout ID

    Language is reasonable obvious (even though I got it wrong)
    LanguageGroup escapes me totally, it describes this as:

    LanguageGroup - This setting specifies the language support that is installed on the computer. If this setting is specified, it provides the default settings for the InputLocale, SystemLocale, and UserLocale settings.

    But what do I actually put in there? It seems to be numbers, but I've no idea how to tell it what numbers equal what language (or languages)

    System locale I assume changes the default system locale?

    User Locale I assume changes the locale for the user you are running the command as.

    Input locale specifies the input and keyboard combinations, this is the setting I guess I want to add Japanese (or any other Asian language) and also a left to right language (arabic perhaps?)

    The other settings look like I don't want to play with them.

    So, what I would think, to add Japanese to a PC that has English Australian and English US installed I should have a regopts.txt file like so:

    [RegionalSettings]
    LanguageGroup=?? (as I didn't know what to do here, I put 1, 2, 3, 4 ,5)
    SystemLocale=00000409
    UserLocale=00000409
    InputLocale=0409:00000409;0411:e0010411

    And then run:

    rundll32.exe shell32,Control_RunDLL intl.cpl,,/f:"c:\regopts.txt"

    With my myriad of combinations of /s.

    How is that looking?

    Rgds

    Paul
  • As I said, try setting ONE thing, not four of them, for starters. You do not need to set SystemLocale, UserLocale, and InputLocale, most likely -- such changes on an enterprise are a huge mistake.

    See http://blogs.msdn.com/michkap/archive/2005/02/16/374450.aspx for more on language groups, which includes info about the actual numbers and what they mean....
Page 1 of 4 (47 items) 1234