Always translate html files to avoid compatibility problems with brackets in url
This commit is contained in:
parent
bf7597e1b2
commit
90fee9788d
1 changed files with 10 additions and 2 deletions
|
@ -7,11 +7,19 @@ from Translate import translate
|
||||||
@PluginManager.registerTo("UiRequest")
|
@PluginManager.registerTo("UiRequest")
|
||||||
class UiRequestPlugin(object):
|
class UiRequestPlugin(object):
|
||||||
def actionSiteMedia(self, path, **kwargs):
|
def actionSiteMedia(self, path, **kwargs):
|
||||||
file_name = path.split("/")[-1]
|
file_name = path.split("/")[-1].lower()
|
||||||
if not file_name: # Path ends with /
|
if not file_name: # Path ends with /
|
||||||
file_name = "index.html"
|
file_name = "index.html"
|
||||||
extension = file_name.split(".")[-1]
|
extension = file_name.split(".")[-1]
|
||||||
if translate.lang != "en" and extension in ["js", "html"]:
|
|
||||||
|
if extension == "html": # Always replace translate variables in html files
|
||||||
|
should_translate = True
|
||||||
|
elif extension == "js" and translate.lang != "en":
|
||||||
|
should_translate = True
|
||||||
|
else:
|
||||||
|
should_translate = False
|
||||||
|
|
||||||
|
if should_translate:
|
||||||
path_parts = self.parsePath(path)
|
path_parts = self.parsePath(path)
|
||||||
kwargs["header_length"] = False
|
kwargs["header_length"] = False
|
||||||
file_generator = super(UiRequestPlugin, self).actionSiteMedia(path, **kwargs)
|
file_generator = super(UiRequestPlugin, self).actionSiteMedia(path, **kwargs)
|
||||||
|
|
Loading…
Reference in a new issue