mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #2548 from SchrodingersGat/i18n-fix
Fix for i18n javascript
This commit is contained in:
commit
a066b9b18d
@ -451,8 +451,17 @@ class I18nStaticNode(StaticNode):
|
||||
replaces a variable named *lng* in the path with the current language
|
||||
"""
|
||||
def render(self, context):
|
||||
self.path.var = self.path.var.format(lng=context.request.LANGUAGE_CODE)
|
||||
|
||||
self.original = getattr(self, 'original', None)
|
||||
|
||||
if not self.original:
|
||||
# Store the original (un-rendered) path template, as it gets overwritten below
|
||||
self.original = self.path.var
|
||||
|
||||
self.path.var = self.original.format(lng=context.request.LANGUAGE_CODE)
|
||||
|
||||
ret = super().render(context)
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
@ -480,4 +489,5 @@ else:
|
||||
# change path to called ressource
|
||||
bits[1] = f"'{loc_name}/{{lng}}.{bits[1][1:-1]}'"
|
||||
token.contents = ' '.join(bits)
|
||||
|
||||
return I18nStaticNode.handle_token(parser, token)
|
||||
|
Loading…
Reference in New Issue
Block a user