Extracting default locale to a global constant

This commit is contained in:
Jarosław Sadziński 2022-11-09 12:14:31 +01:00
parent e09f71e481
commit b72e668705
3 changed files with 4 additions and 3 deletions

View File

@ -16,7 +16,7 @@ import usertypes
import relabeling
import table
import moment
from schema import RecalcWhen
from schema import RecalcWhen, DEFAULT_LOCALE
# pylint:disable=redefined-outer-name
@ -66,7 +66,7 @@ class MetaTableExtras(object):
return {}
def locale(rec, table):
return rec.parsed_settings.get("locale", "en-US")
return rec.parsed_settings.get("locale", DEFAULT_LOCALE)
def friendly_traceback_set_lang(rec, table):
try:

View File

@ -802,7 +802,7 @@ def migration22(tdset):
def migration23(tdset):
return tdset.apply_doc_actions([
add_column('_grist_DocInfo', 'documentSettings', 'Text'),
actions.UpdateRecord('_grist_DocInfo', 1, {'documentSettings': '{"locale":"en-US"}'})
actions.UpdateRecord('_grist_DocInfo', 1, {'documentSettings': '{"locale":"' + schema.DEFAULT_LOCALE + '"}'})
])

View File

@ -16,6 +16,7 @@ import six
import actions
SCHEMA_VERSION = 33
DEFAULT_LOCALE = "en-US"
def make_column(col_id, col_type, formula='', isFormula=False):
return {