哪些变量控制 Firefox 中的时间和日期格式以及这还会产生什么影响?

哪些变量控制 Firefox 中的时间和日期格式以及这还会产生什么影响?

我的主要问题是:

  1. 哪些(环境)变量控制 Firefox 中的时间和日期格式,以及这还会影响什么(UI、拼写检查)?

我尝试更改语言环境设置、软件包、Firefox 语言包和 Firefox 设置,但我无法找到一种组合来再次获得所需的结果:

  1. 如何在 en-US 中使用 Firefox(拼写检查,以及不太重要的 UI),但以 24 小时格式显示时间(并且日期显示为除 mm DD yy 之外的任何格式)?

在 Kubuntu 的某个旧版本中,我通过将语言环境的某些常规部分设置为 en-GB 来“解决”了我的问题,但这带来了不良的副作用,即 Pidgin 的拼写检查从 en-US 更改为 en-GB。这次我甚至无法重现该结果(尽管我已经做了笔记)。

我尝试了 StackExchange 和其他地方的许多建议,但都对我不起作用。幸运的是,我在绝望中想起,除了回答StackExchange 上的问题我也可以问题!


输出和状态:

我在 Kubuntu 18.04 上使用 Firefox 66.0.3(64 位)。

在 Firefox > 附加组件 > 语言中,我安装了 en-US 和 en-GB。

在 Firefox > 首选项 > 语言和外观 > 语言中:对于 UI 语言和网站显示语言,我尝试了 en-US 和 en-GB,没有任何变化。

在 Firefox 中,从 chrome://global/locale/intl.properties:

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# LOCALIZATION NOTE (intl.accept_languages):
# This is a comma-separated list of valid BCP 47 language tags.
#
# Begin with the language tag of your locale. Next, include language
# tags for other languages that you expect most users of your locale to be
# able to speak, so that their browsing experience degrades gracefully if
# content is not available in their primary language.
#
# It is recommended that you include "en-US, en" at the end of the list as a
# last resort. However, if you know that users of your locale would prefer a
# different variety of English, or if they are not likely to understand
# English at all, you may opt to include a different English language tag, or
# to exclude English altogether.
#
# For example, the Breton [br] locale might consider including French and
# British English in their list, since those languages are commonly spoken in
# the same area as Breton:
# intl.accept_languages=br, fr-FR, fr, en-GB, en
intl.accept_languages=en-US, en

# LOCALIZATION NOTE (font.language.group):
# This preference controls the initial setting of the language drop-down menu
# in the Content > Fonts & Colors > Advanced preference panel.
#
# Set it to the value of one of the menuitems in the "selectLangs" menulist in
# http://dxr.mozilla.org/mozilla-central/source/browser/components/preferences/fonts.xul
font.language.group=x-western

# LOCALIZATION NOTE (intl.charset.detector):
# This preference controls the initial setting for the character encoding
# detector. Valid values are ja_parallel_state_machine for Japanese, ruprob
# for Russian and ukprob for Ukrainian and the empty string to turn detection
# off. The value must be empty for locales other than Japanese, Russian and
# Ukrainian.
intl.charset.detector=

# LOCALIZATION NOTE (pluralRule): Pick the appropriate plural rule for your
# language. This will determine how many plural forms of a word you will need
# to provide and in what order.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
pluralRule=1

# LOCALIZATION NOTE (intl.menuitems.alwaysappendaccesskeys, intl.menuitems.insertseparatorbeforeaccesskeys):
# Valid values are: true, false, <empty string>
# Missing preference or empty value equals false.
intl.menuitems.alwaysappendaccesskeys=
intl.menuitems.insertseparatorbeforeaccesskeys=true

输出locale

LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=en_US.UTF-8
LC_TIME=en_GB.UTF-8
LC_COLLATE=C
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=et_EE.UTF-8
LC_NAME=et_EE.UTF-8
LC_ADDRESS=et_EE.UTF-8
LC_TELEPHONE=et_EE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=et_EE.UTF-8
LC_ALL=

输出printenv | grep LC_

LC_MEASUREMENT=de_DE.UTF-8
LC_PAPER=et_EE.UTF-8
LC_MONETARY=de_DE.UTF-8
LC_NAME=et_EE.UTF-8
LC_COLLATE=C
LC_ADDRESS=et_EE.UTF-8
LC_NUMERIC=en_US.UTF-8
LC_TELEPHONE=et_EE.UTF-8
LC_IDENTIFICATION=et_EE.UTF-8
LC_TIME=en_GB.UTF-8

输出localectl status

   System Locale: LANG=en_US.UTF-8
                  LC_NUMERIC=et_EE.UTF-8
                  LC_TIME=et_EE.UTF-8
                  LC_MONETARY=et_EE.UTF-8
                  LC_PAPER=et_EE.UTF-8
                  LC_NAME=et_EE.UTF-8
                  LC_ADDRESS=et_EE.UTF-8
                  LC_TELEPHONE=et_EE.UTF-8
                  LC_MEASUREMENT=et_EE.UTF-8
                  LC_IDENTIFICATION=et_EE.UTF-8
       VC Keymap: n/a
      X11 Layout: us
       X11 Model: pc105

输出locale -a

C
C.UTF-8
POSIX
en_AG
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IL
en_IL.utf8
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZM
en_ZM.utf8
en_ZW.utf8
et_EE.utf8

也许这也与以下情况有关:如果我从终端启动 Firefox,我会收到以下警告:

(firefox:15865): Gtk-WARNING **: 17:27:21.499: Locale not supported by C library.
        Using the fallback 'C' locale.

(/usr/lib/firefox/firefox:15933): Gtk-WARNING **: 17:27:21.873: Locale not supported by C library.
        Using the fallback 'C' locale.

(/usr/lib/firefox/firefox:15982): Gtk-WARNING **: 17:27:22.569: Locale not supported by C library.
        Using the fallback 'C' locale.

(/usr/lib/firefox/firefox:16024): Gtk-WARNING **: 17:27:24.441: Locale not supported by C library.
        Using the fallback 'C' locale.

(/usr/lib/firefox/firefox:16152): Gtk-WARNING **: 17:27:26.382: Locale not supported by C library.
        Using the fallback 'C' locale.

答案1

我使用的是德语语言环境de_DE.UTF-8,但它在输出中缺失locale -a(如问题中所见)。

解决方案(感谢@GunnarHjalmarsson)是使用以下命令生成该代码:

sudo locale-gen de_DE.UTF-8

相关内容