Merge branch 'develop' into patch-1

This commit is contained in:
Shariq Ansari 2022-11-03 15:25:09 +05:30 committed by GitHub
commit cdadff1f4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 3 deletions

View file

@ -284,7 +284,9 @@ def build_for_autosuggest(res: list[tuple], doctype: str) -> list[dict]:
item = list(item)
label = item[1] # use title as label
item[1] = item[0] # show name in description instead of title
del item[2] # remove redundant title ("label") value
if len(item) >= 3 and item[2] == label:
# remove redundant title ("label") value
del item[2]
results.append({"value": item[0], "label": label, "description": to_string(item[1:])})
else:
results.extend({"value": item[0], "description": to_string(item[1:])} for item in res)

View file

@ -1,6 +1,7 @@
@import '../common/quill';
@import 'variables';
@import '~bootstrap/scss/bootstrap';
@import '~cropperjs/dist/cropper.min';
@import "../common/mixins";
@import "../common/global";
@import "../common/icons";

View file

@ -112,6 +112,14 @@ class TestTranslate(FrappeTestCase):
self.assertIn(return_val, [second_lang, get_parent_language(second_lang)])
def test_global_translations(self):
""" """
site = frappe.local.site
frappe.destroy()
_("this shouldn't break")
frappe.init(site=site)
frappe.connect()
def test_guest_request_language_resolution_with_request_header(self):
"""Test for frappe.translate.get_language

View file

@ -291,7 +291,12 @@ def get_all_translations(lang: str) -> dict[str, str]:
return all_translations
return frappe.cache().hget(MERGED_TRANSLATION_KEY, lang, generator=_merge_translations)
try:
return frappe.cache().hget(MERGED_TRANSLATION_KEY, lang, generator=_merge_translations)
except Exception:
# People mistakenly call translation function on global variables
# where locals are not initalized, translations dont make much sense there
return {}
def get_translations_from_apps(lang, apps=None):

View file

@ -30,7 +30,7 @@ dependencies = [
"cairocffi==1.2.0",
"chardet~=4.0.0",
"croniter~=1.3.5",
"cryptography~=37.0.2",
"cryptography~=38.0.3",
"email-reply-parser~=0.5.12",
"git-url-parse~=1.2.2",
"gunicorn~=20.1.0",