Office Online Server does not respect the default language of the user in Nextcloud

Hello. I have a fresh Nextcloud 20 installed, with SSL correctly configured. Have the Office Online app installed, and a properly implemented Microsoft Office Online Server.

Everything works perfectly, I can open and edit Word, Excel and PowerPoint files, but … Nextcloud’s interface language is not respected by Word Online, Excel Online, and PowerPoint Online. These applications always open in the English language, despite having the language packs installed on the Office Online server.

What can you do about it? I wonder if it is a bug in Nextcloud, or some configuration you have to touch.

Any help please?

PS: I have neither SharePoint Server nor Exchange Server. Office Online Server only

Hi,

I have the same issue. If I install the english language pack, it will be set by default.
It’s impossible to change the language then, even if other language packs are installed.

I also only have OOS for Nextcloud.

Hi,

I found a workaround to get this working until apps (wopi or office online integration) send the language to OOS.

The problem is that OOS is not aware of the language used (no parameter is sent) and OOS can’t find out itself which language to use.
The result is that it falls back on en_US. The cookie is set like this: DcLcid=ui=1033&data=1033.
1033 is for en_US (see Locale ID / LCID code list).

What I did, on OOS server, is:

  • install the mod URL rewrite (https://www.iis.net/downloads/microsoft/url-rewrite)
  • create a new outgoing rewrite rule in the new installed module
  • I set the name to Set-Cookie (not important I guess)
  • Corresponding to a server variable named RESPONSE_Set-Cookie
  • Corresponding to a regex model
  • The model is: DcLcid=ui=1033&data=1033; path=/; secure; HttpOnly
  • In conditions, add a new line with {HTTP_ACCEPT_LANGUAGE} as entry, and which correspond to a regex like, in my case for French: ^fr.* (which mean the browser has to tell its default language is french, because it starts with fr, even if other languages are installed, which is my case)
  • Then I rewrite with (for french): DcLcid=ui=1036&data=1036; path=/; secure; HttpOnly

I don’t remember if I had to restart IIS or not at the end.

So with this rewrite rule, if the browser sends in HTTP_ACCEPT_LANGUAGE something like: fr-FR;fr;[…], then the UI and the data (for excel) will be in french because the cookie will be overwritten.
Otherwise, the default language will be en_US.

It should work with any language and also multiple language with multiple rules. Just have to change the Lcid number.

Despite of this, I still have one issue: the decimal separator in en_US is the dot, but in french it’s the comma, and with the numpad, a dot will be printed instead of a comma so the number is text… I don’t have time to spend on this right now, but it’s annoying.

However, the good think is that OOS converts data in Excel for any language! And when multiple users collaborate, the first one connected define the language which will be used (for the data) and warns other users. Very well handled!

Hope it helps!

I’m so glad to read that you found an answer to this problem. I did what you mention in the post, but I think I have misunderstood what you describe, because it didn’t work for me; when I try to open a document from Nextcloud, it keeps trying to open forever. I did something wrong … my writing rule in the following image:
RewriteRule_001

Okay. I made the restriction rule less restrictive. I removed the {HTTP_ACCEPT_LANGUAGE} condition (so that regardless of the language of the web browser, the same rule applies). At the same time, I shortened the regex model and additionally unchecked the “Ignore upper and lower case” box (to make it Case-Sensitive).
My rewrite rule looked like this:

Also very important: delete browser data (previous cookies and cache, etc). Even trying a private browser might help. And it worked!

Thank you very much for your help @orchal

Hi,

Glad to hear it works! Sorry for the delay, I wasn’t available to answer.

If you don’t need english at all, I guess it’s okay! In my case we need at least both language.

I don’t know why it does not work, maybe your cookies are not secure by default, I set up Apache for nextcloud to always add the part concerning httponly blah blah blah…

You probably only have DcLcid=ui=1033&data=1033. But the condition should work with {HTTP_ACCEPT_LANGUAGE}…

Nevermind, if you don’t need english, you could even not use regex at all but the exact string.

You’re right, I forgot to mention about the browser cache and cookies, although I had he issue.

Cheers!

To other people who might need this, the best way to get the cookie string is to use the network panel in the console browser.

You’ll then know what you need to replace.

There seems to be a proper Fix being implemented in #148. We may expect this to make it into the next app release I think.