user-record: Add languages field

This field is like preferredLanguage, but takes a priority list of
languages instead. If an app isn't translated into a user's primary
language, it can fall back to one of the other languages in the list
thus making the app more accessible to the user.

For instance: in my experience, many Ukrainians are fluent in Russian,
often significantly better than English (especially if they are of a
generation that grew up during the USSR). Such a person might set this
new variable to ["uk_UA.UTF-8", "ru_UA.UTF-8"] so that software that
lacks Ukrainian translations will first try Russian translations before
defaulting to English.

Fixes #31290
This commit is contained in:
Adrian Vovk
2024-02-13 17:39:14 -05:00
parent fa485e8fc5
commit 49e55abb7f
8 changed files with 199 additions and 39 deletions
+16 -5
View File
@@ -310,11 +310,22 @@ string. The string should be a `tzdata` compatible location string, for
example: `Europe/Berlin`.
`preferredLanguage` → A string indicating the preferred language/locale for the
user. When logging in
user. It is combined with the `additionalLanguages` field to initialize the `$LANG`
and `$LANGUAGE` environment variables on login; see below for more details. This string
should be in a format compatible with the `$LANG` environment variable, for example:
`de_DE.UTF-8`.
`additionalLanguages` → An array of strings indicating the preferred languages/locales
that should be used in the event that translations for the `preferredLanguage` are
missing, listed in order of descending priority. This allows multi-lingual users to
specify all the languages that they know, so software lacking translations in the user's
primary language can try another language that the user knows rather than falling back to
the default English. All entries in this field must be valid locale names, compatible with
the `$LANG` variable, for example: `de_DE.UTF-8`. When logging in
[`pam_systemd`](https://www.freedesktop.org/software/systemd/man/pam_systemd.html)
will automatically initialize the `$LANG` environment variable from this
string. The string hence should be in a format compatible with this environment
variable, for example: `de_DE.UTF8`.
will prepend `preferredLanguage` (if set) to this list (if set), remove duplicates,
and then automatically initialize the `$LANGUAGE` variable with the resulting list.
It will also initialize `$LANG` variable with the first entry in the resulting list.
`niceLevel` → An integer value in the range -20…19. When logging in
[`pam_systemd`](https://www.freedesktop.org/software/systemd/man/pam_systemd.html)
@@ -744,7 +755,7 @@ that may be used in this section are identical to the equally named ones in the
`regular` section (i.e. at the top-level object). Specifically, these are:
`iconName`, `location`, `shell`, `umask`, `environment`, `timeZone`,
`preferredLanguage`, `niceLevel`, `resourceLimits`, `locked`, `notBeforeUSec`,
`preferredLanguage`, `additionalLanguages`, `niceLevel`, `resourceLimits`, `locked`, `notBeforeUSec`,
`notAfterUSec`, `storage`, `diskSize`, `diskSizeRelative`, `skeletonDirectory`,
`accessMode`, `tasksMax`, `memoryHigh`, `memoryMax`, `cpuWeight`, `ioWeight`,
`mountNoDevices`, `mountNoSuid`, `mountNoExecute`, `cifsDomain`,