refactor: Rename guess_language as get_language

Guess suggests there's some AI involvement. The get_language function
has a defined priority. It is deterministic, hence teh name change.
This commit is contained in:
Gavin D'souza 2021-07-13 17:09:03 +05:30
parent c47cbfd2ef
commit 76ec9e44e4
2 changed files with 3 additions and 3 deletions

View file

@ -10,7 +10,7 @@ import frappe.utils.user
from frappe import conf
from frappe.sessions import Session, clear_sessions, delete_session
from frappe.modules.patch_handler import check_session_stopped
from frappe.translate import guess_language
from frappe.translate import get_language
from frappe.utils.password import check_password
from frappe.core.doctype.activity_log.activity_log import add_authentication_log
from frappe.twofactor import (should_run_2fa, authenticate_for_2factor,
@ -92,7 +92,7 @@ class HTTPRequest:
frappe.throw(_("Invalid Request"), frappe.CSRFTokenError)
def set_lang(self):
frappe.local.lang = guess_language()
frappe.local.lang = get_language()
def get_db_name(self):
"""get database name from conf"""

View file

@ -21,7 +21,7 @@ from frappe.model.utils import InvalidIncludePath, render_include
from frappe.utils import is_html, strip, strip_html_tags
def guess_language(lang_list=None):
def get_language(lang_list=None):
"""Set `frappe.local.lang` from HTTP headers at beginning of request
Order of priority for setting language: