Finding the language version of Microsoft Office 2011 that is installed

hcodfrie
Contributor

Hallo JAMF,

Does anyone have a EA to check what language version of Microsoft office is installed ?

27 REPLIES 27

gmarnin
New Contributor III

Hannes wrote a script to check the installed language:

https://github.com/hjuutilainen/adminscripts/blob/master/office2011-installed-language.py

You're on your own to make an EA.

Marnin

talkingmoose
Moderator
Moderator

Look on JAMF Nation in Third-Party Products > Office for Mac 2011 > Extension Attributes > Get Office 2011 Version.

You may be able to replace the CFBundleShortVersionString key with CFBundleDevelopmentRegion. Mine shows "en" here. I don't have a different language of Office for Mac to verify.

hcodfrie
Contributor

thanks @talkingmoose just what i needed !

carlo_anselmi
Contributor III

Hi all, I too would need this info. I tried with talkingmoose's suggestion and Macs with Office Italian show "en".
Cheers
Carlo

hcodfrie
Contributor

Doesn't seem to work sadly any other idea's @mm2270 ?

mm2270
Legendary Contributor III

@hcodfrie - was your post intended for another thread or did you mean to ask @talkingmoose? :) I'm not sure how to get the installed language from Office. talkingmoose would be the best person to help with that.

mm2270
Legendary Contributor III

Decided to poke at the Info.plist file just to see. I see something cryptic labeled "MicrosoftLocalizationLCID" in the Info.plist file for any of the installed apps. In my case it lists "1033" as the string associated with the key.
We install the English version by default, so I can't see if that string shows up as something else with a different language version installed.

Can one of you who does have a different version installed check to see what shows up there? If it turns out to be different for each language, that could be the key, but you'd need to find some way to decipher what something like "1033" translates to (English?) to be able to report on it.

mm2270
Legendary Contributor III

Aha! I found it! Isn't Google grand? :) Check this out. 1033 IS the internal code for American English, so I think that may be the right string to gran as a start-

http://msdn.microsoft.com/en-us/library/ms912047(WinEmbedded.10).aspx.aspx)

hcodfrie
Contributor

@mm2270 i testing it now the EA look like this :

if [ -f "/Applications/Microsoft Office 2011/Microsoft Word.app/Contents/Info.plist" ] ; then VERSION=$( defaults read "/Applications/Microsoft Office 2011/Microsoft Word.app/Contents/Info" MicrosoftLocalizationLCID )
else VERSION="Not installed"
fi

echo "<result>$VERSION</result>"

How can in make it to report NL when it detects 1043 and report UK when it detects 1033 that would be outstanding

mm2270
Legendary Contributor III
#!/bin/sh

if [ -f "/Applications/Microsoft Office 2011/Microsoft Word.app/Contents/Info.plist" ] ; then
    VERSION=$( defaults read "/Applications/Microsoft Office 2011/Microsoft Word.app/Contents/Info" MicrosoftLocalizationLCID )
    if [ "$VERSION" == "1033" ]; then
        LANG="UK"
    elif [ "$VERSION" == "1043" ]; then
        LANG="NL"
    else
        LANG="Unknown"
    fi
else
    LANG="Not installed"
fi

echo "<result>$LANG</result>"

Not sure when I'll have it done, but since discovering this, I'm working on a full EA that will pull any language version from that table and not just one or two noted ones. Once I've got something working I'll post it here and in the EA section.

hcodfrie
Contributor

First thing that i will do in the morning for now thx mike !

sean
Valued Contributor

You might find a case statement neater and easier to read and more appropriate if you ever add other languages.

case $VERSION in

        1033)
                LANG="UK"
                ;;
        1043)
                LANG="NL"
                ;;
        *)
                LANG="Unknown $VERSION"
                ;;
esac

mm2270
Legendary Contributor III

So here's a pretty complete version below. This should report any language version that's installed, even if as obscure as Mecedonian!
The arrays used in this are crazy long, but I settled on using that instead of a case statement as I originally began looking at, because that was tuning out to be even more nutty! : P

I did some random tests with this by pointing the script to a local custom plist with values plucked from the first array, and it seems to be reporting the correct language in all cases I tried. YMMV.

#!/bin/bash

## Extension Attribute to report on the installed language version of Microsoft Office
## Designed to work with Microsoft Office 2011

