-
Notifications
You must be signed in to change notification settings - Fork 14
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
Fixed ui language detection #138
Conversation
Signed-off-by: Tobias Kleffmann <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for your pull request, I have two small comments that we'd need to resolve, otherwise this makes lot of sense 👍
@@ -46,7 +46,7 @@ const getWopiUrl = ({ fileId, title, readOnly, closeButton, revisionHistory }) = | |||
return Config.get('urlsrc') | |||
+ 'WOPISrc=' + wopisrc | |||
+ '&title=' + encodeURIComponent(title) | |||
+ '&lang=' + languageToBCP47() | |||
+ '&ui=' + getLocale().replace(/_/g, '-') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As https://wopi.readthedocs.io/en/latest/discovery.html#term-ui-llcc defines the UI language it should use getLanguage() in this case.
https://wopi.readthedocs.io/en/latest/faq/languages.html#languages
Single language codes from Nextcloud like "en" should also be fine here according to the Office API docs:
You may also use any value provided it is in the format described in RFC 1766.
@@ -20,35 +20,6 @@ | |||
* | |||
*/ | |||
|
|||
import { getLanguage, getLocale } from '@nextcloud/l10n' | |||
|
|||
const languageToBCP47 = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The export in line 28 also needs to be removed to make the lint CI run happy.
After reading up on the documentation I came up with #148 which I tent to consider to be more aligned with how the language should be set on office online servers. Testing of that PR is also very welcome, we could still get this one in as a cleanup in order to not set the unused lang parameter. Thanks for getting this started anyways :) |
Thanks a lot for getting this started, we've just merged a slightly different implementation of this in #148 on the backend side since the mapping to the correct language strings needed a bit more handling to properly work with office online. |
Signed-off-by: Tobias Kleffmann [email protected]
Summary
Submit desired language as correct parameter
ui=...
.Removed obsolete code.
TODO
Checklist