Is there any universal method to detect the OS default language? (regardless what is the OS that is running the code)
import os
os.getenv('LANG')
The above code works under Linux, does it work under other OS?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could use the
getdefaultlocalefunction in thelocalemodule. It returns the language code and encoding of the system default locale in a tuple: