From: Faisal on
On Feb 5, 5:46 pm, "Giovanni Dicanio"
<giovanniDOTdica...(a)REMOVEMEgmail.com> wrote:
> >http://doc.trolltech.com/4.6/qstring.html
>
> > it seems to me that QString offers a constructor which takes a const char
> > *, but not a wchar_t*...
>
> Or to be more accurate, the QChar * (i.e. Unicode version) constructor takes
> an additional size parameter:
>
> http://doc.trolltech.com/4.6/qstring.html#QString-2
>
> BTW: As Mihai several times wrote here, the best thing to do for
> internationalization is to put string literals in resources instead of
> embedding them in source code.
>
> Giovanni

use tr()
http://doc.trolltech.com/4.4/qobject.html#tr
From: Giovanni Dicanio on
"Tom Serface" <tom(a)camaswood.com> ha scritto nel messaggio
news:euJ3ZuopKHA.4836(a)TK2MSFTNGP02.phx.gbl...

> Has anyone here had success working with wxWidgets?

I used it in a project (one requirement of which was being multiplatform),
and I found it a quality library.

The problem I had was about lack of "community" and not so rich
documentation (especially sample code).
While there is this active newsgroup for MFC development, and quality web
sites like CodeProject, I could not find anything similar for wxWidgets.

Giovanni





From: David Ching on
"Giovanni Dicanio" <giovanniDOTdicanio(a)REMOVEMEgmail.com> wrote in message
news:#zR833npKHA.1552(a)TK2MSFTNGP04.phx.gbl...
> It seems there is no simple ctor taking just one 'const QChar*'.
>

No, there isn't. The best you can do is:

QString s;
s.setUtf16(L"Hello");

I don't know why they don't make a ctor taking the same arguments as
setUtf16().

But being in North America, I have never had to initialize a string with
Unicode; I simply:

QString s ("Hello");

And I love how this removes the need for the crappy L and _T; the only
things more cryptic than these are the command-line parameters to the
compiler and linker (and at least these are not trashing your source code
which should be a model of clarity).

BTW, QString is native Utf16 internally, with easy conversion to and from
Utf8.

-- David

From: David Ching on
"Hector Santos" <sant9442(a)nospam.gmail.com> wrote in message
news:uqr5HLupKHA.5588(a)TK2MSFTNGP02.phx.gbl...
> What we have in our pcode compiler is a text extraction into language
> files which can then be used for translations. For example
>
> Print [LoginPrompt "Enter your user name?"]
>

This is kind of how Qt does it -

QString s = tr("This string will be translated", "Sample code");

All strings surrounded with tr() will be identified by the open source Qt
Linguist app for either localizer or end-user translation. The "Sample
code" is an optional context string which allows Qt Linguist to sort related
localizable strings together.

After using this, the STRINGTABLE is easily seen for what it is --- a
mechanism for humans to do with the computer should do.

-- David


From: Joseph M. Newcomer on
In a sane world, I should be able to write

CString s = _STRINGTABLE("This is a sample string");

and the compiler would simply add that string to the STRINGTABLE, assign it an ID, and
replace the assignment with a sequence of code that loaded the string at runtime. I
wouldn't need an external tool, and I wouldn't need to use the STRINGTABLE, because, as
you point out, it is sort of a kludge. But it's the only kludge we've got.

In compilers other than Microsoft C, the _STRINGTABLE macro could be handled like we
currently handle _T().

For the very rare situations in which I want to assign a symbolic number relative to some
base, it could be

CString s = _STRINGTABLE("Error message text for Message 14", ERROR_BASE + 14);

where I could assign

#pragma STRINGTABLE_BASE(ERROR_BASE)

which would assign a symbolic name (resolvable at link time). But the handling of
resources in general has frozen at Windows 1.0 with no significant improvements since.
(Note that improved tools such as a dialog editor, or resource editor, are just tools to
make the poor design semi-tolerable; the real problems are much deeper. For example, go
back and add a sixth radio button to a group of five that you did two years ago, and see
how much fun THAT can be!)

I could assign absolute numbers just by not using a link-time constant, e.g.,

#define SOME_VALUE 422

CString s = _STRINGTABLE("Some value", SOME_VALUE)

or

CString s = _STRINGTABLE("Other value", SOME_VALUE + 2)

The essense is that I either have a compile-time constant expression (ctce) or link-time
constant expression (ltce). As usual, the linker has to resolve the ltces so they do not
conflict with ctces, and two strings can't evaluate to the same ctce (but this isn't
necessarily detected until link time, as a duplicate symbol)

I wrote up a proposal for link-time resolution of resource IDs a couple years ago, and
sent it to Microsoft. I do not expect anything to come out of that effort. It would have
allowed separate .rc files for separate components, and the linking of multiple .res
files, which means the age-old problem of "how do I use resources in my .lib file" would
have a trivial solution!

joe

On Mon, 8 Feb 2010 08:26:12 -0800, "David Ching" <dc(a)remove-this.dcsoft.com> wrote:

>"Hector Santos" <sant9442(a)nospam.gmail.com> wrote in message
>news:uqr5HLupKHA.5588(a)TK2MSFTNGP02.phx.gbl...
>> What we have in our pcode compiler is a text extraction into language
>> files which can then be used for translations. For example
>>
>> Print [LoginPrompt "Enter your user name?"]
>>
>
>This is kind of how Qt does it -
>
> QString s = tr("This string will be translated", "Sample code");
>
>All strings surrounded with tr() will be identified by the open source Qt
>Linguist app for either localizer or end-user translation. The "Sample
>code" is an optional context string which allows Qt Linguist to sort related
>localizable strings together.
>
>After using this, the STRINGTABLE is easily seen for what it is --- a
>mechanism for humans to do with the computer should do.
>
>-- David
>
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm