osx - Know currently logged in user's language in mac via shell script -



osx - Know currently logged in user's language in mac via shell script -

what terminal command know user's language setting (language name enough) in mac? can provide shell script?

you can list of user's language preferences defaults read nsglobaldomain applelanguages. os x utilize languages in decreasing order of preference (if first 1 not available in particular app). on machine:

$ defaults read nsglobaldomain applelanguages ( en, ja, fr, de, es, it, pt, "pt-pt", nl, sv, nb, da, fi, ru, pl, "zh-hans", "zh-hant", ko, ar, cs, hu, tr )

in bash, first 1 (the primary ui language), can piece off first 1 (admittedly messy) script:

langs=(`defaults read nsglobaldomain applelanguages`) echo ${langs[1]/,/} # langs[0] open bracket

osx shell user

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -