From d5a11708207a1e34fe9fdaea204a59509b0954db Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 24 Oct 2019 10:30:16 +0100 Subject: [PATCH] doc: Clarify format of locale identifiers in extra-languages key Also update the tests to use the same format, and make sure to include coverage of all forms of locale (language-only, with locale, with codeset, and with modifier). Signed-off-by: Philip Withnall --- doc/flatpak-config.xml | 6 ++++-- tests/testlibrary.c | 25 ++++++++++++++----------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/doc/flatpak-config.xml b/doc/flatpak-config.xml index 131def69..83d57e50 100644 --- a/doc/flatpak-config.xml +++ b/doc/flatpak-config.xml @@ -70,8 +70,10 @@ This key is used when languages is not set, and it defines extra locale extensions on top of the system configured languages. The value is a - semicolon-separated list of two-letter language codes or locale identifiers - (eg. en;en_DK;az_Latn_AZ). + semicolon-separated list of locale identifiers + (language, optional locale, optional codeset, optional modifier) as documented by + setlocale3 + (for example, en;en_DK;zh_HK.big5hkscs;uz_UZ.utf8@cyrillic). diff --git a/tests/testlibrary.c b/tests/testlibrary.c index 052507f7..ee2529f0 100644 --- a/tests/testlibrary.c +++ b/tests/testlibrary.c @@ -291,27 +291,30 @@ test_languages_config (void) g_assert_cmpstr (value[0], ==, "en"); g_assert_null (value[1]); - res = flatpak_installation_set_config_sync (inst, "extra-languages", "pt_BR;az_Latn_AZ;es", NULL, &error); + res = flatpak_installation_set_config_sync (inst, "extra-languages", "pt_BR;uz_UZ.utf8@cyrillic;es;zh_HK.big5hkscs;uz_UZ@cyrillic", NULL, &error); g_assert_no_error (error); g_assert_true (res); value = flatpak_installation_get_default_languages (inst, &error); g_assert_no_error (error); - g_assert_cmpstr (value[0], ==, "az"); - g_assert_cmpstr (value[1], ==, "en"); - g_assert_cmpstr (value[2], ==, "es"); - g_assert_cmpstr (value[3], ==, "pt"); - g_assert_null (value[4]); + g_assert_cmpstr (value[0], ==, "en"); + g_assert_cmpstr (value[1], ==, "es"); + g_assert_cmpstr (value[2], ==, "pt"); + g_assert_cmpstr (value[3], ==, "uz"); + g_assert_cmpstr (value[4], ==, "zh"); + g_assert_null (value[5]); g_clear_pointer (&value, g_strfreev); value = flatpak_installation_get_default_locales (inst, &error); g_assert_no_error (error); - g_assert_cmpstr (value[0], ==, "az_Latn_AZ"); - g_assert_cmpstr (value[1], ==, "en"); - g_assert_cmpstr (value[2], ==, "es"); - g_assert_cmpstr (value[3], ==, "pt_BR"); - g_assert_null (value[4]); + g_assert_cmpstr (value[0], ==, "en"); + g_assert_cmpstr (value[1], ==, "es"); + g_assert_cmpstr (value[2], ==, "pt_BR"); + g_assert_cmpstr (value[3], ==, "uz_UZ.utf8@cyrillic"); + g_assert_cmpstr (value[4], ==, "uz_UZ@cyrillic"); + g_assert_cmpstr (value[5], ==, "zh_HK.big5hkscs"); + g_assert_null (value[6]); g_clear_pointer (&value, g_strfreev);