By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,034 Members | 2,000 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,034 IT Pros & Developers. It's quick & easy.

Get the current language of the machine

P: 1
hi wanna get the language of the machine with python so depending of the default languge my application know what command it should run
Feb 20 '11 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 621
$LANG is the environment variable used by most distros, but how it is stored is certainly distro specific. You might also take a look at the builtin os module as a place where it might be stored.
Feb 20 '11 #2

bvdet
Expert Mod 2.5K+
P: 2,851
You can get the language code and character encoding with locale.getdefaultlocale(). On my windows machine, it returns: ('en_US', 'cp1252')
Feb 20 '11 #3

Post your reply

Sign in to post your reply or Sign up for a free account.