[virt-tools-list] [libosinfo v3 2/3] Translate all (potentially) user visible strings
Christophe Fergeau
cfergeau at redhat.com
Wed Oct 31 09:30:17 UTC 2012
On Tue, Oct 30, 2012 at 11:08:52PM +0200, Zeeshan Ali (Khattak) wrote:
> diff --git a/tools/osinfo-db-validate.c b/tools/osinfo-db-validate.c
> index f5855d1..2760b00 100644
> --- a/tools/osinfo-db-validate.c
> +++ b/tools/osinfo-db-validate.c
> @@ -33,7 +33,7 @@ static gboolean verbose = FALSE;
>
> static const GOptionEntry entries[] = {
> { "verbose", 'v', 0, G_OPTION_ARG_NONE, (void*)&verbose,
> - "Verbose progress information", NULL, },
> + N_("Verbose progress information"), NULL, },
> { NULL, 0, 0, 0, NULL, NULL, NULL }
> };
>
> @@ -255,12 +256,13 @@ gint main(gint argc, gchar **argv)
>
> g_type_init();
>
> - context = g_option_context_new("- Validate XML documents ");
> + context = g_option_context_new(_("- Validate XML documents "));
>
> - g_option_context_add_main_entries(context, entries, NULL);
> + g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE);
This change is enough to get everything translated, no need to add a call
to g_option_context_set_translation_domain ?
> diff --git a/tools/osinfo-query.c b/tools/osinfo-query.c
> index e68be90..eff323a 100644
> --- a/tools/osinfo-query.c
> +++ b/tools/osinfo-query.c
> @@ -287,10 +287,10 @@ static gboolean print_results_text(OsinfoList *list,
> g_print(" | ");
> first = FALSE;
>
> - if (strlen(labels[i].label) > labels[i].width)
> + if (strlen(gettext(labels[i].label)) > labels[i].width)
> pad = 0;
> else
> - pad = labels[i].width - strlen(labels[i].label);
> + pad = labels[i].width - strlen(gettext(labels[i].label));
I'd have a slight preference for _() here rather than gettext(), but I'm
fine either way.
Rest of the patch still looks good,
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20121031/c90f3f2d/attachment.sig>
More information about the virt-tools-list
mailing list