MeshAgent icon indicating copy to clipboard operation
MeshAgent copied to clipboard

Set agent language by the remote helper or by another option

Open rsmehlik opened this issue 7 months ago • 7 comments

Hi,

is there a way to set the agent language when the remote helper initiates a connection to remote computer and the user has to agree to a consent message?

The agent is installed as a windows service (Windows 11) and after reviewing the source code i know, that the agent automatically detects the OS language. We have several Windows machines that are manually localized to a language other than en-US. However, since the system's default UI language is still en-US the consent message is translated to English even when the user uses another system language.

It would be nice to somehow set the target language before displaying the consent message. Or is there any other option?

Thank you.

rsmehlik avatar May 05 '25 20:05 rsmehlik

Do u use a custom consent message? Or the normal default one? I would have to look at the source code for meshcentral to work it out Because the consent message is passed from the meshcore.js on the server side

si458 avatar May 05 '25 20:05 si458

We don't use a custom consent message. Agent is already translated to the Czech language in source code. When i run agent from cli with the parameter -lang=cs, agent is translated to the Czech language.

rsmehlik avatar May 05 '25 20:05 rsmehlik

So if u use an argument and it's always Czech, isn't the consent on Czech too?

I would have to look into the source code Wednesday when I have free time.

Also the translations for the meshagent are in the meshcentral repo https://github.com/Ylianst/MeshCentral/blob/master/agents%2Fagent-translations.json

It might be that's the translations for that string are missing OR something else is wrong

si458 avatar May 05 '25 20:05 si458

I can't set this argument for a running service, only for install/uninstall/update agent. Without the lang parameter the setup gui is translated to English. Tried to install agent service with this parameter but no luck. I think the issue is with multilingual windows and agent language detection. I will investigate further. Thank you for your time.

rsmehlik avatar May 06 '25 05:05 rsmehlik

@rsmehlik I did have a little look at source code last night on my mobile

The meshcore.js reads all the translations and is indeed meant to convert the consent text

but from looking, I have a feeling there are no translations for this text. It's completely missing?

You can check the agent-translations.json in the agents folder of meshcentral

That's why it's not working

si458 avatar May 06 '25 06:05 si458

ok ive had a look on my lappy instead this morning, the file is actually called coretranslations.json and you can verify translations for the meshagent by running translations on the console tab of a device in the web ui

so my mistake (still learning)

the meshagent gets its language by running require('util-language').current this in turn gets the language of the OSLanguage from the WMI SELECT OSLanguage FROM Win32_OperatingSystem i verified all this by checking meshcore.js and util-language.js

please can you share screenshots of the language settings etc you have on the OS from the settings panel? i need all info, like keyboard layout, region, windows display language, etc so i can try replicate your setup to see whats going on

i can also see the is an option -lang which should force the language too, which works when you run the agent manually

but unfortunately this must be attached when you run the exe, so it wont apply when its run as a background service unless you change the service agruments manually in the registry etc https://superuser.com/a/1507466/1264697

what we need to do is add an extra value into the .msh file to load the language you want

this would require a new agent release/testing etc so will take some time

si458 avatar May 06 '25 08:05 si458

Thank you. My investigation through the source code and the system is same as your is. Adding extra value to the .msh file is a great option. Another one could be set the language by the client environment variable (LANG for example). This is already implemented in util-language.js for Linux systems. Thank you.

Image Image Image Image

rsmehlik avatar May 06 '25 08:05 rsmehlik