Mengapa saya mendapatkan kesalahan berikut saat melakukan ini dengan python:
>>> import locale
>>> print str( locale.getlocale() )
(None, None)
>>> locale.setlocale(locale.LC_ALL, 'de_DE')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/locale.py", line 531, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
Ini berfungsi dengan lokal lain seperti fr atau nl juga. Saya menggunakan Ubuntu 11.04.
Pembaruan: Melakukan hal berikut ini tidak menghasilkan apa-apa:
dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = (unset)
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
locale.setlocale(locale.LC_ALL, 'de_DE')
salah. Kamu butuh locale.setlocale(locale.LC_ALL, 'de_DE.utf8')
.
locale.setlocale(locale.LC_ALL, locale.locale_aliases['de_DE'])
.
de_DE
daftarlocale -a
? Jika tidak, Anda harus menginstalnya .