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

(cherry picked from commit 5596ae17ce3610ebb23f7709112fdcaa314efc28)
Signed-off-by: Andras Timar <andras.timar@collabora.com>
This commit is contained in:
Pranav Kant 2017-04-05 15:53:07 +05:30 committed by Andras Timar
parent 674a6cb384
commit f790f640b1

View File

@ -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") {