I have a Python-based web app. that was deployed on an AWS Linux2 machine where I configured my locales properly. To show months and other amenities in the user s locale I have this line of code that worked perfectly:
from locale import LC_ALL, setlocale
from django.utils.translation import get_language
setlocale(LC_ALL, get_language().replace( - , _ ))
现在,我迁移到新的第1737(2006)号机器,这条线给我造成(含)重大错误。
locale.Error: unsupported locale setting
我知道必须安装和配备当地人,但问题是(我认为)这一点已经做到:如果我投入的话。
localectl list-locales
我需要的所有地方。
我也根据产出中显示的格式改编了i.e.。
get_language().replace( - , _ ) + .UTF-8
但这并没有解决问题。