mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 00:35:00 +00:00
refactor: Validate locale language result
This commit is contained in:
parent
b8758ca791
commit
17a2773a22
1 changed files with 4 additions and 1 deletions
|
@ -1094,6 +1094,7 @@ class Coder:
|
||||||
2. ``locale.getlocale()``
|
2. ``locale.getlocale()``
|
||||||
3. ``LANG`` / ``LANGUAGE`` / ``LC_ALL`` / ``LC_MESSAGES`` environment variables
|
3. ``LANG`` / ``LANGUAGE`` / ``LC_ALL`` / ``LC_MESSAGES`` environment variables
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Explicit override
|
# Explicit override
|
||||||
if self.chat_language:
|
if self.chat_language:
|
||||||
return self.normalize_language(self.chat_language)
|
return self.normalize_language(self.chat_language)
|
||||||
|
@ -1102,7 +1103,9 @@ class Coder:
|
||||||
try:
|
try:
|
||||||
lang = locale.getlocale()[0]
|
lang = locale.getlocale()[0]
|
||||||
if lang:
|
if lang:
|
||||||
return self.normalize_language(lang)
|
lang = self.normalize_language(lang)
|
||||||
|
if lang:
|
||||||
|
return lang
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue