diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2010-09-06 15:43:42 +0100 |
---|---|---|
committer | Travis Reitter <travis.reitter@collabora.co.uk> | 2010-11-04 09:30:08 -0700 |
commit | cf42813c1d2cbd4d69050dda02981475d364bad6 (patch) | |
tree | db52c48108a28125593bdbd56e280aae5d40c8ae | |
parent | affa69029fe409b60de0fdf1bef7429c51c2907b (diff) |
Mark strings for translation and improve string formatting a little
This marks every potentially-user-visible string in libfolks for translation.
These include error messages, warnings and criticals. This also improves the
formatting and wording of some of the messages, and changes others to make
them more easily translatable. Closes: bgo#628883
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | backends/key-file/kf-persona-store.vala | 30 | ||||
-rw-r--r-- | backends/key-file/kf-persona.vala | 5 | ||||
-rw-r--r-- | backends/telepathy/lib/tp-lowlevel.c | 28 | ||||
-rw-r--r-- | backends/telepathy/lib/tpf-persona-store.vala | 190 | ||||
-rw-r--r-- | backends/telepathy/lib/tpf-persona.vala | 6 | ||||
-rw-r--r-- | folks/backend-store.vala | 47 | ||||
-rw-r--r-- | folks/individual-aggregator.vala | 34 | ||||
-rw-r--r-- | po/POTFILES.in | 11 | ||||
-rw-r--r-- | po/POTFILES.skip | 9 | ||||
-rw-r--r-- | tools/import-pidgin.vala | 57 | ||||
-rw-r--r-- | tools/import.vala | 36 |
12 files changed, 324 insertions, 130 deletions
@@ -14,6 +14,7 @@ API changes: Bugs fixed: * Bug 629081 — Add API to allow specific backends to be disabled * Bug 629862 — Add tests for the key-file backend +* Bug 628883 — Add localisation support Overview of changes from libfolks 0.3.0 to libfolks 0.3.1 ========================================================== diff --git a/backends/key-file/kf-persona-store.vala b/backends/key-file/kf-persona-store.vala index a626165..97c0610 100644 --- a/backends/key-file/kf-persona-store.vala +++ b/backends/key-file/kf-persona-store.vala @@ -173,8 +173,11 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore { if (!(e1 is IOError.NOT_FOUND)) { - warning ("The relationship key file '%s' could " + - "not be loaded: %s", filename, e1.message); + warning ( + /* Translators: the first parameter is a filename, + * and the second is an error message. */ + _("The relationship key file '%s' could not be loaded: %s"), + filename, e1.message); this.removed (); return; } @@ -192,8 +195,10 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore { if (!(e3 is IOError.EXISTS)) { - warning ("The relationship key file directory " + - "'%s' could not be created: %s", + warning ( + /* Translators: the first parameter is a path, and + * the second is an error message. */ + _("The relationship key file directory '%s' could not be created: %s"), parent_dir.get_path (), e3.message); this.removed (); return; @@ -214,8 +219,11 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore { if (!(e2 is IOError.EXISTS)) { - warning ("The relationship key file '%s' could " + - "not be created: %s", filename, e2.message); + warning ( + /* Translators: the first parameter is a filename, + * and the second is an error message. */ + _("The relationship key file '%s' could not be created: %s"), + filename, e2.message); this.removed (); return; } @@ -302,8 +310,10 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore if (im_addresses == null || im_addresses.size () == 0) { throw new PersonaStoreError.INVALID_ARGUMENT ( - "persona store (%s, %s) requires the following details:\n" + - " im-addresses (provided: '%p')\n", + /* Translators: the first two parameters are identifiers for the + * persona store. The third is a pointer address. Do not translate + * "im-addresses", as it's an object property name. */ + _("Persona store (%s, %s) requires the following details:\n im-addresses (provided: '%p')"), this.type_id, this.id, im_addresses); } @@ -363,7 +373,9 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore { if (!(e is IOError.CANCELLED)) { - warning ("Could not write updated key file '%s': %s", + /* Translators: the first parameter is a filename, the second is + * an error message. */ + warning (_("Could not write updated key file '%s': %s"), this.file.get_path (), e.message); } } diff --git a/backends/key-file/kf-persona.vala b/backends/key-file/kf-persona.vala index 97f28e7..51a8883 100644 --- a/backends/key-file/kf-persona.vala +++ b/backends/key-file/kf-persona.vala @@ -194,7 +194,10 @@ public class Folks.Backends.Kf.Persona : Folks.Persona, * get any other exceptions, since we're iterating through a list of * keys we've just retrieved. */ if (!(e is KeyFileError.GROUP_NOT_FOUND)) - warning ("Couldn't load data from key file: %s", e.message); + { + /* Translators: the parameter is an error message. */ + warning (_("Couldn't load data from key file: %s"), e.message); + } } } diff --git a/backends/telepathy/lib/tp-lowlevel.c b/backends/telepathy/lib/tp-lowlevel.c index 51f99d9..f64fcc4 100644 --- a/backends/telepathy/lib/tp-lowlevel.c +++ b/backends/telepathy/lib/tp-lowlevel.c @@ -20,6 +20,7 @@ */ #include <glib.h> +#include <glib/gi18n.h> #include <gio/gio.h> #include <telepathy-glib/channel.h> #include <telepathy-glib/connection.h> @@ -512,7 +513,8 @@ group_request_channel_cb ( * handle the error if RequestChannel failed */ if (error) { - g_message ("Error: %s", error->message); + /* Translators: the parameter is an error message. */ + g_message (_("Error requesting a group channel: %s"), error->message); return; } } @@ -529,7 +531,8 @@ group_request_handles_cb ( if (error) { - g_message ("Error: %s", error->message); + /* Translators: the parameter is an error message. */ + g_message (_("Error requesting group handles: %s"), error->message); return; } @@ -567,7 +570,8 @@ set_contact_alias_cb (TpConnection *conn, { if (error != NULL) { - g_message ("Failed to change contact's alias: %s", error->message); + /* Translators: the parameter is an error message. */ + g_message (_("Failed to change contact's alias: %s"), error->message); return; } } @@ -626,7 +630,8 @@ iterate_on_channels (TpConnection *conn, channel = tp_channel_new_from_properties (conn, path, properties, &error); if (channel == NULL) { - g_message ("Failed to create group channel: %s", error->message); + /* Translators: the parameter is an error message. */ + g_message (_("Failed to create group channel: %s"), error->message); g_error_free (error); return; } @@ -655,7 +660,8 @@ got_channels_cb (TpProxy *conn, const GPtrArray *channels; if (error != NULL) { - g_message ("Get Channels property failed: %s", error->message); + /* Translators: the parameter is an error message. */ + g_message (_("Get Channels property failed: %s"), error->message); return; } @@ -697,7 +703,9 @@ group_add_members_cb (TpChannel *proxy, { if (error != NULL) { - g_message ("Failed to add contact to group %s: %s", + /* Translators: the first parameter is a group channel identifier and the + * second is an error message. */ + g_message (_("Failed to add contact to group '%s': %s"), tp_channel_get_identifier (TP_CHANNEL (proxy)), error->message); return; } @@ -711,7 +719,9 @@ group_remove_members_cb (TpChannel *proxy, { if (error != NULL) { - g_message ("Failed to remove contact from group %s: %s", + /* Translators: the first parameter is a group channel identifier and the + * second is an error message. */ + g_message (_("Failed to remove contact from group '%s': %s"), tp_channel_get_identifier (TP_CHANNEL (proxy)), error->message); return; } @@ -731,7 +741,9 @@ folks_tp_lowlevel_channel_group_change_membership (TpChannel *channel, { g_set_error (error, FOLKS_TP_LOWLEVEL_ERROR, FOLKS_TP_LOWLEVEL_ERROR_INVALID_ARGUMENT, - "invalid group channel %p to add handle %d to", channel, handle); + /* Translators: the first parameter is a pointer address and the + * second is a contact handle (numeric identifier). */ + _("Invalid group channel %p to add handle %d to."), channel, handle); } handles = g_array_new (FALSE, TRUE, sizeof (guint)); diff --git a/backends/telepathy/lib/tpf-persona-store.vala b/backends/telepathy/lib/tpf-persona-store.vala index fcdeaa2..e6111b7 100644 --- a/backends/telepathy/lib/tpf-persona-store.vala +++ b/backends/telepathy/lib/tpf-persona-store.vala @@ -292,8 +292,8 @@ public class Tpf.PersonaStore : Folks.PersonaStore this.logger = new Logger (this.id); this.logger.invalidated.connect (() => { - warning ("lost connection to the telepathy-logger " + - "service"); + warning ( + _("Lost connection to the telepathy-logger service.")); this.logger = null; }); this.logger.favourite_contacts_changed.connect ( @@ -301,7 +301,8 @@ public class Tpf.PersonaStore : Folks.PersonaStore } catch (DBus.Error e) { - warning ("couldn't connect to the telepathy-logger service"); + warning ( + _("Couldn't connect to the telepathy-logger service.")); this.logger = null; } @@ -338,7 +339,8 @@ public class Tpf.PersonaStore : Folks.PersonaStore } catch (GLib.Error e) { - warning ("couldn't get list of favourite contacts: %s", + /* Translators: the parameter is an error message. */ + warning (_("Couldn't get list of favorite contacts: %s"), e.message); } }, @@ -349,7 +351,8 @@ public class Tpf.PersonaStore : Folks.PersonaStore } catch (DBus.Error e) { - warning ("couldn't get list of favourite contacts: %s", e.message); + /* Translators: the parameter is an error message. */ + warning (_("Couldn't get list of favorite contacts: %s"), e.message); } } @@ -384,7 +387,8 @@ public class Tpf.PersonaStore : Folks.PersonaStore this.handle_persona_map.size > 0) || (this.self_contact != null && this.handle_persona_map.size > 1))) { - warning ("unknown persona '%s' in favourites list", ids[i]); + /* Translators: the parameter is an identifier. */ + warning (_("Unknown persona '%s' in favorites list."), ids[i]); continue; } @@ -413,7 +417,8 @@ public class Tpf.PersonaStore : Folks.PersonaStore } catch (GLib.Error e) { - warning ("couldn't add favourite contacts: %s", + /* Translators: the parameter is an error message. */ + warning (_("Couldn't add favorite contacts: %s"), e.message); } }, @@ -433,7 +438,8 @@ public class Tpf.PersonaStore : Folks.PersonaStore } catch (GLib.Error e) { - warning ("couldn't remove favourite contacts: %s", + /* Translators: the parameter is an error message. */ + warning (_("Couldn't remove favorite contacts: %s"), e.message); } }, @@ -498,9 +504,12 @@ public class Tpf.PersonaStore : Folks.PersonaStore } catch (GLib.Error e) { - GLib.warning ("failed to determine whether we can set " + - "aliases on Telepathy account %s: %s", - this.display_name, e.message); + GLib.warning ( + /* Translators: the first parameter is the display name for + * the Telepathy account, and the second is an error + * message. */ + _("Failed to determine whether we can set aliases on Telepathy account '%s': %s"), + this.display_name, e.message); } this._can_alias_personas = new_can_alias; @@ -547,9 +556,12 @@ public class Tpf.PersonaStore : Folks.PersonaStore } catch (GLib.Error e3) { - GLib.warning ("failed to determine whether we can set " + - "groups on Telepathy account %s: %s", - this.display_name, e3.message); + GLib.warning ( + /* Translators: the first parameter is the display name for + * the Telepathy account, and the second is an error + * message. */ + _("Failed to determine whether we can set groups on Telepathy account '%s': %s"), + this.display_name, e3.message); } this._can_group_personas = new_can_group; @@ -591,7 +603,10 @@ public class Tpf.PersonaStore : Folks.PersonaStore { if (error != null) { - warning ("Failed to create contact for self handle '%u': %s", + warning ( + /* Translators: the first parameter is a Telepathy handle, + * and the second is an error message. */ + _("Failed to create contact for self handle '%u': %s"), conn.self_handle, error.message); return; } @@ -610,8 +625,12 @@ public class Tpf.PersonaStore : Folks.PersonaStore } catch (Tpf.PersonaError e) { - warning ("Failed to create self persona from contact '%s' " + - "(%p)", contact.alias, contact); + warning ( + /* Translators: the first parameter is the contact's + * alias, and the second is the location of the contact's + * data in memory (for debugging). */ + _("Failed to create self persona from contact '%s' (%p)"), + contact.alias, contact); } }, this); @@ -622,7 +641,9 @@ public class Tpf.PersonaStore : Folks.PersonaStore { if (channel == null) { - warning ("error creating channel for NewChannels signal"); + /* Translators: do not translate "NewChannels", as it's a D-Bus + * signal name. */ + warning (_("Error creating channel for NewChannels signal.")); return; } @@ -657,9 +678,21 @@ public class Tpf.PersonaStore : Folks.PersonaStore } catch (GLib.Error e) { - warning ("failed to change persona %s group %s membership to " - + "%s", - persona.uid, group, entry.value ? "true" : "false"); + if (entry.value == true) + { + /* Translators: the parameter is a persona identifier and + * the second parameter is a group name. */ + warning (_("Failed to add persona '%s' to group '%s'."), + persona.uid, group); + } + else + { + warning ( + /* Translators: the parameter is a persona identifier + * and the second parameter is a group name. */ + _("Failed to remove persona '%s' from group '%s'."), + persona.uid, group); + } } } @@ -958,7 +991,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore if (tp_persona.contact == this.self_contact) { throw new PersonaStoreError.UNSUPPORTED_ON_USER ( - "Personas representing the local user may not be removed."); + _("Personas representing the local user may not be removed.")); } try @@ -968,7 +1001,12 @@ public class Tpf.PersonaStore : Folks.PersonaStore } catch (GLib.Error e1) { - warning ("failed to remove persona '%s' (%s) from stored list: %s", + warning ( + /* Translators: The first parameter is an identifier, the second + * is the persona's alias and the third is an error message. + * "stored" is the name of a program object, and shouldn't be + * translated. */ + _("Failed to remove persona '%s' (%s) from 'stored' list: %s"), tp_persona.uid, tp_persona.alias, e1.message); } @@ -979,7 +1017,12 @@ public class Tpf.PersonaStore : Folks.PersonaStore } catch (GLib.Error e2) { - warning ("failed to remove persona '%s' (%s) from subscribe list: %s", + warning ( + /* Translators: The first parameter is an identifier, the second + * is the persona's alias and the third is an error message. + * "subscribe" is the name of a program object, and shouldn't be + * translated. */ + _("Failed to remove persona '%s' (%s) from 'subscribe' list: %s"), tp_persona.uid, tp_persona.alias, e2.message); } @@ -990,7 +1033,12 @@ public class Tpf.PersonaStore : Folks.PersonaStore } catch (GLib.Error e3) { - warning ("failed to remove persona '%s' (%s) from publish list: %s", + warning ( + /* Translators: The first parameter is an identifier, the second + * is the persona's alias and the third is an error message. + * "publish" is the name of a program object, and shouldn't be + * translated. */ + _("Failed to remove persona '%s' (%s) from 'publish' list: %s"), tp_persona.uid, tp_persona.alias, e3.message); } @@ -1120,10 +1168,24 @@ public class Tpf.PersonaStore : Folks.PersonaStore } catch (GLib.Error e) { - warning ("failed to change persona %s contact list %s " + - "membership to %s", - persona.uid, channel.get_identifier (), - is_member ? "true" : "false"); + if (is_member == true) + { + warning ( + /* Translators: the first parameter is a persona identifier, + * the second is a contact list identifier and the third is + * an error message. */ + _("Failed to add persona '%s' to contact list '%s': %s"), + persona.uid, channel.get_identifier (), e.message); + } + else + { + warning ( + /* Translators: the first parameter is a persona identifier, + * the second is a contact list identifier and the third is + * an error message. */ + _("Failed to remove persona '%s' from contact list '%s': %s"), + persona.uid, channel.get_identifier (), e.message); + } } } @@ -1193,8 +1255,10 @@ public class Tpf.PersonaStore : Folks.PersonaStore } catch (GLib.Error e) { - warning ("failed to create personas from incoming contacts in " + - "channel '%s': %s", + warning ( + /* Translators: the first parameter is a channel identifier and + * the second is an error message.. */ + _("Failed to create personas from incoming contacts in channel '%s': %s"), channel.get_identifier (), e.message); } } @@ -1210,7 +1274,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore GLib.List<Persona> personas = new GLib.List<Persona> (); uint err_count = 0; - string err_format = ""; + string err_string = ""; unowned GLib.List<TelepathyGLib.Contact> l; for (l = contacts; l != null; l = l.next) { @@ -1226,19 +1290,27 @@ public class Tpf.PersonaStore : Folks.PersonaStore } catch (Tpf.PersonaError e) { - if (err_count == 0) - err_format = "failed to create %u personas:\n"; - - err_format = "%s '%s' (%p): %s\n".printf ( - err_format, contact.alias, contact, e.message); + err_string = "%s\n%s".printf (err_string, + /* Translators: format for lines in the error string below + * "Failed to create %u personas:". The first parameter is + * a contact alias, the second is a pointer address and + * the third is an error message. */ + _("'%s' (%p): %s").printf (contact.alias, contact, + e.message)); err_count++; } } if (err_count > 0) { - throw new Folks.PersonaStoreError.CREATE_FAILED (err_format, - err_count); + throw new Folks.PersonaStoreError.CREATE_FAILED ( + /* Translators: the first parameter is the number of personas + * which couldn't be created, and the second is a set of error + * message lines, built using the "'%s' (%p): %s" string + * above. */ + ngettext ("Failed to create %u persona:\n%s", + "Failed to create %u personas:\n%s", err_count), + err_count, err_string); } if (personas != null) @@ -1289,7 +1361,9 @@ public class Tpf.PersonaStore : Folks.PersonaStore } catch (Tpf.PersonaError e) { - warning ("failed to create persona from contact '%s' (%p)", + /* Translators: the first parameter is a contact alias and the + * second is a pointer address. */ + warning (_("Failed to create persona from contact '%s' (%p)."), contact.alias, contact); } } @@ -1369,8 +1443,9 @@ public class Tpf.PersonaStore : Folks.PersonaStore if (contact_id == null) { throw new PersonaStoreError.INVALID_ARGUMENT ( - "persona store (%s, %s) requires the following details:\n" + - " contact (provided: '%s')\n", + /* Translators: the first two parameters are store identifiers and + * the third is a contact identifier. */ + _("Persona store (%s, %s) requires the following details:\n contact (provided: '%s')\n"), this.type_id, this.id, contact_id); } @@ -1379,8 +1454,8 @@ public class Tpf.PersonaStore : Folks.PersonaStore (status == TelepathyGLib.ConnectionStatus.CONNECTING) || this.conn == null) { - throw new PersonaStoreError.STORE_OFFLINE ("cannot create a new " + - "Tpf.Persona while offline"); + throw new PersonaStoreError.STORE_OFFLINE ( + _("Cannot create a new persona while offline.")); } string[] contact_ids = new string[1]; @@ -1419,14 +1494,25 @@ public class Tpf.PersonaStore : Folks.PersonaStore } else { - throw new PersonaStoreError.CREATE_FAILED ("requested a single " + - "persona, but got %u back", personas.length ()); + /* We ignore the case of an empty list, as it just means the + * contact was already in our roster */ + uint num_personas = personas.length (); + string message = + ngettext ( + /* Translators: the parameter is the number of personas + * which were returned. */ + "Requested a single persona, but got %u persona back.", + "Requested a single persona, but got %u personas back.", + num_personas); + + throw new PersonaStoreError.CREATE_FAILED (message, num_personas); } } catch (GLib.Error e) { - throw new PersonaStoreError.CREATE_FAILED ("failed to add a " + - "persona from details: %s", e.message); + /* Translators: the parameter is an error message. */ + throw new PersonaStoreError.CREATE_FAILED ( + _("Failed to add a persona from details: %s"), e.message); } } @@ -1443,8 +1529,10 @@ public class Tpf.PersonaStore : Folks.PersonaStore * see connection_ready_cb() */ if (this.logger == null) { - warning ("failed to change favourite without connection to the " + - "telepathy-logger service"); + warning ( + /* Translators: "telepathy-logger" is the name of an application, + * and should not be translated. */ + _("Failed to change favorite without a connection to the telepathy-logger service.")); return; } @@ -1461,7 +1549,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore } catch (DBus.Error e) { - warning ("failed to change a persona's favourite status"); + warning (_("Failed to change a persona's favorite status.")); } } diff --git a/backends/telepathy/lib/tpf-persona.vala b/backends/telepathy/lib/tpf-persona.vala index f681f74..b0ea5e5 100644 --- a/backends/telepathy/lib/tpf-persona.vala +++ b/backends/telepathy/lib/tpf-persona.vala @@ -210,8 +210,10 @@ public class Tpf.Persona : Folks.Persona, * chain up to the Object constructor, below. */ unowned string id = contact.get_identifier (); if (id == null || id == "") - throw new Tpf.PersonaError.INVALID_ARGUMENT ("contact has an " + - "invalid ID"); + { + throw new Tpf.PersonaError.INVALID_ARGUMENT ( + _("Contact has an invalid ID.")); + } unowned Connection connection = contact.connection; var account = account_for_connection (connection); diff --git a/folks/backend-store.vala b/folks/backend-store.vala index 9e87510..786014c 100644 --- a/folks/backend-store.vala +++ b/folks/backend-store.vala @@ -224,9 +224,9 @@ public class Folks.BackendStore : Object { { if (this.backend_is_enabled (backend.name)) { - try + if (!this._prepared_backends.has_key (backend.name)) { - if (!this._prepared_backends.has_key (backend.name)) + try { yield backend.prepare (); @@ -234,11 +234,13 @@ public class Folks.BackendStore : Object { this._prepared_backends.set (backend.name, backend); this.backend_available (backend); } - } - catch (GLib.Error e) - { - warning ("Error preparing Backend '%s': %s", backend.name, - e.message); + catch (GLib.Error e) + { + /* Translators: the first parameter is a backend name, and the + * second is an error message. */ + warning (_("Error preparing Backend '%s': %s"), + backend.name, e.message); + } } } } @@ -386,7 +388,9 @@ public class Folks.BackendStore : Object { } catch (Error error) { - critical ("Error listing contents of folder '%s': %s", + /* Translators: the first parameter is a folder path and the second + * is an error message. */ + critical (_("Error listing contents of folder '%s': %s"), dir.get_path (), error.message); return null; @@ -417,8 +421,10 @@ public class Folks.BackendStore : Object { } else if (mime == null) { - warning ("MIME type could not be determined for file '%s'. " + - "Have you installed shared-mime-info?", file.get_path ()); + warning ( + /* Translators: the parameter is a filename. */ + _("The content type of '%s' could not be determined. Have you installed shared-mime-info?"), + file.get_path ()); } } @@ -438,7 +444,9 @@ public class Folks.BackendStore : Object { Module module = Module.open (file_path, ModuleFlags.BIND_LOCAL); if (module == null) { - warning ("Failed to load module from path '%s' : %s", + /* Translators: the first parameter is a filename and the second is an + * error message. */ + warning (_("Failed to load module from path '%s': %s"), file_path, Module.error ()); return; @@ -451,7 +459,9 @@ public class Folks.BackendStore : Object { * removed if they've since been disabled */ if (!module.symbol("module_init", out function)) { - warning ("Failed to find entry point function '%s' in '%s': %s", + /* Translators: the first parameter is a function name, the second is + * a filename and the third is an error message. */ + warning (_("Failed to find entry point function '%s' in '%s': %s"), "module_init", file_path, Module.error ()); @@ -486,10 +496,17 @@ public class Folks.BackendStore : Object { catch (Error error) { if (error is IOError.NOT_FOUND) - critical ("File or directory '%s' does not exist", - file.get_path ()); + { + /* Translators: the parameter is a filename. */ + critical (_("File or directory '%s' does not exist."), + file.get_path ()); + } else - critical ("Failed to get content type for '%s'", file.get_path ()); + { + /* Translators: the parameter is a filename. */ + critical (_("Failed to get content type for '%s'."), + file.get_path ()); + } return false; } diff --git a/folks/individual-aggregator.vala b/folks/individual-aggregator.vala index 04a972a..c31d643 100644 --- a/folks/individual-aggregator.vala +++ b/folks/individual-aggregator.vala @@ -241,7 +241,9 @@ public class Folks.IndividualAggregator : Object } catch (GLib.Error e) { - warning ("Error preparing PersonaStore '%s': %s", store_id, + /* Translators: the first parameter is a persona store identifier + * and the second is an error message. */ + warning (_("Error preparing persona store '%s': %s"), store_id, e.message); } }); @@ -345,8 +347,10 @@ public class Folks.IndividualAggregator : Object unowned ObjectClass pclass = persona.get_class (); if (pclass.find_property (prop_name) == null) { - warning ("Unknown property '%s' in linkable property " + - "list.", prop_name); + warning ( + /* Translators: the parameter is a property name. */ + _("Unknown property '%s' in linkable property list."), + prop_name); continue; } @@ -437,8 +441,11 @@ public class Folks.IndividualAggregator : Object unowned ObjectClass pclass = final_persona.get_class (); if (pclass.find_property (prop_name) == null) { - warning ("Unknown property '%s' in linkable " + - "property list.", prop_name); + warning ( + /* Translators: the parameter is a property + * name. */ + _("Unknown property '%s' in linkable property list."), + prop_name); continue; } @@ -545,8 +552,10 @@ public class Folks.IndividualAggregator : Object unowned ObjectClass pclass = persona.get_class (); if (pclass.find_property (prop_name) == null) { - warning ("Unknown property '%s' in linkable property " + - "list.", prop_name); + warning ( + /* Translators: the parameter is a property name. */ + _("Unknown property '%s' in linkable property list."), + prop_name); continue; } @@ -703,8 +712,9 @@ public class Folks.IndividualAggregator : Object if (store == null) { throw new IndividualAggregatorError.STORE_NOT_FOUND ( - "no store known for type ID '%s' and ID '%s'", persona_store_type, - persona_store_id); + /* Translators: the parameters are store identifiers. */ + _("No store known for type ID '%s' and ID '%s'."), + persona_store_type, persona_store_id); } Persona persona = null; @@ -722,7 +732,9 @@ public class Folks.IndividualAggregator : Object else { throw new IndividualAggregatorError.ADD_FAILED ( - "failed to add contact for store type '%s', ID '%s': %s", + /* Translators: the first two parameters are store identifiers + * and the third parameter is an error message. */ + _("Failed to add contact for store type '%s', ID '%s': %s"), persona_store_type, persona_store_id, e.message); } } @@ -805,7 +817,7 @@ public class Folks.IndividualAggregator : Object if (this.writeable_store == null) { throw new IndividualAggregatorError.NO_WRITEABLE_STORE ( - "Can't link personas with no writeable store."); + _("Can't link personas with no writeable store.")); } /* Don't bother linking if it's just one Persona */ diff --git a/po/POTFILES.in b/po/POTFILES.in index e69de29..5cb2054 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -0,0 +1,11 @@ +[encoding: UTF-8] +backends/key-file/kf-backend-factory.vala +backends/key-file/kf-persona-store.vala +backends/key-file/kf-persona.vala +backends/telepathy/lib/tp-lowlevel.c +backends/telepathy/lib/tpf-persona-store.vala +backends/telepathy/lib/tpf-persona.vala +folks/backend-store.vala +folks/individual-aggregator.vala +tools/import-pidgin.vala +tools/import.vala diff --git a/po/POTFILES.skip b/po/POTFILES.skip index e69de29..125d123 100644 --- a/po/POTFILES.skip +++ b/po/POTFILES.skip @@ -0,0 +1,9 @@ +backends/key-file/kf-backend-factory.c +backends/key-file/kf-persona-store.c +backends/key-file/kf-persona.c +backends/telepathy/lib/tpf-persona-store.c +backends/telepathy/lib/tpf-persona.c +folks/backend-store.c +folks/individual-aggregator.c +tools/import-pidgin.c +tools/import.c diff --git a/tools/import-pidgin.vala b/tools/import-pidgin.vala index 17ca53c..26579f3 100644 --- a/tools/import-pidgin.vala +++ b/tools/import-pidgin.vala @@ -44,7 +44,8 @@ public class Folks.Importers.Pidgin : Folks.Importer var file = File.new_for_path (filename); if (!file.query_exists ()) { - throw new ImportError.MALFORMED_INPUT ("File %s does not exist.", + /* Translators: the parameter is a filename. */ + throw new ImportError.MALFORMED_INPUT (_("File %s does not exist."), filename); } @@ -58,13 +59,16 @@ public class Folks.Importers.Pidgin : Folks.Importer catch (GLib.Error e) { throw new ImportError.MALFORMED_INPUT ( - "Failed to get information about file %s: %s", filename, + /* Translators: the first parameter is a filename, and the second + * is an error message. */ + _("Failed to get information about file %s: %s"), filename, e.message); } if (!file_info.get_attribute_boolean (FILE_ATTRIBUTE_ACCESS_CAN_READ)) { - throw new ImportError.MALFORMED_INPUT ("File %s is not readable.", + /* Translators: the parameter is a filename. */ + throw new ImportError.MALFORMED_INPUT (_("File %s is not readable."), filename); } @@ -72,8 +76,10 @@ public class Folks.Importers.Pidgin : Folks.Importer if (xml_doc == null) { - throw new ImportError.MALFORMED_INPUT ("The Pidgin buddy list file " + - "'%s' could not be loaded.", filename); + throw new ImportError.MALFORMED_INPUT ( + /* Translators: the parameter is a filename. */ + _("The Pidgin buddy list file '%s' could not be loaded."), + filename); } /* Check the root node */ @@ -85,9 +91,10 @@ public class Folks.Importers.Pidgin : Folks.Importer /* Free the document manually before throwing because the garbage * collector can't work on pointers. */ delete xml_doc; - throw new ImportError.MALFORMED_INPUT ("The Pidgin buddy list file " + - "'%s' could not be loaded: the root element could not be found " + - "or was not recognised.", filename); + throw new ImportError.MALFORMED_INPUT ( + /* Translators: the parameter is a filename. */ + _("The Pidgin buddy list file '%s' could not be loaded: the root element could not be found or was not recognised."), + filename); } /* Parse each <blist> child element */ @@ -103,7 +110,9 @@ public class Folks.Importers.Pidgin : Folks.Importer /* Tidy up */ delete xml_doc; - stdout.printf ("Imported %u buddies from '%s'.\n", this.persona_count, + /* Translators: the first parameter is the number of buddies which were + * successfully imported, and the second is a filename. */ + stdout.printf (_("Imported %u buddies from '%s'.\n"), this.persona_count, filename); /* Return the number of Personas we imported */ @@ -146,8 +155,11 @@ public class Folks.Importers.Pidgin : Folks.Importer } catch (GLib.Error e) { - stderr.printf ("Error changing group of Pidgin.Persona " + - "'%s': %s\n", persona.iid, e.message); + stderr.printf ( + /* Translators: the first parameter is a persona identifier, + * and the second is an error message. */ + _("Error changing group of Pidgin.Persona '%s': %s\n"), + persona.iid, e.message); } } } @@ -210,8 +222,10 @@ public class Folks.Importers.Pidgin : Folks.Importer (alias == null || alias.strip () == "" || alias.strip () == im_address_string.strip ())) { - stdout.printf ("Ignoring buddy with no alias and only one IM " + - "address:\n%s", im_address_string); + stdout.printf ( + /* Translators: the parameter is the buddy's IM address. */ + _("Ignoring buddy with no alias and only one IM address:\n%s"), + im_address_string); return null; } @@ -230,9 +244,12 @@ public class Folks.Importers.Pidgin : Folks.Importer } catch (PersonaStoreError e) { - stderr.printf ("Failed to create new persona for buddy with alias " + - "'%s' and IM addresses:\n%s\nError: %s\n", alias, - im_address_string, e.message); + /* Translators: the first parameter is an alias, the second is a set + * of IM addresses each on a new line, and the third is an error + * message. */ + stderr.printf ( + _("Failed to create new persona for buddy with alias '%s' and IM addresses:\n%s\nError: %s\n"), + alias, im_address_string, e.message); return null; } @@ -241,8 +258,12 @@ public class Folks.Importers.Pidgin : Folks.Importer ((Aliasable) persona).alias = alias; /* Print progress */ - stdout.printf ("Created persona '%s' for buddy with alias '%s' and IM " + - "addresses:\n%s", persona.uid, alias, im_address_string); + stdout.printf ( + /* Translators: the first parameter is a persona identifier, the + * second is an alias for the persona, and the third is a set of IM + * addresses each on a new line. */ + _("Created persona '%s' for buddy with alias '%s' and IM addresses:\n%s"), + persona.uid, alias, im_address_string); this.persona_count++; return persona; diff --git a/tools/import.vala b/tools/import.vala index 7e060c3..238aab9 100644 --- a/tools/import.vala +++ b/tools/import.vala @@ -39,10 +39,10 @@ public class Folks.ImportTool : Object private static const OptionEntry[] options = { { "source", 's', 0, OptionArg.STRING, ref ImportTool.source, - "Source backend name (default: 'pidgin')", "name" }, + N_("Source backend name (default: 'pidgin')"), "name" }, { "source-filename", 0, 0, OptionArg.FILENAME, ref ImportTool.source_filename, - "Source filename (default: specific to source backend)", null }, + N_("Source filename (default: specific to source backend)"), null }, { null } }; @@ -51,8 +51,8 @@ public class Folks.ImportTool : Object Intl.bindtextdomain (BuildConf.GETTEXT_PACKAGE, BuildConf.LOCALE_DIR); Intl.textdomain (BuildConf.GETTEXT_PACKAGE); - OptionContext context = new OptionContext ("— import meta-contact " + - "information to libfolks"); + OptionContext context = new OptionContext ( + _("— import meta-contact information to libfolks")); context.add_main_entries (ImportTool.options, "folks"); try @@ -61,7 +61,8 @@ public class Folks.ImportTool : Object } catch (OptionError e) { - stderr.printf ("Couldn't parse command line options: %s\n", + /* Translators: the parameter is an error message. */ + stderr.printf (_("Couldn't parse command line options: %s\n"), e.message); return 1; } @@ -101,7 +102,8 @@ public class Folks.ImportTool : Object } catch (GLib.Error e1) { - stderr.printf ("Couldn't load the backends: %s\n", e1.message); + /* Translators: the parameter is an error message. */ + stderr.printf (_("Couldn't load the backends: %s\n"), e1.message); return false; } @@ -110,7 +112,7 @@ public class Folks.ImportTool : Object if (kf_backend == null) { - stderr.printf ("Couldn't load the 'key-file' backend.\n"); + stderr.printf (_("Couldn't load the 'key-file' backend.\n")); return false; } @@ -120,7 +122,8 @@ public class Folks.ImportTool : Object } catch (GLib.Error e2) { - stderr.printf ("Couldn't prepare the 'key-file' backend: %s\n", + /* Translators: the parameter is an error message. */ + stderr.printf (_("Couldn't prepare the 'key-file' backend: %s\n"), e2.message); return false; } @@ -132,8 +135,8 @@ public class Folks.ImportTool : Object if (stores == null) { - stderr.printf ("Couldn't load the 'key-file' backend's persona " + - "store.\n"); + stderr.printf ( + _("Couldn't load the 'key-file' backend's persona store.\n")); return false; } @@ -144,8 +147,10 @@ public class Folks.ImportTool : Object } catch (GLib.Error e3) { - stderr.printf ("Couldn't prepare the 'key-file' backend's persona " + - "store: %s\n", e3.message); + /* Translators: the parameter is an error message. */ + stderr.printf ( + _("Couldn't prepare the 'key-file' backend's persona store: %s\n"), + e3.message); return false; } @@ -161,7 +166,8 @@ public class Folks.ImportTool : Object } catch (ImportError e) { - stderr.printf ("Error: %s\n", e.message); + /* Translators: the parameter is an error message. */ + stderr.printf (_("Error importing personas: %s\n"), e.message); return false; } @@ -172,8 +178,8 @@ public class Folks.ImportTool : Object } else { - stderr.printf ("Unrecognised source backend name '%s'. " + - "'pidgin' is currently the only supported source backend.\n", + stderr.printf ( + _("Unrecognised source backend name '%s'. 'pidgin' is currently the only supported source backend.\n"), source); return false; } |