[SOLVED] Setting the DOCUMENTS_LANGUAGE parameter has no effect

When things don't work as they should.
aaribaud
Posts: 18
Joined: Mon Sep 23, 2019 9:30 am

[SOLVED] Setting the DOCUMENTS_LANGUAGE parameter has no effect

Post by aaribaud »

Hello all,

I am using a docker install of Mayan EDMS v3.3.10, with French i10n (probably selected based on browser info, as the Mayan admin account does not have French selected).

I am trying to pre-select French as the default document language when uploading.

In the Mayan web interface, under Configuration/Parameters/Documents, I set DOCUMENTS_LANGUAGE to 'fra'
.
After this change, I did see the warning about having to restart, so I did stop all three containers, then started them again.

But when I try to upload a document, after selecting the document type, the document language dropbox still has English pre-selected.

Through a console inside the Mayan container, I could check that /var/lib/mayan/config.yml indeed has DOCUMENTS_LANGUAGE set to 'fra'.

Is there something else to do in addition to setting DOCUMENTS_LANGUAGE?

User avatar
rssfed23
Moderator
Moderator
Posts: 213
Joined: Mon Oct 14, 2019 1:18 pm
Location: United Kingdom
Contact:

Re: Setting the DOCUMENTS_LANGUAGE parameter has no effect

Post by rssfed23 »

How did you initially set up mayan/docker? As in, are you using the get-mayan script or running the docker/docker-compose commands manually?

What environment variables are you using when starting Mayan? - It should match what's in the config.yml (or be unspecified at all) but the environment variables usually override what's in the config.yml file so I'd recommend setting it as a docker environment variable as well:
MAYAN_DOCUMENTS_LANGUAGE.

There's also LANGUAGE_CODE if you want to change the UI language of Mayan to French. The language code for that is simply "fr" though.
Please bear with us during the current global situation. The team all have families and local communities to look after as well as the community here. Responses may be delayed during this time, but rest assured we will get to your query eventually.

aaribaud
Posts: 18
Joined: Mon Sep 23, 2019 9:30 am

Re: Setting the DOCUMENTS_LANGUAGE parameter has no effect

Post by aaribaud »

I followed the instructions from https://docs.mayan-edms.com/chapters/do ... er-install except that I have docker already installed, so I skipped step 1 and started at step 2.

I used exactly the commands from steps 2 to 7, without changing anything -- even copy-pasting them to avoid any mistake, and I could log in the Mayan EDMS web UI.

The dominant document language was English ("Anglais", more precisely, as Mayan had guessed my French language from by browser), which is expected.

Then, in the Mayan EDMS Web UI, I followed System / Configuration / Settings / Documents / Parameters and DOCUMENTS_LANGUAGE from eng to fra.

Then -- as instructed by the warning in the UI -- I restarted the container with a "docker restart mayan-edms".

Back in the Web UI (with the warning gone), the dominant document language when uploading a document was still English.

I also tried stopping all three containers then starting them again, which changed nothing.

Incidentally, I also ran a trial where I would add the French tesseract OCR extension as an eight step, logging into the mayan-edms container with

Code: Select all

docker exec -it mayan-edms bash
and running the following

Code: Select all

apt update
apt install tesseract-ocr-fra
The OCR in itself worked (I could OCR scanned French text and do a search on it) but the presence or absence of the French OCR extension had no effect on dominant document language -- not that I expected it to; I am just mentioning this for completeness.

Then I did a full uninstall, making sure no docker container, image or volume was left behind and removing /docker-volumes/mayan-edms/ forcibly, then ran steps 2 to 7 again, this time adding these environment variables in the mayan-edms docker run command:

Code: Select all

-e MAYAN_DOCUMENTS_LANGUAGE=fra -e MAYAN_DOCUMENTS_LANGUAGE_CHOICES='["fra","Français"]'
IOW, I ran this command as step 7 (copy-pasted from the terminal I ran it on):

Code: Select all

docker run -d --name mayan-edms --restart=always -p 80:8000 -e MAYAN_DATABASES="{'default':{'ENGINE':'django.db.backends.postgresql','NAME':'mayan','PASSWORD':'mayanuserpass','USER':'mayan','HOST':'172.17.0.1'}}" -e MAYAN_CELERY_BROKER_URL="redis://:mayanredispassword@172.17.0.1:6379/0" -e MAYAN_CELERY_RESULT_BACKEND="redis://:mayanredispassword@172.17.0.1:6379/1" -e MAYAN_DOCUMENTS_LANGUAGE=fra -e MAYAN_DOCUMENTS_LANGUAGE_CHOICES='["fra","Français"]' -v /docker-volumes/mayan-edms/media:/var/lib/mayan mayanedms/mayanedms:3.3.10
Still, the dominant document language when uploading a document is English.

User avatar
rssfed23
Moderator
Moderator
Posts: 213
Joined: Mon Oct 14, 2019 1:18 pm
Location: United Kingdom
Contact:

Re: Setting the DOCUMENTS_LANGUAGE parameter has no effect

Post by rssfed23 »

Thanks for providing how you set up Mayan. That’s very helpful!

