From 5596ae17ce3610ebb23f7709112fdcaa314efc28 Mon Sep 17 00:00:00 2001 From: Pranav Kant Date: Wed, 5 Apr 2017 15:53:07 +0530 Subject: [PATCH] Fix incorrect language tags feeding to loleaflet loleaflet expect a BCP47 language tag syntax while OC.getLocale returns a lanugage tag where subtags are separated by '_' instead of '-' (BCP47). It seems safe to just replace '_' with '-' before feeding it to loleaflet --- js/documents.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/documents.js b/js/documents.js index 3c44b34b..d902d182 100644 --- a/js/documents.js +++ b/js/documents.js @@ -129,7 +129,7 @@ var documentsMain = { var urlsrc = documentsMain.urlsrc + "WOPISrc=" + wopisrc + "&title=" + encodeURIComponent(title) + - "&lang=" + OC.getLocale() + + "&lang=" + OC.getLocale().replace('_', '-') + // loleaflet expects a BCP47 language tag syntax "&permission=readonly"; // access_token - must be passed via a form post @@ -320,7 +320,7 @@ var documentsMain = { var urlsrc = documentsMain.urlsrc + "WOPISrc=" + wopisrc + "&title=" + encodeURIComponent(title) + - "&lang=" + OC.getLocale() + + "&lang=" + OC.getLocale().replace('_', '-') + // loleaflet expects a BCP47 language tag syntax "&closebutton=1" + "&revisionhistory=1"; if (!documentsMain.canEdit || action === "view") {