Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 802631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:38:10+00:00 2026-05-14T23:38:10+00:00

Could someone tell me a way to get a system language in the ISO

  • 0

Could someone tell me a way to get a system language in the ISO 639 (3 letter code) format in a cross platform way?

Thanks.

I found a list of three letter country codes.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T23:38:11+00:00Added an answer on May 14, 2026 at 11:38 pm

    I’m assuming you’re wanting ISO 639 2 and not ISO 639 3 here. Machine-readable data is available from the Library of Congress (I’m using the “utf-8” encoding for this answer, see also http://www.loc.gov/standards/iso639-2/ascii_8bits.html for more info.)

    Here’s an example of how you could load this:

    import codecs
    
    def getisocodes_dict(data_path):
        # Provide a map from ISO code (both bibliographic and terminologic)
        # in ISO 639-2 to a dict with the two letter ISO 639-2 codes (alpha2)
        # English and french names
        #
        # "bibliographic" iso codes are derived from English word for the language
        # "terminologic" iso codes are derived from the pronunciation in the target 
        # language (if different to the bibliographic code)
    
        D = {}
        f = codecs.open(data_path, 'rb', 'utf-8')
        for line in f:
            iD = {}
            iD['bibliographic'], iD['terminologic'], iD['alpha2'], \
                iD['english'], iD['french'] = line.strip().split('|')
            D[iD['bibliographic']] = iD
    
            if iD['terminologic']:
                D[iD['terminologic']] = iD
    
            if iD['alpha2']:
                D[iD['alpha2']] = iD
    
            for k in iD:
                # Assign `None` when columns not available from the data
                iD[k] = iD[k] or None
        f.close()
        return D
    
    if __name__ == '__main__':
        D = getisocodes_dict('ISO-639-2_utf-8.txt')
        print D['eng']
        print D['fr']
    
        # Print my current locale
        import locale
        print D[locale.getdefaultlocale()[0].split('_')[0].lower()]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Could someone tell if it's possible to get an OpenCL code working with both
could someone tell me if this is the right way to do bidirectional mapping?
I was wondering if someone could tell me the best way to call a
Could someone tell me how to get the parent directory of a path in
Could someone tell me what exactly NSCFTimer is? I get it when I ask
Could someone please tell me what is exactly wrong with the way my case
Could someone tell me if this: $.ajax({ url: 'test.html', success: function(data) { alert(Data Loaded:
Could someone tell me how I can capture a NSParseErrorException? The Situation: my app
Could someone tell me how to view the XML to be sent via web
Could someone tell me what the purpose of inner classes are? Also when designing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.