You are viewing limited content. For full access, please sign in.

Question

Question

Laserfiche web client language preference detection

asked on January 22, 2021

We're working on a project that builds custom actions/custom tabs which will open web pages to perform actions. One challenge we face is multi-language support.

Laserfiche Web Client integration provided an API (WebAccessAPI) to get information from entries, login etc. I am wondering if there is way to get current user's language selection?  The setting is like this which through "Account"->"Option"->"General":

 

Anyone has such experience?

0 0

Answer

SELECTED ANSWER
replied on January 22, 2021

This is controlled by a cookie called "Language". It is currently marked "HttpOnly" (which is the secure default), so it's not available to scripts. Note that the default of "use browser language" is indicated by not having the cookie, so you would need to determine this on your own in most cases even if you could read the cookie. Browsers have an Accept-Language header to communicate this to servers.

1 0
replied on January 22, 2021

Thank you Brian.

I did a little check on what are you saying on monitoring cookie that  when I send request from web client to Laserfiche server. Here are my finding

1. Set Browser to "english"

1.1 Option->general->Language = "Use browser language"

cookie doesn't have "Language"

LF web client shows in "English"

1.2 Option->general->Language = [any other available language]

cookie does have the "Language" which reflect the chosen language

LF web client shows in "Language" of chosen

2. Set Browser to "French" (we are in Canada, second official language)

2.1 Option->general->Language = "Use browser language"

cookie doesn't have "Language"

LF web client shows in "French"

2.2 Option->general->Language = [any other available language]

cookie does have the "Language" which reflect the chosen language

LF web client shows in "Language" of chosen

 

So the expectation would be:

1. First detect cookie name "Language", if it exist then use that value for displaying custom web page

2. If no cookie name "Language" exist, then use "Browser language" for displaying custom web page

 

One thing I found out (as show in screenshot), there is always a cookie named "UserInfo" (given user already has a valid LF web session), and  in it also has a "UserLanguage" which should be the default LF user language settings. Not sure if we can use it as another way of telling what language should display.

0 0
replied on January 25, 2021

Yes, that's the logic for the cookie. I don't know which application sets the UserInfo cookie, but I believe it's not web client.

1 0
replied on February 1, 2021 Show version history

"UserInfo" should be our custom web application generated cookie. But I don't know why it mixed with LF web client's network traffic.

 

update: because the web client and web application reference same domain entry.

0 0
replied on February 5, 2021 Show version history

Looks like we thought too much when the web page language already indicated in the DOM

 

Our use case is to let the Web Client start the custom dialog and use the same language Web Client current use (to display). So it's not necessary to know Web Client language choice at all.

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.