How can I associate given files with a particular locale setting?

I’d like to set up LO with a (for me) ‘default’ locale setting (Options > Languages > Local), say English (USA), but have a couple of files in particular that I’d always like open in an alternative locale setting, say Esperanto.

I was wondering if LO user profiles might be a way to achieve this: have one profile set to English, the other to Esperanto, and set up a desktop shortcut that passes the Esperanto filename(s) / user profile combo to LO as arguments. Is that feasible? And/or are there better ways to achieve what I want?

Edit: I’m on Linux, with LibreOffice 7.4.

You can make a parallel install of LibreOffice with a different locale. If you are on Windows, can try the Separate Install GUI.
But must open the file from the application with the chosen locale.

You don’t need a complete parallel install. This is only necessary if you want to keep installed different versions in parallel.
If you want to use one install with its sharable components, you can call the same
soffce executable with a command line parameter ordering it to load a specific user profile.
Having got valuable advice by a developing user some time ago, I do so (e.g.) on my Win 10 system setting an alternative profile using

"C:\Program Files\LibreOffice\program\soffice.exe" -env:UserInstallation=file:///C:/Users/MyUserID/AppData/Roaming/LibreOffice/alter/

where the folder alter contains a subfolder user defining my alternative profile and keeping the tracks.

The shown command is written to a Win-typical link named CurrLibOalter in my case and placed on the desktop. Any ordinary update of LibO will automatically also be called by that link.

A way to “associate” existing files to different user profiles is not known to me. Probably @LeroyG has tried if varying file “extensions” can help under Win to associate the files with different soffice-installs of the type he described.
The way I am using different profiles requires to open the application first, and then to choose the file to open.

2 Likes

To also be able to use different versions -even more than one at the same time- I prefer on Windows the PortableApps packages only needing to be extracted from the archive into an empty folder.
There you will find a classical ini-file App\AppInfo\Launcher\LibreOfficePortable.ini, and the first section "[Launch]" of it may contain or get appended a setting
SingleAppInstance = false which will allow to run the respective version in parallel with othert soffice instances.

BTW; I think there is no way to switch the -env:.UserInstalllation=... for a running soffice instance.

Thanks a lot for those suggestions, both of you.

I particularly like the track you’ve opened up, Lupp, with the -env switch. I’m on Linux, and have just been digging around trying to see if I can set an environment variable somewhere that will do the trick. The LO wiki lists the variables LANG and LC_ALL, which look promising, but it says nothing about them. According to the OO wiki, the latter “determines the values for all locale categories.”

But I’m having no luck with things like

$ env LANG=English localc

or

$ env LC_ALL="English (USA)" localc

Any of LC_ALL="English (USA)", LC_ALL="English", or LC_ALL="EN" result in warnings:

~ $ env LC_ALL="English (USA)" loffice

(soffice:373100): Gtk-WARNING **: 16:23:35.578: Locale not supported by C library.
	Using the fallback 'C' locale.
Fontconfig warning: ignoring English (USA): not a valid language tag
~ $ env LC_ALL="English" localc

(soffice:373178): Gtk-WARNING **: 16:23:49.593: Locale not supported by C library.
	Using the fallback 'C' locale.
Fontconfig warning: ignoring English: not a valid language tag
~ $ env LC_ALL="EN" localc

(soffice:373248): Gtk-WARNING **: 16:24:03.405: Locale not supported by C library.
	Using the fallback 'C' locale.
~ $

It seems like LANG or LC_ALL might not be of any use to me.

My LANG variable is set to en_US.UTF-8:

~ $ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
~ $ 

But when I use the LO options dialog to set the locale to something other than English, it persists, LANG and LC_ALL notwithstanding.

Apparently this is to be expected – user profiles take precendence over environment variables like LANG:

Turns out the syntax for launching LO with an arbitrary user profile on Debian 12 is

loffice -env:UserInstallation=file:///path/to/profile

Adapted from here:

https://wiki.documentfoundation.org/UserProfile#Quick_test_for_corrupted_profiles:_use_a_temporary,_new_user_profile

Naturally, because the LC_… variables expect an identifier of the form language_country.encoding (plus some limited variants) e.g. en_US.UTF-8 and not some arbitrary language string.

You should also know that if set then LC_ALL takes precedence over any other LC_… variable, of which for LibreOffice LC_CTYPE in turn takes precedence over the LANG variable for the locale setting (and LC_MESSAGES over LANG for the UI language).

Yes, but if you keep your LibreOffice locale on the Default - ... setting then it follows whatever is active in the order LC_ALL, LC_CTYPE, LANG when LibreOffice is started.

1 Like