## Language code array
LangCodes=(1078 1052 5121 15361 3073 2049 11265 13313 12289 4097 6145 8193 16385 
1025 10241 7169 14337 9217 1067 2092 1068 1069 1059 1026 1027 3076 5124 2052 4100 
1028 1050 1029 1030 1125 2067 1043 3081 10249 4105 9225 6153 8201 5129 13321 7177 
11273 2057 1033 12297 1061 1080 1065 1035 2060 3084 1036 5132 6156 4108 1071 1110 
1079 3079 1031 5127 4103 2055 1032 1095 1037 1081 1038 1039 1057 1040 2064 1041 
1099 1087 1111 1042 1088 1062 1063 2110 1086 1102 1104 1044 2068 1045 1046 2070 
1094 1048 1049 1103 3098 2074 1051 1060 11274 16394 13322 9226 5130 7178 12298 
17418 4106 18442 2058 19466 6154 15370 10250 20490 1034 14346 8202 3082 1089 2077 
1053 1114 1097 1092 1098 1054 1055 1058 1056 2115 1091 1066 1106)

## Language string array
LangStrings=("Afrikaans" "Albanian" "Arabic" "Arabic" "Arabic"
"Arabic" "Arabic" "Arabic" "Arabic" "Arabic" "Arabic" "Arabic"
"Arabic" "Arabic" "Arabic" "Arabic" "Arabic" "Arabic" "Armenian"
"Azeri (Cyrillic)" "Azeri (Latin)" "Basque" "Belarusian" "Bulgarian"
"Catalan" "Chinese" "Chinese" "Chinese (Simplified)" "Chinese"
"Chinese" "Croatian" "Czech" "Danish" "Divehi" "Dutch" "Dutch"
"English" "English" "English" "English" "English" "English" "English"
"English" "English" "English" "English (UK)" "English (US)" "English"
"Estonian" "Faroese" "Farsi" "Finnish" "French" "French" "French"
"French" "French" "French" "Macedonian" "Galician" "Georgian" "German"
"German" "German" "German" "German" "Greek" "Gujarati" "Hebrew" "Hindi"
"Hungarian" "Icelandic" "Indonesian" "Italian" "Italian" "Japanese"
"Kannada" "Kazakh" "Konkani" "Korean" "Kyrgyz" "Latvian" "Lithuanian"
"Malay" "Malay" "Marathi" "Mongolian" "Norwegian (Bokmål)"
"Norwegian (Nynorsk)" "Polish" "Portuguese" "Portuguese" "Punjabi"
"Romanian" "Russian" "Sanskrit" "Serbian (Cyrillic)" "Serbian (Latin)"
"Slovak" "Slovenian" "Spanish" "Spanish" "Spanish" "Spanish""Spanish"
"Spanish" "Spanish" "Spanish" "Spanish" "Spanish" "Spanish" "Spanish"
"Spanish" "Spanish" "Spanish" "Spanish" "Spanish" "Spanish" "Spanish"
"Spanish" "Swahili" "Swedish" "Swedish" "Syriac" "Tamil" "Tatar"
"Telugu" "Thai" "Turkish" "Ukrainian" "Urdu" "Uzbek (Cyrillic)"
"Uzbek (Latin)" "Vietnamese" "Welsh")

## Target plist to get info from. Using Database Daemon.app since it should be installed by default
tgtPlist="/Applications/Microsoft Office 2011/Office/Microsoft Database Daemon.app/Contents/Info.plist"

if [ -e "${tgtPlist}" ]; then
    langcode=$( defaults read "${tgtPlist}" MicrosoftLocalizationLCID 2> /dev/null)
    if [ ! -z "$langcode" ]; then
        index=0;
        for c in "${LangCodes[@]}"; do
            if [ "$c" == "$langcode" ]; then
                element="$index"
                break
            fi
            let index=index+1
        done
        if [ ! -z "$element" ]; then
            installedLang="${LangStrings[$element]}"
        else
            installedLang="Not Found"
        fi
    else
        installedLang="Not Found"
    fi
else
    installedLang="Not Installed"
fi

echo "<result>${installedLang}</result>"

This could probably be made a little more efficient if anyone wants to try.

Edit: Corrected to account for a case where the language code pulled didn't match anything in the array

carlo_anselmi
Contributor III

