From d2eec63cfb19050b5870dcf9c0c60d366f27ad26 Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Fri, 27 Mar 2020 17:42:00 +1100 Subject: [PATCH] Util.International: Rename package to I18n to make fn calls less verbose --- po/POTFILES.in | 2 +- src/client/application/application-client.vala | 2 +- src/client/application/application-configuration.vala | 4 ++-- src/client/composer/composer-widget.vala | 3 +-- src/client/composer/spell-check-popover.vala | 6 +++--- src/client/meson.build | 2 +- .../util/{util-international.vala => util-i18n.vala} | 11 ++++++++--- 7 files changed, 17 insertions(+), 13 deletions(-) rename src/client/util/{util-international.vala => util-i18n.vala} (97%) diff --git a/po/POTFILES.in b/po/POTFILES.in index 0e6ed8cb..0f08b32a 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -128,7 +128,7 @@ src/client/util/util-email.vala src/client/util/util-files.vala src/client/util/util-gio.vala src/client/util/util-gtk.vala -src/client/util/util-international.vala +src/client/util/util-i18n.vala src/client/util/util-js.vala src/client/util/util-migrate.vala src/client/web-process/web-process-extension.vala diff --git a/src/client/application/application-client.vala b/src/client/application/application-client.vala index 0d86302e..8df04a06 100644 --- a/src/client/application/application-client.vala +++ b/src/client/application/application-client.vala @@ -384,7 +384,7 @@ public class Application.Client : Gtk.Application { public override void startup() { Environment.set_application_name(NAME); - Util.International.init(GETTEXT_PACKAGE, this.binary); + Util.I18n.init(GETTEXT_PACKAGE, this.binary); Util.Date.init(); Configuration.init(this.is_installed, GSETTINGS_DIR); diff --git a/src/client/application/application-configuration.vala b/src/client/application/application-configuration.vala index 170c98ee..b089306f 100644 --- a/src/client/application/application-configuration.vala +++ b/src/client/application/application-configuration.vala @@ -234,7 +234,7 @@ public class Application.Configuration : Geary.BaseObject { ).get_maybe(); string[] langs = (value != null) ? value.get_strv() - : Util.International.get_user_preferred_languages(); + : Util.I18n.get_user_preferred_languages(); return langs; } @@ -245,7 +245,7 @@ public class Application.Configuration : Geary.BaseObject { * client. By default, the set will contain languages based on * environment variables. * - * @see Util.International.get_user_preferred_languages + * @see Util.I18n.get_user_preferred_languages */ public void set_spell_check_languages(string[] value) { this.settings.set_value( diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala index f59638d1..cacb810b 100644 --- a/src/client/composer/composer-widget.vala +++ b/src/client/composer/composer-widget.vala @@ -2596,8 +2596,7 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface { // ) and // we don't support spell checker language priority, use // the first matching most preferred language, if any. - foreach (string pref in - Util.International.get_user_preferred_languages()) { + foreach (string pref in Util.I18n.get_user_preferred_languages()) { if (pref in langs) { lang = Gspell.Language.lookup(pref); if (lang != null) { diff --git a/src/client/composer/spell-check-popover.vala b/src/client/composer/spell-check-popover.vala index e4b0f445..d7f2bdf2 100644 --- a/src/client/composer/spell-check-popover.vala +++ b/src/client/composer/spell-check-popover.vala @@ -63,8 +63,8 @@ public class SpellCheckPopover { box.margin = 6; box.margin_start = 12; - lang_name = Util.International.language_name_from_locale(lang_code); - country_name = Util.International.country_name_from_locale(lang_code); + lang_name = Util.I18n.language_name_from_locale(lang_code); + country_name = Util.I18n.country_name_from_locale(lang_code); string label_text = lang_name; Gtk.Label label = new Gtk.Label(label_text); @@ -216,7 +216,7 @@ public class SpellCheckPopover { private void setup_popover() { // We populate the popover with the list of languages that the user wants to see - string[] languages = Util.International.get_available_dictionaries(); + string[] languages = Util.I18n.get_available_dictionaries(); string[] enabled_langs = this.config.get_spell_check_languages(); string[] visible_langs = this.config.get_spell_check_visible_languages(); diff --git a/src/client/meson.build b/src/client/meson.build index cd94a337..794ed3a8 100644 --- a/src/client/meson.build +++ b/src/client/meson.build @@ -137,7 +137,7 @@ geary_client_vala_sources = files( 'util/util-files.vala', 'util/util-gio.vala', 'util/util-gtk.vala', - 'util/util-international.vala', + 'util/util-i18n.vala', 'util/util-js.vala', 'util/util-migrate.vala', ) diff --git a/src/client/util/util-international.vala b/src/client/util/util-i18n.vala similarity index 97% rename from src/client/util/util-international.vala rename to src/client/util/util-i18n.vala index eb640e12..b6dc731f 100644 --- a/src/client/util/util-international.vala +++ b/src/client/util/util-i18n.vala @@ -1,14 +1,19 @@ -/* Copyright 2016 Software Freedom Conservancy Inc. +/* + * Copyright © 2016 Software Freedom Conservancy Inc. + * Copyright © 2020 Michael Gratton * * This software is licensed under the GNU Lesser General Public License - * (version 2.1 or later). See the COPYING file in this distribution. + * (version 2.1 or later). See the COPYING file in this distribution. */ extern const string _LANGUAGE_SUPPORT_DIRECTORY; extern const string _ISO_CODE_639_XML; extern const string _ISO_CODE_3166_XML; -namespace Util.International { +/** + * Internationalisation support functions. + */ +namespace Util.I18n { private GLib.HashTable language_names = null; private GLib.HashTable country_names = null;