[shotwell/wip/l10n-718783: 4/5] Get rid of "extra" gettext domain



commit 09abf958f8f8d4e696f26ad3a6c9bada3f98d38e
Author: Charles Lindsay <chaz yorba org>
Date:   Tue Jan 14 17:33:43 2014 -0800

    Get rid of "extra" gettext domain

 .../TumblrPublishing.vala                          |   31 ++++----
 .../YandexPublishing.vala                          |    9 +--
 .../shotwell-publishing-extras.vala                |   83 --------------------
 3 files changed, 17 insertions(+), 106 deletions(-)
---
diff --git a/plugins/shotwell-publishing-extras/TumblrPublishing.vala 
b/plugins/shotwell-publishing-extras/TumblrPublishing.vala
index dbf5225..6bafb21 100644
--- a/plugins/shotwell-publishing-extras/TumblrPublishing.vala
+++ b/plugins/shotwell-publishing-extras/TumblrPublishing.vala
@@ -6,9 +6,6 @@
  */
 
 
-using Publishing.Extras;
-
-
 extern string hmac_sha1(string key, string message);
 public class TumblrService : Object, Spit.Pluggable, Spit.Publishing.Service {
    private const string ICON_FILENAME = "tumblr.png";
@@ -35,7 +32,7 @@ public class TumblrService : Object, Spit.Pluggable, Spit.Publishing.Service {
     
     public void get_info(ref Spit.PluggableInfo info) {
         info.authors = "Jeroen Arnoldus";
-        info.copyright = _t("Copyright 2012 BJA Electronics");
+        info.copyright = _("Copyright 2012 BJA Electronics");
         info.translators = Resources.TRANSLATORS;
         info.version = _VERSION;
         info.website_name = Resources.WEBSITE_NAME;
@@ -104,9 +101,9 @@ public class TumblrPublisher : Spit.Publishing.Publisher, GLib.Object {
     private SizeEntry[] create_sizes() {
         SizeEntry[] result = new SizeEntry[0];
 
-        result += new SizeEntry(_t("500 x 375 pixels"), 500);
-        result += new SizeEntry(_t("1024 x 768 pixels"), 1024);
-        result += new SizeEntry(_t("1280 x 853 pixels"), 1280);
+        result += new SizeEntry(_("500 x 375 pixels"), 500);
+        result += new SizeEntry(_("1024 x 768 pixels"), 1024);
+        result += new SizeEntry(_("1280 x 853 pixels"), 1280);
 //Larger images make no sense for Tumblr
 //        result += new SizeEntry(_("2048 x 1536 pixels"), 2048);
 //        result += new SizeEntry(_("4096 x 3072 pixels"), 4096);
@@ -310,7 +307,7 @@ public class TumblrPublisher : Spit.Publishing.Publisher, GLib.Object {
             
             if (split_pair.length != 2)
                 host.post_error(new Spit.Publishing.PublishingError.MALFORMED_RESPONSE(
-                    _t("'%s' isn't a valid response to an OAuth authentication request")));
+                    _("'%s' isn't a valid response to an OAuth authentication request")));
 
             if (split_pair[0] == "oauth_token")
                 oauth_token = split_pair[1];
@@ -320,7 +317,7 @@ public class TumblrPublisher : Spit.Publishing.Publisher, GLib.Object {
         
         if (oauth_token == null || oauth_token_secret == null)
             host.post_error(new Spit.Publishing.PublishingError.MALFORMED_RESPONSE(
-                _t("'%s' isn't a valid response to an OAuth authentication request")));
+                _("'%s' isn't a valid response to an OAuth authentication request")));
         
         session.set_access_phase_credentials(oauth_token, oauth_token_secret);
     }
@@ -558,7 +555,7 @@ public class TumblrPublisher : Spit.Publishing.Publisher, GLib.Object {
             return;
         
         if (was_started)
-            error(_t("TumblrPublisher: start( ): can't start; this publisher is not restartable."));
+            error(_("TumblrPublisher: start( ): can't start; this publisher is not restartable."));
         
         debug("TumblrPublisher: starting interaction.");
         
@@ -586,8 +583,8 @@ internal class AuthenticationPane : Spit.Publishing.DialogPane, Object {
         INTRO,
         FAILED_RETRY_USER
     }
-    private static string INTRO_MESSAGE = _t("Enter the username and password associated with your Tumblr 
account.");
-    private static string FAILED_RETRY_USER_MESSAGE = _t("Username and/or password invalid. Please try 
again");
+    private static string INTRO_MESSAGE = _("Enter the username and password associated with your Tumblr 
account.");
+    private static string FAILED_RETRY_USER_MESSAGE = _("Username and/or password invalid. Please try 
again");
 
     private Gtk.Box pane_widget = null;
     private Gtk.Builder builder;
@@ -616,7 +613,7 @@ internal class AuthenticationPane : Spit.Publishing.DialogPane, Object {
                     break;
 
                 case Mode.FAILED_RETRY_USER:
-                    message_label.set_markup("<b>%s</b>\n\n%s".printf(_t(
+                    message_label.set_markup("<b>%s</b>\n\n%s".printf(_(
                         "Invalid User Name or Password"), FAILED_RETRY_USER_MESSAGE));
                     break;
             }
@@ -636,7 +633,7 @@ internal class AuthenticationPane : Spit.Publishing.DialogPane, Object {
             align.reparent(pane_widget);
             publisher.get_host().set_dialog_default_widget(login_button);
         } catch (Error e) {
-            warning(_t("Could not load UI: %s"), e.message);
+            warning(_("Could not load UI: %s"), e.message);
         }
     }
     
@@ -739,7 +736,7 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object {
                        blog_label = (Gtk.Label) this.builder.get_object("blog_label");
 
 
-                       string upload_label_text = _t("You are logged into Tumblr as 
%s.\n\n").printf(this.username);
+                       string upload_label_text = _("You are logged into Tumblr as 
%s.\n\n").printf(this.username);
                        upload_info_label.set_label(upload_label_text);
 
                        populate_blog_combo();
@@ -757,7 +754,7 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object {
                        logout_button.clicked.connect(on_logout_clicked);
                        publish_button.clicked.connect(on_publish_clicked);
         } catch (Error e) {
-                       warning(_t("Could not load UI: %s"), e.message);
+                       warning(_("Could not load UI: %s"), e.message);
         }
     }
 
@@ -968,7 +965,7 @@ internal class UploadTransaction : Publishing.RESTSupport.UploadTransaction {
 
         } catch (FileError e) {
             throw new Spit.Publishing.PublishingError.LOCAL_FILE_ERROR(
-                _t("A temporary file needed for publishing is unavailable"));
+                _("A temporary file needed for publishing is unavailable"));
 
                }
 
diff --git a/plugins/shotwell-publishing-extras/YandexPublishing.vala 
b/plugins/shotwell-publishing-extras/YandexPublishing.vala
index f821c8d..36a3ede 100644
--- a/plugins/shotwell-publishing-extras/YandexPublishing.vala
+++ b/plugins/shotwell-publishing-extras/YandexPublishing.vala
@@ -4,8 +4,6 @@
  * See the COPYING file in this distribution.
  */
 
-using Publishing.Extras;
-
 public class YandexService : Object, Spit.Pluggable, Spit.Publishing.Service {
     public int get_pluggable_interface(int min_host_interface, int max_host_interface) {
         return Spit.negotiate_interfaces(min_host_interface, max_host_interface, 
Spit.Publishing.CURRENT_INTERFACE);
@@ -21,10 +19,10 @@ public class YandexService : Object, Spit.Pluggable, Spit.Publishing.Service {
     
     public void get_info(ref Spit.PluggableInfo info) {
         info.authors = "Evgeniy Polyakov <zbr ioremap net>";
-        info.copyright = _t("Copyright 2010+ Evgeniy Polyakov <zbr ioremap net>");
+        info.copyright = _("Copyright 2010+ Evgeniy Polyakov <zbr ioremap net>");
         info.translators = Resources.TRANSLATORS;
         info.version = _VERSION;
-        info.website_name = _t("Visit the Yandex.Fotki web site");
+        info.website_name = _("Visit the Yandex.Fotki web site");
         info.website_url = "http://fotki.yandex.ru/";;
         info.is_license_wordwrapped = false;
         info.license = Resources.LICENSE;
@@ -217,7 +215,6 @@ internal class PublishingOptionsPane: Spit.Publishing.DialogPane, GLib.Object {
         
         try {
             builder = new Gtk.Builder();
-            builder.set_translation_domain(DOMAIN_NAME);
             builder.add_from_file(ui_file.get_path());
             builder.connect_signals(null);
             Gtk.Alignment align = builder.get_object("alignment") as Gtk.Alignment;
@@ -632,7 +629,7 @@ public class YandexPublisher : Spit.Publishing.Publisher, GLib.Object {
     }
 
     private void show_welcome_page() {
-        host.install_welcome_pane(_t("You are not currently logged into Yandex.Fotki."),
+        host.install_welcome_pane(_("You are not currently logged into Yandex.Fotki."),
             start_web_auth);
     }
 
diff --git a/plugins/shotwell-publishing-extras/shotwell-publishing-extras.vala 
b/plugins/shotwell-publishing-extras/shotwell-publishing-extras.vala
index 0a216cc..8b60993 100644
--- a/plugins/shotwell-publishing-extras/shotwell-publishing-extras.vala
+++ b/plugins/shotwell-publishing-extras/shotwell-publishing-extras.vala
@@ -6,87 +6,6 @@
 
 extern const string _VERSION;
 
-namespace Publishing.Extras {
-
-internal const string DOMAIN_NAME = "shotwell-extras";
-internal const string[] LANGUAGE_SUPPORT_DIRECTORIES = {
-    "./locale-langpack",
-    "/usr/local/share/locale-langpack",
-    "/usr/share/locale-langpack",
-    "/usr/local/share/locale",
-    "/usr/local/share/locale-langpack"
-};
-
-internal bool is_domain_configured = false;
-
-public void configure_translation_domain() {
-    if (is_domain_configured)
-        return;
-
-    string target = DOMAIN_NAME + ".mo";
-
-    // support installation of the shotwell-extras translations separately from the shotwell core
-    // translations; look for shotwell-extras translations in all 5 common locations.
-    string? lang_support_dir = null;
-    foreach (string dirpath in LANGUAGE_SUPPORT_DIRECTORIES) {
-        File base_dirfile = File.new_for_path(dirpath);
-        if (!base_dirfile.query_exists(null))
-            continue;
-
-        FileType base_filetype =
-            base_dirfile.query_file_type(FileQueryInfoFlags.NONE, null);
-        if (base_filetype != FileType.DIRECTORY)
-            continue;
-        
-        try {
-            FileEnumerator lang_enumerator =
-                base_dirfile.enumerate_children("standard::name,standard::type",
-                FileQueryInfoFlags.NONE, null);
-            FileInfo info = null;
-            while ((info = lang_enumerator.next_file(null)) != null) {
-                if (info.get_file_type() == FileType.DIRECTORY) {
-                    File message_domain_file = base_dirfile.get_child(info.get_name()).get_child(
-                        "LC_MESSAGES").get_child(target);
-
-                    if (message_domain_file.query_exists(null)) {
-                        lang_support_dir = base_dirfile.get_path();
-                        break;
-                    }
-                }
-            }
-        } catch (Error e) {
-            critical("can't get location of translation file for extra plugins: " + e.message);
-        }
-        
-        if (lang_support_dir != null)
-            break;
-     }
-
-    if (lang_support_dir != null) {
-        string? bound = Intl.bindtextdomain(DOMAIN_NAME, lang_support_dir);
-        
-        if (bound != null)
-            debug("bound shotwell-extras language support directory '%s'.\n", lang_support_dir);
-    }
-
-    is_domain_configured = true;
-}
-
-public unowned string? _t(string msgid) {
-    if (!is_domain_configured)
-        configure_translation_domain();
-
-    return dgettext(DOMAIN_NAME, msgid);
-}
-
-public unowned string? _tn(string msgid, string msgid_plural, ulong n) {
-    if (!is_domain_configured)
-        configure_translation_domain();
-    
-    return dngettext(DOMAIN_NAME, msgid, msgid_plural, n);
-}
-}
-
 private class ShotwellPublishingExtraServices : Object, Spit.Module {
     private Spit.Pluggable[] pluggables = new Spit.Pluggable[0];
 
@@ -117,8 +36,6 @@ public Spit.Module? spit_entry_point(Spit.EntryPointParams *params) {
     params->module_spit_interface = Spit.negotiate_interfaces(params->host_min_spit_interface,
         params->host_max_spit_interface, Spit.CURRENT_INTERFACE);
     
-    Publishing.Extras.configure_translation_domain();
-    
     return (params->module_spit_interface != Spit.UNSUPPORTED_INTERFACE)
         ? new ShotwellPublishingExtraServices(params->module_file) : null;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]