:-( Weird... ...same as before with "CFBundleDevelopmentRegion"
Here I get "1033" with defaults read "/Applications/Microsoft Office 2011/Microsoft Word.app/Contents/Info" MicrosoftLocalizationLCID
There must be something wrong with Italian... ...other than being already out the World Cup!
Thank you all
Carlo

hcodfrie
Contributor

same here not showing NL for me only English (US)

gmarnin
New Contributor III

Did you try Hannes's script?

https://github.com/hjuutilainen/adminscripts/blob/master/office2011-installed-language.py

hcodfrie
Contributor

@gmarnin just tested this perl script the output is NL when i run it in terminal, the next step is then create a EA out of this

mm2270
Legendary Contributor III

@hcodfrie and @carlo.anselmi - are you both just seeing "1033" as the string from the plist when you run the command separately? If so, then I guess that doesn't actually get changed in the plist during a specific language installation. Since I didn't have a non US English install to test against I couldn't be sure. Too bad, since its obvious Microsoft uses those codes throughout their products. Not sure why it wouldn't be updated in the plist there as well.

hcodfrie
Contributor

@mm2270 i am getting English (US) als on my clients that have the NL version installed, i just tested that py script in terminal the result is : NL when i run in from a NL version installed client.

mm2270
Legendary Contributor III

@hcodfrie -yes, thanks. I understand. What I was wondering though was if you run this command in a Terminal window on a Mac with the NL version of Office installed-

defaults read "/Applications/Microsoft Office 2011/Office/Microsoft Database Daemon.app/Contents/Info" MicrosoftLocalizationLCID

What is the output? If its listing "1033", the code for US English, then that's why my script is returning that. It probably also means that unfortunately, that string does not get set to the correct language code during installation as I had thought. As I mentioned, not having any other language than US English to test against, it was hard to know. But maybe now we know.

scottb
Honored Contributor

I have a number of versions I can test on today if someone wants me to.

hcodfrie
Contributor

@mm2270 Macbook:~ User$ defaults read "/Applications/Microsoft Office 2011/Office/Microsoft Database Daemon.app/Contents/Info" MicrosoftLocalizationLCID
1033
Macbook:~ User$

mm2270
Legendary Contributor III

OK, well then that explains it. I guess the code does not get set during installation to whatever language was chosen. That's pretty stupid. I wonder what the point of having that in the plist is even for then. Seems like it sets it to English regardless of what was actually chosen. I'll take the script down shortly since its apparently useless. Sorry it didn't work out. Good luck on converting the python script into an EA.

sean
Valued Contributor

Out of interest, what do you get if you run:

pkgutil --pkgs --volume / | grep "com.microsoft.office"

hcodfrie
Contributor

com.microsoft.office.nl.silverlight.pkg.14.1.0
com.microsoft.office.nl.solver.pkg.14.1.0
com.microsoft.office.nl.solver.pkg.14.3.9.update
com.microsoft.office.nl.solver.pkg.14.4.2.update
com.microsoft.office.nl.sounds.pkg.14.1.0
com.microsoft.office.nl.vb_resources.pkg.14.1.0
com.microsoft.office.nl.word_resources.pkg.14.1.0
com.microsoft.office.nl.word_resources.pkg.14.3.9.update
com.microsoft.office.nl.word_resources.pkg.14.4.2.update
com.microsoft.office.nl.word_templates.pkg.14.1.0
com.microsoft.office.nl.word_templates.pkg.14.3.9.update
com.microsoft.office.nl.word_templates.pkg.14.4.2.update
com.microsoft.office.nl.word_wizards.pkg.14.1.0
com.microsoft.office.nl.word_wizards.pkg.14.3.9.update
com.microsoft.office.nl.word_wizards.pkg.14.4.2.update

sean
Valued Contributor

There are you letters right there! Not neat, but

pkgutil --pkgs --volume / | grep "com.microsoft.office" | cut -d "." -f 4 | uniq

hcodfrie
Contributor

Hey Guys,

i endup making this EA and its working for me now

#!/bin/bash

folder="/Applications/Microsoft Office 2011/Microsoft Word.app/Contents/Resources/"
if [ -d "$folder/nl.lproj" ]; then result="NL Installed"
elif [ -d "$folder/en.lproj" ]; then result="UK Installed"
else result="Office not installed"
fi

echo "<result>$result</result>"