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

Re: [virt-tools-list] [libosinfo v2 2/2] Translate all (potentially) user visible strings



On Tue, Oct 30, 2012 at 02:50:16PM +0200, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak gnome org>
> 
> Make some strings more translator-friendly at the same time.
> ---
>  osinfo/osinfo_deployment.c           |  4 +-
>  osinfo/osinfo_devicelink.c           |  2 +-
>  osinfo/osinfo_devicelinkfilter.c     |  2 +-
>  osinfo/osinfo_entity.c               |  2 +-
>  osinfo/osinfo_install_config_param.c |  4 +-
>  osinfo/osinfo_install_script.c       | 42 +++++++++----------
>  osinfo/osinfo_list.c                 |  2 +-
>  osinfo/osinfo_loader.c               | 28 ++++++-------
>  osinfo/osinfo_media.c                | 40 +++++++++---------
>  osinfo/osinfo_os.c                   |  4 +-
>  osinfo/osinfo_priv.h                 |  1 +
>  osinfo/osinfo_product.c              | 12 +++---
>  osinfo/osinfo_resources.c            | 10 ++---
>  osinfo/osinfo_tree.c                 | 22 +++++-----
>  po/POTFILES.in                       | 17 ++++++++
>  tools/osinfo-db-validate.c           | 24 ++++++-----
>  tools/osinfo-detect.c                | 35 ++++++++--------
>  tools/osinfo-install-script.c        | 22 +++++-----
>  tools/osinfo-query.c                 | 79 ++++++++++++++++++------------------
>  19 files changed, 187 insertions(+), 165 deletions(-)
> 
> diff --git a/osinfo/osinfo_deployment.c b/osinfo/osinfo_deployment.c
> index 5f70e0d..c67456a 100644
> --- a/osinfo/osinfo_deployment.c
> +++ b/osinfo/osinfo_deployment.c
> @@ -148,7 +148,7 @@ osinfo_deployment_class_init (OsinfoDeploymentClass *klass)
>       */
>      pspec = g_param_spec_object("os",
>                                  "Os",
> -                                "Operating system",
> +                                _("Operating system"),

spice-gtk does not translate any of the args to g_param_spec_object, gtk+
does translate both the 2nd and 3rd arg. Dunno if you are doing something
different from both on purpose?

> diff --git a/tools/osinfo-db-validate.c b/tools/osinfo-db-validate.c
> index 5b7274b..5a86af8 100644
> --- a/tools/osinfo-db-validate.c
> +++ b/tools/osinfo-db-validate.c
> @@ -35,7 +35,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 }
>  };

Do these strings get translated without a call to
g_option_context_set_translation_domain ?

> diff --git a/tools/osinfo-detect.c b/tools/osinfo-detect.c
> index 1b94e36..ecb3907 100644
> --- a/tools/osinfo-detect.c
> +++ b/tools/osinfo-detect.c
> @@ -95,12 +95,12 @@ static GOptionEntry entries[] =
>  {
>      { "format", 'f', 0,
>        G_OPTION_ARG_CALLBACK, parse_format_str,
> -      "Output format. Default: plain",
> -      "plain|env." },
> +      N_("Output format. Default: plain"),
> +      N_("plain|env.") },
>      { "type", 't', 0,
>        G_OPTION_ARG_CALLBACK, parse_type_str,
> -      "URL type. Default: media",
> -      "media|tree." },
> +      N_("URL type. Default: media"),
> +      N_("media|tree.") },
>      { NULL }
>  };

same question

> @@ -190,12 +190,13 @@ gint main(gint argc, gchar **argv)
>      bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
>      bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
>  
> -    context = g_option_context_new("- Detect if media is bootable " \
> -                                   "and the relavent OS and distribution.");
> +    context = g_option_context_new(_("- Detect if media is bootable " \
> +                                     "and the relavent OS and distribution."));

You can fix the typo while at it, 'relevant'

> diff --git a/tools/osinfo-install-script.c b/tools/osinfo-install-script.c
> index 66116e1..fd16c67 100644
> --- a/tools/osinfo-install-script.c
> +++ b/tools/osinfo-install-script.c
> @@ -63,14 +63,14 @@ static gboolean handle_config(const gchar *option_name G_GNUC_UNUSED,
>  static GOptionEntry entries[] =
>  {
>      { "profile", 'p', 0, G_OPTION_ARG_STRING, (void*)&profile,
> -      "Install script profile", NULL, },
> +      N_("Install script profile"), NULL, },
>      { "output-dir", 'd', 0, G_OPTION_ARG_STRING, (void*)&output_dir,
> -      "Install script output directory", NULL, },
> +      N_("Install script output directory"), NULL, },
>      { "prefix", 'P', 0, G_OPTION_ARG_STRING, (void*)&prefix,
> -      "The output filename prefix", NULL, },
> +      N_("The output filename prefix"), NULL, },
>      { "config", 'c', 0, G_OPTION_ARG_CALLBACK,
>        handle_config,
> -      "Set configuration parameter", "key=value" },
> +      N_("Set configuration parameter"), "key=value" },
>      { NULL }
>  };

Same g_option_context_set_translation_domain concern.

