SergeyMosin / Appointments

Nextcloud Appointments App
GNU Affero General Public License v3.0
160 stars 47 forks source link

Manage appointments in a multilingual environment #444

Open aforrer999 opened 1 year ago

aforrer999 commented 1 year ago

Allow the integration into a multilingual website, with public forms and all Email messaging in the specific language.

Sarmingsteiner commented 1 year ago

This should work somehow, as the language changes itself to the one of the user's web browser.

aforrer999 commented 1 year ago

Thank you for your reply. Like for many other SW-Packages, the current approach doesn't work properly in a multilingual country like Switzerland. Use case: Run the application in one language with public customer access (like here for Appointments). Beside the language itself are various notation conventions as well. Concretely, I run nextcloud in English and have to provide public access in French, German, Italian and English. Today the result is a mixup of platform, country, Browser, language settings and customized forms. In particular the agenda input, with e.g. a German form and US time format. I'm interested in solving this issue and any related suggestions, tips and links are welcome. This will greatly shorten my learning curve for the NC environment.

webermax commented 10 months ago

It's not only Switzerland, but it doesn't work for any international Site not only relying on browser language detection...

We suggest havind an optional URL paramater to override UI language.

aforrer999 commented 10 months ago

That's correct, I just mentioned Switzerland to provide a concrete case. Your suggestion looks most flexible way forward. Any tips for relevant code location(s) or links to relevant documentation are welcome (it will reduce the reverse engineering effort). Thx

SergeyMosin commented 10 months ago

This is related to #128 .

Any tips for relevant code location(s)

The original commit is here: https://github.com/SergeyMosin/Appointments/commit/06787e3c1e1dc6fcbcd55904fb9391fef82c28a8#diff-915097a02e35fa2bada093b9f0ee054f72fb0476d1a591ccf2eb216239251c9a

Basically if the lang var is an empty array then the language will be determined by browser locale. However, as of now the language is taken from NC settings which set data-locale and/or lang attributes on the HTML element. Current code is here: https://github.com/SergeyMosin/Appointments/blob/0de63317b1d0f04331c7c50d41600e474320a18f/src/form.js#L508-L512

The lang var usage is here: https://github.com/SergeyMosin/Appointments/blob/0de63317b1d0f04331c7c50d41600e474320a18f/src/form.js#L528-L531

*** Intl.DateTimeFormat() constructor info https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat

Jolopu commented 9 months ago

I also would need Appointments to work on a multilingual site with one NC installation. If I can help with translation or beta testing, let me know.