Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the default document language for OnlyOffice #4078

Merged
merged 1 commit into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
25 changes: 22 additions & 3 deletions pkg/app/provider/wopi/wopi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose that the function name was supposed to be convertLangTag
But it doesn't matter - it is just a function name.

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"
}
}