> diff --git a/tools/osinfo-query.c b/tools/osinfo-query.c
> index 006f86d..81ec239 100644
> --- a/tools/osinfo-query.c
> +++ b/tools/osinfo-query.c
> @@ -54,71 +54,71 @@ struct OsinfoType {
>  
>  static struct OsinfoLabel os_labels[] = {
>      { OSINFO_PRODUCT_PROP_SHORT_ID,
> -      "Short ID", TRUE, 20 },
> +      N_("Short ID"), TRUE, 20 },
>      { OSINFO_PRODUCT_PROP_NAME,
> -      "Name", TRUE, 50 },
> +      N_("Name"), TRUE, 50 },
>      { OSINFO_PRODUCT_PROP_VERSION,
> -      "Version", TRUE, 8 },
> +      N_("Version"), TRUE, 8 },
>      { OSINFO_OS_PROP_FAMILY,
> -      "Family", FALSE, 12 },
> +      N_("Family"), FALSE, 12 },
>      { OSINFO_OS_PROP_DISTRO,
> -      "Distro", FALSE, 12 },
> +      N_("Distro"), FALSE, 12 },
>      { OSINFO_PRODUCT_PROP_VENDOR,
> -      "Vendor", FALSE, 25 },
> +      N_("Vendor"), FALSE, 25 },
>      { OSINFO_PRODUCT_PROP_RELEASE_DATE,
> -      "Release date", FALSE, 12 },
> +      N_("Release date"), FALSE, 12 },
>      { OSINFO_PRODUCT_PROP_EOL_DATE,
> -      "End of life", FALSE, 12 },
> +      N_("End of life"), FALSE, 12 },
>      { OSINFO_PRODUCT_PROP_CODENAME,
> -      "Code name", FALSE, 10 },
> +      N_("Code name"), FALSE, 10 },
>      { OSINFO_ENTITY_PROP_ID,
> -      "ID", TRUE, 40 },
> +      N_("ID"), TRUE, 40 },
>      { NULL, NULL, 0, 0},
>  };
>  
>  static struct OsinfoLabel platform_labels[] = {
>      { OSINFO_PRODUCT_PROP_SHORT_ID,
> -      "Short ID", TRUE, 20 },
> +      N_("Short ID"), TRUE, 20 },
>      { OSINFO_PRODUCT_PROP_NAME,
> -      "Name", TRUE, 50 },
> +      N_("Name"), TRUE, 50 },
>      { OSINFO_PRODUCT_PROP_VERSION,
> -      "Version", TRUE, 8 },
> +      N_("Version"), TRUE, 8 },
>      { OSINFO_PRODUCT_PROP_VENDOR,
> -      "Vendor", TRUE, 25 },
> +      N_("Vendor"), TRUE, 25 },
>      { OSINFO_PRODUCT_PROP_RELEASE_DATE,
> -      "Release date", FALSE, 12 },
> +      N_("Release date"), FALSE, 12 },
>      { OSINFO_PRODUCT_PROP_EOL_DATE,
> -      "End of life", FALSE, 12 },
> +      N_("End of life"), FALSE, 12 },
>      { OSINFO_PRODUCT_PROP_CODENAME,
> -      "Code name", FALSE, 10 },
> +      N_("Code name"), FALSE, 10 },
>      { OSINFO_ENTITY_PROP_ID,
> -      "ID", TRUE, 40 },
> +      N_("ID"), TRUE, 40 },
>      { NULL, NULL, 0, 0 },
>  };
>  
>  static struct OsinfoLabel device_labels[] = {
>      { OSINFO_DEVICE_PROP_VENDOR,
> -      "Vendor", TRUE, 20 },
> +      N_("Vendor"), TRUE, 20 },
>      { OSINFO_DEVICE_PROP_VENDOR_ID,
> -      "Vendor ID", TRUE, 12 },
> +      N_("Vendor ID"), TRUE, 12 },
>      { OSINFO_DEVICE_PROP_PRODUCT,
> -      "Product", TRUE, 20 },
> +      N_("Product"), TRUE, 20 },
>      { OSINFO_DEVICE_PROP_PRODUCT_ID,
> -      "Product ID", TRUE, 12 },
> +      N_("Product ID"), TRUE, 12 },
>      { OSINFO_PRODUCT_PROP_NAME,
> -      "Name", TRUE, 14 },
> +      N_("Name"), TRUE, 14 },
>      { OSINFO_DEVICE_PROP_CLASS,
> -      "Class", TRUE, 15 },
> +      N_("Class"), TRUE, 15 },
>      { OSINFO_DEVICE_PROP_BUS_TYPE,
> -      "Bus", TRUE, 8 },
> +      N_("Bus"), TRUE, 8 },
>      { OSINFO_ENTITY_PROP_ID,
> -      "ID", TRUE, 40 },
> +      N_("ID"), TRUE, 40 },
>      { NULL, NULL, 0, 0 },
>  };
>  
>  static struct OsinfoLabel deployment_labels[] = {
>      { OSINFO_ENTITY_PROP_ID,
> -      "ID", TRUE, 40 },
> +      N_("ID"), TRUE, 40 },
>      { NULL, NULL, 0, 0 },
>  };

When you mark a string for translation with N_, you still need to use
gettext() (which _() is #defined to) when you use it to get its
translation, this does not seem to be done here.

> @@ -397,25 +397,26 @@ gint main(gint argc, gchar **argv)
>  
>      GOptionEntry entries[] = {
>          { "sort", 's', 0, G_OPTION_ARG_STRING, &sortKey,
> -          "Sort column", NULL },
> +          _("Sort column"), NULL },
>          { "fields", 'f', 0, G_OPTION_ARG_STRING, &fields,
> -          "Display fields", NULL },
> +          _("Display fields"), NULL },
>          { NULL, 0, 0, 0, NULL, NULL, NULL }
>      };
>  

g_option_context_set_translation_domain ?

Christophe

Attachment: pgpHKoaDFkP3j.pgp
Description: PGP signature


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