mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
cleaning up names / comments
This commit is contained in:
parent
4d439db322
commit
99dc02e2cb
@ -28,14 +28,14 @@ class Command(BaseCommand):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def handle(self, *args, **kwargs):
|
def handle(self, *args, **kwargs):
|
||||||
# static directorys
|
# static directories
|
||||||
LC_DIR = settings.LOCALE_PATHS[0]
|
LC_DIR = settings.LOCALE_PATHS[0]
|
||||||
SOURCE_DIR = settings.STATICFILES_I18_SRC
|
SOURCE_DIR = settings.STATICFILES_I18_SRC
|
||||||
TARTGET_DIR = settings.STATICFILES_I18_TRG
|
TARGET_DIR = settings.STATICFILES_I18_TRG
|
||||||
|
|
||||||
# ensure static directory exists
|
# ensure static directory exists
|
||||||
if not os.path.exists(TARTGET_DIR):
|
if not os.path.exists(TARGET_DIR):
|
||||||
os.mkdir(TARTGET_DIR)
|
os.makedirs(TARGET_DIR, exist_ok=True)
|
||||||
|
|
||||||
# collect locales
|
# collect locales
|
||||||
locales = {}
|
locales = {}
|
||||||
@ -47,7 +47,7 @@ class Command(BaseCommand):
|
|||||||
# render!
|
# render!
|
||||||
request = HttpRequest()
|
request = HttpRequest()
|
||||||
ctx = {}
|
ctx = {}
|
||||||
processors = tuple(import_string(path) for path in settings.STATFILES_I18_PROCESORS)
|
processors = tuple(import_string(path) for path in settings.STATFILES_I18_PROCESSORS)
|
||||||
for processor in processors:
|
for processor in processors:
|
||||||
ctx.update(processor(request))
|
ctx.update(processor(request))
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ class Command(BaseCommand):
|
|||||||
path = os.path.join(SOURCE_DIR, file)
|
path = os.path.join(SOURCE_DIR, file)
|
||||||
if os.path.exists(path) and os.path.isfile(path):
|
if os.path.exists(path) and os.path.isfile(path):
|
||||||
print(f"render {file}")
|
print(f"render {file}")
|
||||||
render_file(file, SOURCE_DIR, TARTGET_DIR, locales, ctx)
|
render_file(file, SOURCE_DIR, TARGET_DIR, locales, ctx)
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError('Using multi-level directories is not implemented at this point') # TODO multilevel dir if needed
|
raise NotImplementedError('Using multi-level directories is not implemented at this point') # TODO multilevel dir if needed
|
||||||
print(f"rendered all files in {SOURCE_DIR}")
|
print(f"rendered all files in {SOURCE_DIR}")
|
||||||
|
@ -197,7 +197,7 @@ STATICFILES_I18_TRG = STATICFILES_DIRS[0] + '_' + STATICFILES_I18_PREFIX
|
|||||||
STATICFILES_DIRS.append(STATICFILES_I18_TRG)
|
STATICFILES_DIRS.append(STATICFILES_I18_TRG)
|
||||||
STATICFILES_I18_TRG = os.path.join(STATICFILES_I18_TRG, STATICFILES_I18_PREFIX)
|
STATICFILES_I18_TRG = os.path.join(STATICFILES_I18_TRG, STATICFILES_I18_PREFIX)
|
||||||
|
|
||||||
STATFILES_I18_PROCESORS = [
|
STATFILES_I18_PROCESSORS = [
|
||||||
'InvenTree.context.status_codes',
|
'InvenTree.context.status_codes',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user