views:

114

answers:

1

How can I get localized language name by specified locale code in python?

For example:

>> get_language_name('ja')
>> ('Japanese', u'日本語')
+4  A: 

The Babel package can help:

>>> from babel import Locale
>>> locale = Locale('ja', 'JP')
>>> print locale.display_name
日本語 (日本)

There is also PyICU, a Python wrapper for the ICU library.

Ned Deily