Skip to content

Commit

Permalink
Merge pull request #1995 from ValdikSS/translation-fix
Browse files Browse the repository at this point in the history
Always translate html files to avoid compatibility problems with brackets in url
  • Loading branch information
HelloZeroNet authored Apr 23, 2019
2 parents 3366edc + fd7f724 commit 8dd3a84
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions plugins/TranslateSite/TranslateSitePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@
@PluginManager.registerTo("UiRequest")
class UiRequestPlugin(object):
def actionSiteMedia(self, path, **kwargs):
file_name = path.split("/")[-1]
file_name = path.split("/")[-1].lower()
if not file_name: # Path ends with /
file_name = "index.html"
extension = file_name.split(".")[-1]
if translate.lang != "en" and extension in ["js", "html"]:
if extension == "html":
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)
kwargs["header_length"] = False
file_generator = super(UiRequestPlugin, self).actionSiteMedia(path, **kwargs)
Expand Down

0 comments on commit 8dd3a84

Please sign in to comment.