Set locale of viewer to locale of Nextcloud.

This avoids differences in the language of Nextcloud and the viewer if
the browser lanuage is different from the language of the Nextcloud user.
This commit is contained in:
Joachim Bauch 2022-06-17 15:18:12 +02:00
parent 195434fc28
commit c268cd1cad
No known key found for this signature in database
GPG key ID: 77C1D22D53E15F02

View file

@ -87,6 +87,14 @@ if (OCA.FilesPdfViewer && OCA.FilesPdfViewer.PreviewPlugin) {
};
}
document.addEventListener("webviewerloaded", function(event) {
var locale = OC.getLocale();
if (locale && event.detail && event.detail.source && event.detail.source.PDFViewerApplicationOptions) {
var PDFViewerApplicationOptions = event.detail.source.PDFViewerApplicationOptions;
PDFViewerApplicationOptions.set('locale', locale.replace('_', '-'));
}
});
$(document).ready(function() {
if (OCA.Sharing && OCA.Sharing.PublicApp) {
var mimetype = $("#mimetype");