All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Zhbanov <i.zhbanov at samsung.com>
To: powertop@lists.01.org
Subject: [Powertop] Internationalization problem with abstract field "type"
Date: Thu, 25 Oct 2012 12:55:50 +0400	[thread overview]
Message-ID: <5088FE96.20602@samsung.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1583 bytes --]

Hi Chris,

It seems that there is a problem with internationalization with the last commit.
Please look here:
- report.addf(__("Package %i"), _package->get_number());
+ report.addf(__("%s %i"), _package->get_type(), _package->get_number());

I have introduced the macro __() /* Double underscore */ to be a conditional 
variant
of classical _() /* Single underscore */ in the report refactoring commit.

Usual underscore macro calls the gettext() function. And we need some sort 
of conditional
gettext() -- we want to print untranslated strings to CSV-report. (Of 
course, we could simply
set English locale for CSV-reports. But this will look strange.)

So I have introduced the double underscore macro which calls gettext() for 
HTML-reports and
return original strings for CSV.

After your patch the gettext will try to translate the string "%s %i" and 
not the "Package %i",
so we have lost the internationalization here.

We could fix it by internationalizing the "type" field in the class:
   ret->set_type(__("Package"));

But I'm not sure that it is good to have the type depending on current 
locale (especially
if in some future there will be need to compare the value of this field by 
strcmp()).

What you think?

P.S. Why you not sending patches to mailing list for discussion? ;-)

-- 
Best regards,
Igor Zhbanov,
Technical Leader,
phone: +7 (495) 797 25 00 ext 3806
e-mail: i.zhbanov(a)samsung.com

Mobile group, Moscow R&D center, Samsung Electronics
12 Dvintsev street, building 1
127018, Moscow, Russian Federation


             reply	other threads:[~2012-10-25  8:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-25  8:55 Igor Zhbanov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-10-25 17:39 [Powertop] Internationalization problem with abstract field "type" Ferron, Chris E
2012-10-25 18:02 Ferron, Chris E
2012-10-26  8:03 Igor Zhbanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5088FE96.20602@samsung.com \
    --to=powertop@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.