[FIX] base, tools: use getlocale vs deprecated getdefaultlocale

As getdefaultlocale is deprecated in 3.11 in favor of getlocale which is
available since at least 3.0.

Part-of: odoo/odoo#112450
This commit is contained in:
Christophe Monniez
2023-02-14 08:03:23 +01:00
parent 1e35315399
commit a3dffa86f5
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -139,7 +139,7 @@ class Lang(models.Model):
except locale.Error:
continue
if fail:
lc = locale.getdefaultlocale()[0]
lc = locale.getlocale()[0]
msg = 'Unable to get information for locale %s. Information from the default locale (%s) have been used.'
_logger.warning(msg, lang, lc)
+1 -1
View File
@@ -1412,7 +1412,7 @@ def trans_load_data(cr, fileobj, fileformat, lang, verbose=True, overwrite=False
def get_locales(lang=None):
if lang is None:
lang = locale.getdefaultlocale()[0]
lang = locale.getlocale()[0]
if os.name == 'nt':
lang = _LOCALE2WIN32.get(lang, lang)