[evolution-data-server] I#236 - Uses LC_ADDRESS unconditionally in libphonenumber code
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] I#236 - Uses LC_ADDRESS unconditionally in libphonenumber code
- Date: Mon, 20 Jul 2020 09:10:48 +0000 (UTC)
commit 9b16e0c600cf838029710c8b8324c5f9f7d5f98f
Author: Milan Crha <mcrha redhat com>
Date: Mon Jul 20 11:09:10 2020 +0200
I#236 - Uses LC_ADDRESS unconditionally in libphonenumber code
Closes https://gitlab.gnome.org/GNOME/evolution-data-server/-/issues/236
.../libebook-contacts/e-phone-number-private.cpp | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/addressbook/libebook-contacts/e-phone-number-private.cpp
b/src/addressbook/libebook-contacts/e-phone-number-private.cpp
index 4c5aebbc6..ec2fe164f 100644
--- a/src/addressbook/libebook-contacts/e-phone-number-private.cpp
+++ b/src/addressbook/libebook-contacts/e-phone-number-private.cpp
@@ -118,8 +118,23 @@ _e_phone_number_cxx_make_region_code (const gchar *region_code)
/* Extract two-letter country code from current locale id if needed.
* From outside this is a C library, so we better consult the
* C infrastructure instead of std::locale, which might divert. */
- if (region_code == NULL || region_code[0] == '\0')
- return _e_phone_number_cxx_region_code_from_locale (setlocale (LC_ADDRESS, NULL));
+ if (region_code == NULL || region_code[0] == '\0') {
+ const gchar *lcl = NULL;
+
+#if defined (LC_TELEPHONE)
+ lcl = setlocale (LC_TELEPHONE, NULL);
+#endif
+
+#if defined (LC_ADDRESS)
+ if (!lcl || !*lcl || (lcl[0] == 'C' && (!lcl[1] || lcl[1] == '.')))
+ lcl = setlocale (LC_ADDRESS, NULL);
+#endif
+
+ if (!lcl || !*lcl || (lcl[0] == 'C' && (!lcl[1] || lcl[1] == '.')))
+ lcl = setlocale (LC_MESSAGES, NULL);
+
+ return _e_phone_number_cxx_region_code_from_locale (lcl);
+ }
return region_code;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]