From 43bb4790d4a398f81f07d43fd0ee8cb075783290 Mon Sep 17 00:00:00 2001 From: Roman Perekhod Date: Mon, 24 Jul 2023 18:04:12 +0200 Subject: [PATCH] fix the default document language for OnlyOffice --- ...ix-onlyoffice-default-document-language.md | 6 +++++ pkg/app/provider/wopi/wopi.go | 25 ++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 changelog/unreleased/fix-onlyoffice-default-document-language.md diff --git a/changelog/unreleased/fix-onlyoffice-default-document-language.md b/changelog/unreleased/fix-onlyoffice-default-document-language.md new file mode 100644 index 0000000000..b1e6c0a76b --- /dev/null +++ b/changelog/unreleased/fix-onlyoffice-default-document-language.md @@ -0,0 +1,6 @@ +Bugfix: fix the default document language for OnlyOffice + +Fix the default document language for OnlyOffice + +https://github.com/cs3org/reva/pull/4078 +https://github.com/owncloud/enterprise/issues/5807 diff --git a/pkg/app/provider/wopi/wopi.go b/pkg/app/provider/wopi/wopi.go index 11744154ec..c2a57311eb 100644 --- a/pkg/app/provider/wopi/wopi.go +++ b/pkg/app/provider/wopi/wopi.go @@ -254,9 +254,9 @@ func (p *wopiProvider) GetAppURL(ctx context.Context, resource *provider.Resourc urlQuery := url.Query() if language != "" { - urlQuery.Set("ui", language) // OnlyOffice - urlQuery.Set("lang", language) // Collabora - urlQuery.Set("UI_LLCC", language) // Office365 + urlQuery.Set("ui", language) // OnlyOffice + urlQuery.Set("lang", covertLangTag(language)) // Collabora, Impact on the default document language of OnlyOffice + urlQuery.Set("UI_LLCC", language) // Office365 } if p.conf.AppDisableChat { urlQuery.Set("dchat", "1") // OnlyOffice disable chat @@ -470,3 +470,22 @@ func getEtherpadExtensions(appURL string) map[string]map[string]string { } return appURLs } + +// TODO Find better solution +// This conversion was made because no other way to set the default document language to OnlyOffice was found. +func covertLangTag(lang string) string { + switch lang { + case "cs": + return "cs-CZ" + case "de": + return "de-DE" + case "es": + return "es-ES" + case "fr": + return "fr-FR" + case "it": + return "it-IT" + default: + return "en" + } +}