Util.International: Rename package to I18n to make fn calls less verbose

This commit is contained in:
Michael Gratton 2020-03-27 17:42:00 +11:00 committed by Michael James Gratton
parent 7ab01e6cbd
commit d2eec63cfb
7 changed files with 17 additions and 13 deletions

View file

@ -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

View file

@ -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);

View file

@ -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(

View file

@ -2596,8 +2596,7 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface {
// <https://gitlab.gnome.org/GNOME/gspell/issues/5>) 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) {

View file

@ -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();

View file

@ -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',
)

View file

@ -1,14 +1,19 @@
/* Copyright 2016 Software Freedom Conservancy Inc.
/*
* Copyright © 2016 Software Freedom Conservancy Inc.
* Copyright © 2020 Michael Gratton <mike@vee.net>
*
* 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<string, string> language_names = null;
private GLib.HashTable<string, string> country_names = null;