Skip to content
Snippets Groups Projects
Commit 77a7928b authored by Simon McVittie's avatar Simon McVittie
Browse files

locale: Check for the necessary files to generate more locales


pressure-vessel will use these when it generates any missing locales.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent e178b242
Branches
Tags
1 merge request!52locale: Check for the necessary files to generate more locales
Pipeline #1617 passed
......@@ -310,6 +310,12 @@ jsonify_locale_issues (JsonBuilder *builder,
if ((issues & SRT_LOCALE_ISSUES_EN_US_UTF8_MISSING) != 0)
json_builder_add_string_value (builder, "en-us-utf8-missing");
if ((issues & SRT_LOCALE_ISSUES_I18N_SUPPORTED_MISSING) != 0)
json_builder_add_string_value (builder, "i18n-supported-missing");
if ((issues & SRT_LOCALE_ISSUES_I18N_LOCALES_EN_US_MISSING) != 0)
json_builder_add_string_value (builder, "i18n-locales-en-us-missing");
}
static void
......
......@@ -252,6 +252,21 @@ keys:
: The `en_US.UTF-8` locale is not available. This may cause
problems in games and frameworks that assume it is always present.
**i18n-supported-missing**
: The **SUPPORTED** file listing supported locales was not found
in the expected location.
This indicates that either locale data is not installed, or this
operating system does not put it in the expected location.
The Steam Runtime might be unable to generate extra locales if needed.
**i18n-locales-en-us-missing**
: The **locales/en_US** file describing the USA English locale was
not found in the expected location. This indicates that either
locale data is not installed, or this operating system does not
put it in the expected location, or only a partial set of locale
source data is available. The Steam Runtime will be unable to
generate extra locales if needed.
**locales**
: An object describing locales. The keys are either **<default>** or
a locale name. The values are objects containing either details of
......
......@@ -8,6 +8,7 @@ Build-Depends:
gtk-doc-tools <!nodoc>,
libglib2.0-dev,
libjson-glib-dev (>= 1.0),
locales <!nocheck> | locales-all <!nocheck>,
meson,
pandoc,
zlib1g <!nocheck>,
......
......@@ -18,6 +18,7 @@ variables:
libjson-glib-dev
libx11-dev
libxcomposite-dev
locales
meson
pandoc
......
......@@ -28,6 +28,7 @@ endif
override_dh_auto_clean:
rm -fr builddir
rm -fr debian/locales
override_dh_auto_configure:
meson builddir \
......@@ -41,7 +42,12 @@ override_dh_auto_build:
ninja -C builddir
override_dh_auto_test:
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
mkdir debian/locales
localedef -f UTF-8 -i en_US --no-archive debian/locales/en_US.UTF-8
env LOCPATH=$(CURDIR)/debian/locales LC_ALL=en_US.UTF-8 \
meson test -C builddir --verbose
endif
override_dh_auto_install:
DESTDIR=$(CURDIR)/debian/tmp ninja -C builddir install
......
......@@ -84,6 +84,18 @@ GQuark srt_locale_error_quark (void);
* does not succeed, or succeeds but results in a non-UTF-8 locale.
* This locale is not generally guaranteed to exist on Linux systems,
* but some games and software packages assume that it does.
* @SRT_LOCALE_ISSUES_I18N_SUPPORTED_MISSING: The `SUPPORTED` file
* listing supported locales was not found in the expected location.
* This indicates that either locale data is not installed, or this
* operating system does not put it in the expected location.
* The Steam Runtime might be unable to generate extra locales if needed.
* @SRT_LOCALE_ISSUES_I18N_LOCALES_EN_US_MISSING: The `locales/en_US` file
* describing the USA English locale was not found in the expected
* location.
* This indicates that either locale data is not installed, or this
* operating system does not put it in the expected location, or only
* a partial set of locale source data is available.
* The Steam Runtime will be unable to generate extra locales if needed.
*
* A bitfield with flags representing potential problems with locales, or
* %SRT_LOCALE_ISSUES_NONE (which is numerically zero) if no problems
......@@ -99,6 +111,8 @@ typedef enum
SRT_LOCALE_ISSUES_DEFAULT_NOT_UTF8 = (1 << 2),
SRT_LOCALE_ISSUES_C_UTF8_MISSING = (1 << 3),
SRT_LOCALE_ISSUES_EN_US_UTF8_MISSING = (1 << 4),
SRT_LOCALE_ISSUES_I18N_SUPPORTED_MISSING = (1 << 5),
SRT_LOCALE_ISSUES_I18N_LOCALES_EN_US_MISSING = (1 << 6),
} SrtLocaleIssues;
const char *srt_locale_get_requested_name (SrtLocale *self);
......
......@@ -1307,6 +1307,20 @@ srt_system_info_get_locale_issues (SrtSystemInfo *self)
g_clear_object (&locale);
self->locales.have_issues = TRUE;
/* We currently only look for I18NDIR data in /usr/share/i18n (the
* glibc default path), so these checks only look there too.
*
* If we discover that some distros use a different default, then
* we should enhance this check to iterate through a search path.
*
* Please keep this in sync with pressure-vessel-locale-gen. */
if (!g_file_test ("/usr/share/i18n/SUPPORTED", G_FILE_TEST_IS_REGULAR))
self->locales.issues |= SRT_LOCALE_ISSUES_I18N_SUPPORTED_MISSING;
if (!g_file_test ("/usr/share/i18n/locales/en_US", G_FILE_TEST_IS_REGULAR))
self->locales.issues |= SRT_LOCALE_ISSUES_I18N_LOCALES_EN_US_MISSING;
}
return self->locales.issues;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment