Re: Localisable without extra coding



Jonathan Pritchard writes:
My project's specification states that the program needs to be
localisable without extra coding,

Without extra coding relative to what?

Surely you don't expect to be able to localize code that contains
hardcoded strings like:

 foo = gtk_label_new ("Shoe size:");

without any "extra coding", if you by "no extra coding" mean no
changes at all.

i.e. drop in a new locale folder "fr" for instance

That's how the normal gettext approach works, yes. But you do need to
call gettext functions in your code. Typically the call is hidden
behind a visually nonintrusive macro _(), i.e. the code above would
look like this:

 foo = gtk_label_new (_("Shoe size:"));

and you'll be able to select it in the program and run with the new
localised strings. Is this possible?

You mean changing the language of a running application at run-time?
That is not possibly without much hard work in both your code, and
presumably you would need to hack gtk+, too. (Please note that when
switching between LTR and RTL languages not just strings would change,
but the whole layout of widgets would get "mirrored".)

--tml




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