Translatable strings in .h file -- best way to resolve?

Derek Atkins warlord at MIT.EDU
Thu Mar 18 11:04:25 EDT 2010


Jeff Kletsky <gnucash at allycomm.com> writes:

> So then when I submit a patch for things like src/business/business-utils/
> business-utils.scm -- the existing usages of (N_ "some string") probably
> should be converted to (_ "some string") -- correct? I was puzzled by that as,
> at least as I understand it, in C N_(string) is a noop marker and _() is the
> gettext () call.

N_ is a noop marker in both C and Scheme
_ is the gettext call in both C and Scheme
Where you place the paren is based on the language.

> (define gnc:*business-label* (N_ "Business"))
> (define gnc:*company-name* (N_ "Company Name"))
> (define gnc:*company-addy* (N_ "Company Address"))
> (define gnc:*company-id* (N_ "Company ID"))
> (define gnc:*company-phone* (N_ "Company Phone Number"))
> (define gnc:*company-fax* (N_ "Company Fax Number"))
> (define gnc:*company-url* (N_ "Company Website URL"))
> (define gnc:*company-email* (N_ "Company Email Address"))
> (define gnc:*company-contact* (N_ "Company Contact Person"))

These are fine here because these string constants are defined in
Scheme.  This would be a no-op, so it would mark these strings
are translatable but wouldn't translate them immediately.  This
is important if you want to use them as a key to a database entry (which
should always use the untranslated string) but also put it in the UI
(which should always use the translated string).

> (export gnc:*business-label* gnc:*company-name* gnc:*company-addy*
> gnc:*company-id*
>             gnc:*company-phone* gnc:*company-fax* gnc:*company-url*
>             gnc:*company-email* gnc:*company-contact*)
>
> (define gnc:*option-section-accounts* (_ OPTION-SECTION-ACCOUNTS))
> (define gnc:*option-name-trading-accounts* (_ OPTION-NAME-TRADING-ACCOUNTS))
>
> (export gnc:*option-section-accounts* gnc:*option-name-trading-accounts*)
>
> (define gnc:*option-section-budgeting* (_ OPTION-SECTION-BUDGETING))
> (define gnc:*option-name-default-budget* (_ OPTION-NAME-DEFAULT-BUDGET))
>
> (export gnc:*option-section-budgeting* gnc:*option-name-default-budget*)

These calls would define these options as the translated versions of
these strings.  I'm not sure this is correct.  So long as the OPTION
strings are defined as N_ in the C code you don't need to translate them
here unless you ONLY want access to the translated version of the
string.

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the gnucash-devel mailing list