Pass the lang paramater to loleaflet from ownCloud user settings, which controls UI language

pull/1/head
Andras Timar 8 years ago
parent 595e7f3109
commit e22151a2b5

@ -256,7 +256,8 @@ class DocumentController extends Controller {
$response = array(
'status' => 'success',
'fileid' => $info['fileid'],
'urlsrc' => $this->getWopiSrcUrl($discovery_parsed, $mimetype, 'edit')
'urlsrc' => $this->getWopiSrcUrl($discovery_parsed, $mimetype, 'edit'),
'lolang' => $this->settings->getUserValue($this->uid, 'core', 'lang', 'en')
);
} else {
$response = array(
@ -471,6 +472,7 @@ class DocumentController extends Controller {
$documents[$key]['icon'] = preg_replace('/\.png$/', '.svg', \OCP\Template::mimetype_icon($document['mimetype']));
$documents[$key]['hasPreview'] = \OC::$server->getPreviewManager()->isMimeSupported($document['mimetype']);
$documents[$key]['urlsrc'] = $this->getWopiSrcUrl($discovery_parsed, $document['mimetype'], 'edit');
$documents[$key]['lolang'] = strtolower(str_replace('_', '-', $this->settings->getUserValue($this->uid, 'core', 'lang', 'en')));
$fileIds[] = $document['fileid'];
}

@ -32,6 +32,7 @@ $.widget('oc.documentGrid', {
.attr('title', document.path)
.attr('original-title', document.path)
.attr('urlsrc', document.urlsrc)
.attr('lolang', document.lolang)
.find('label').text(document.name)
;
@ -234,6 +235,7 @@ var documentsMain = {
var urlsrc = $('li[data-id='+ documentsMain.fileId +']>a').attr('urlsrc') +
"WOPISrc=" + wopisrc +
"&title=" + encodeURIComponent(title) +
"&lang=" + $('li[data-id='+ documentsMain.fileId +']>a').attr('lolang') +
"&closebutton=1";
// access_token - must be passed via a form post
@ -466,6 +468,7 @@ var documentsMain = {
if (response && response.fileid){
docElem.attr('data-id', response.fileid);
docElem.find('a').attr('urlsrc', response.urlsrc);
docElem.find('a').attr('lolang', response.lolang);
documentsMain.prepareSession();
documentsMain.joinSession(response.fileid);
} else {

Loading…
Cancel
Save