Using environment environment variables in the way you’ve described is definitely the best way to do it and is what I was going to suggest next. The -e way you passed should have worked.
I’m wondering if this is a bug on our end. I will try and reproduce it in a couple of hours and log a github issue on your behalf if so. Thanks for your patience, we’ll see what the developers say about this as what you ran should have worked.
Please bear with us during the current global situation. The team all have families and local communities to look after as well as the community here. Responses may be delayed during this time, but rest assured we will get to your query eventually.

aaribaud
Posts: 18
Joined: Mon Sep 23, 2019 9:30 am

Re: Setting the DOCUMENTS_LANGUAGE parameter has no effect

Post by aaribaud »

Thanks!

If you need any insight on my own setup (commands to run in the container, for instance) in order to compare a working vs non-working situation, feel free to ask me (PMs fine, e-mails too, instant messaging possible).

User avatar
rssfed23
Moderator
Moderator
Posts: 213
Joined: Mon Oct 14, 2019 1:18 pm
Location: United Kingdom
Contact:

Re: Setting the DOCUMENTS_LANGUAGE parameter has no effect

Post by rssfed23 »

Thanks for the offer, as I’m sure if I’m able to successfully set the language to french we’ll need the help figuring out why it won’t for you. We’ll use gitlab for that (and can make an issue private to prevent the leak of any confidential information about your environment).

I’ll start work on this in a couple of hours and provide an update by the end of the working day.

Rob
Please bear with us during the current global situation. The team all have families and local communities to look after as well as the community here. Responses may be delayed during this time, but rest assured we will get to your query eventually.

aaribaud
Posts: 18
Joined: Mon Sep 23, 2019 9:30 am

Re: Setting the DOCUMENTS_LANGUAGE parameter has no effect

Post by aaribaud »

Ok -- I can be found on Gitlab under the same nickname as I use on these forums.

User avatar
rssfed23
Moderator
Moderator
Posts: 213
Joined: Mon Oct 14, 2019 1:18 pm
Location: United Kingdom
Contact:

Re: Setting the DOCUMENTS_LANGUAGE parameter has no effect

Post by rssfed23 »

So I figured a couple of things out:

It's not DOCUMENTS_LANGUAGE_CHOICES but DOCUMENTS_LANGUAGE_CODES and is a map. It was changed around the 3.0 timeframe. If you open up the /docker-volumes/mayan-edms/media/config.yml file you'll see the available language codes and can remove some there.

When I remove all the other languages except fra from the list and set the environment variable "MAYAN_DOCUMENTS_LANGUAGE: fra" it only gives me french as an option on the new document screen.

Image

Environment variables should always override the local config file, so even if you leave DOCUMENTS_LANGUAGE as eng in the config.yml it will take the environment variables you provide. As long as you remove the existing container before launching it again with new environment variables then it should work. You can also just edit the config.yml file directly and as long as you don't overwrite it with any environment variables that method also worked on my tests.
Please bear with us during the current global situation. The team all have families and local communities to look after as well as the community here. Responses may be delayed during this time, but rest assured we will get to your query eventually.

aaribaud
Posts: 18
Joined: Mon Sep 23, 2019 9:30 am

Re: Setting the DOCUMENTS_LANGUAGE parameter has no effect

Post by aaribaud »

Thanks for the heads-up. This indeed works when I set both the default language to French and the list of language to French only.

However, I'd reduced the list only as a bug investigation measure; in my actual setup I need to be able to choose between various languages, with French the default but not the only choice.

Just to be sure, I just re-ran tests by:
- completely uninstalling all of Mayan again
- running steps 2-7 without any modification
- setting the default document language to fra from the UI
- restarting the container
- checking that the container's /var/lib/mayan/config.yml contained "DOCUMENTS_LANGUAGE: fra"

With the default DOCUMENTS_LANGUAGE_CODES, I still don't get French as the default.

Then if I reduce the list of DOCUMENTS_LANGUAGE_CODES to just "- fra", French becomes the default.

Then if I expand the list of DOCUMENTS_LANGUAGE_CODES to "- deu" and "- fra", French becomes the default and German is selectable.

But if I then set the list of DOCUMENTS_LANGUAGE_CODES to "- eng", "- deu" and "- fra", then English overrides French as the default

Of course, between these tests I did restart the container after changing config.yml.

It looks like:
  • if "eng" is not in the DOCUMENTS_LANGUAGE_CODES list, then DOCUMENTS_LANGUAGE works
  • if "eng" is in the DOCUMENTS_LANGUAGE_CODES list, then DOCUMENTS_LANGUAGE is ignored

User avatar
rssfed23
Moderator
Moderator
Posts: 213
Joined: Mon Oct 14, 2019 1:18 pm
Location: United Kingdom
Contact:

Re: Setting the DOCUMENTS_LANGUAGE parameter has no effect

Post by rssfed23 »

That's SUPER helpful! Exactly what we needed.
I've reproduced it my end as well. Logged under https://gitlab.com/mayan-edms/mayan-edms/issues/770
Please bear with us during the current global situation. The team all have families and local communities to look after as well as the community here. Responses may be delayed during this time, but rest assured we will get to your query eventually.

Post Reply