See below...
Post by Mihai N.Post by David ChingPost by Mihai N.I really don't understand what "maintenance" is needed for numeric IDs.
Essentially, any and all required manipulation of resource.h. Who hasn't
spent at least some time in resource.h?
Only if you want to. It is never *needed*.
You have a #define for something never used. So what?
It does not take any memory.
****
One of the very unfortunate misfeatures that *requires* the hand-editing of resource.h is
how radio button IDs are assigned. The editor needs a primitive that allows you to select
a group of radio buttons and say "Reassign all the control IDs for this group" so they are
a dense set of integers. And it is also important that a given resource ID, if used for
radio buttons, should *never, ever* be reused in another dialog. Of course, I learned
this nearly 20 years ago, so for me it is reflexive to be able to hand-edit resource.h to
add a new button long after the radio group was created, but it is astonishing how many
people *don't* understand how to do this.
When I'm in there, I'll get rid of the typos that resulted in unused symbols, such as
IDC_MEIDUM (should have been IDC_MEDIUM) and such, but that's just a side effect of being
in there at all. I hardly ever look at it, and only rarely do any hand-editing other than
for radio button IDs.
****
Post by Mihai N.Post by David ChingWith respect, developers who don't use the context are the same developers
who would attempt to re-use the same resource ID for another context. So
the problem is the same, it is no more pervasive the Qt way than with
traditional resource id way.
Reuse is not possible in .rc files at least in dialogs.
Yes, you can reuse strings in string tables (still bad), but at least the
dialogs are "clean"
****
Modular reuse would be nice, but overall it happens so rarely that copy-and-paste usually
suffices. Sadly, the new VS doesn't allow me to open one project and do a "copy" and go
to another project and do a "paste" (VS has its own internal pseudo-clipboard for dialogs;
apparently the VS creators hadn't yet received word that Windows actually has a mechanism
that does this, called, surprisingly "the clipboard")
****
Post by Mihai N.Post by David ChingHere Qt actually gives you more room by having a special comment you can
use to discuss such things with the translator.
...
Post by David ChingAnd the comment goes right
next to the usage of the string (in the source code) and not in some other
file, so you don't have to manipulate separate .rc files during development.
I am not familiar with that.
Is that comment extracted automatically? Remember that the translators
don't dig into source files.
****
If I'm really serious about sharing resources, I put them in DLLs. A common multi-project
dialog, for example, has its own DLL. I know there is a school of thought that says that
creating DLLs is one of those deep and fundamentally Bad Ideas that should never be used,
because then you have to distribute multiple files, but I somehow missed why having
multiple files really is such a Bad Idea.
****
Post by Mihai N.A drawback of embeded strings: no special characters (thing smart quites,
mdash, ndash, copyright and registration). If you use them, you are not
cross-platform anymore.
****
Actually, you are not cross-font on the *same* platform any longer, but that's yet a
different discussion. And I have never understood why linux and the Mac have ignored
international standards such as ISO-8859-1.
****
Post by Mihai N.Post by David ChingNo such comment space is
provided in a traditional .rc file stringtable.
That is indeed a bad thing.
****
The whole precompiled-to-.aps file hack was created because computers were slow. They
aren't any longer, and this Bad Idea should silently disappear; nobody would notice or
care, and then we could put comments in, just like in other source files. Or they could
modify the .aps translation to preserve comments; it isn't like it is Rocket Science.
****
Post by Mihai N.Post by David ChingPerhaps not, but the same merging occurs when using .rc files as well.
Not in dialogs. At least that.
Post by David Chingwhy do
translation memory programs make it so easy to reuse these strings? A
bragging feature of them is that they will search the database for
pre-existing words and phrases and re-use them for new strings....
They don't reuse them automatically, they suggest it to the translator
(like intellisense). It is a human who knows the language making the
final decision. So it increases productivity without sacrificing
quality.
****
Apparently our European distributor hired a couple non-technical types to translate
strings, and got some very creative translations that were either incomprehensible or
downright hysterically funny. We just send the English-language executable to him, and he
hires the translators and runs a program across the executable that translates English
strings to a variety of languages. I heard about this indirectly, reported it to the
client, who reported it to the translator, who didn't understand that there was anything
wrong. So he found a Swede who was a programmer, who spoke English well, and got the
correct translation. I no longer remember the word or phrase as it read, but BabelFish
would probably have done as good a job (www.babelfish.com). This is one of the reasons I
*never* use the same message twice in my programs. In context, the same sentence can be
informative in one case and misleading in another. Even in English. Especially under
maintenance, where the message can evolve to explain better in one context what really
happened, and then be really confusing when it tries to give the same explanation in a
different context. So it is not at all uncommon to find two unique IDS_ strings in my
STRINGTABLE that say the same words. Today. But maybe they won't, tomorrow.
****
Post by Mihai N.Post by David ChingWhat is essential for Adobe Reader (millions of
users, many languages, huge software) does not necessarily serve smaller
projects with fewer users and less languages.
I am not talking about Acrobat (which does not use .rc files to begin with,
because it is cross-platform). If you search for my posts you will see
that my position on string IDs, strings embeded in sources, and
strings reuse, did not change from before I worked for Adobe.
The only good reason to not use the standard resources of the framework
is the need to be cross-platform. And even then numeric IDs and strings
outside the code are the better option.
****
In 1987, I wrote a program that created the equivalent of a STRINGTABLE/MESSAGETABLE. It
was a database (in dBASE III) that had string IDs, and when it was run, it created a text
file of messages; the equivalent of resource.h gave the index of the line on which it
placed the message. It also sorted the lines alphabetically and created a TeX file which
when included in the documentation created the appendix which explained every message.
****
Post by Mihai N.Post by David ChingA product's success is not dependent only on how well it is
localized. Things like fast development, stability, speed, and
deployability ... are also critical.
None of them incompatible with numeric IDs.
****
I fail to see why numeric IDs are remotely an issue. See my previous description; I was
using numeric IDs in 1987, and there was nothing wrong with them then, and I fail to see
why there has ever been a problem. If the rc and mc compilers are not suitable, WRITE
YOUR OWN. You can probably write a PERL or PYTHON script to do this in a couple days! Or
generate the output from an Access database. Or whatever.
****
Post by Mihai N.Post by David ChingSo if a localization scheme is less accurate
(but is not necessarily so) and is more productive to use, it is not
necessarily a bad thing.
Yes, it is. Crappy UI language for the end-user influences the perception
about your software. The end-users don't care about your productivity.
Post by David Chingkeep strings in my code, as any developer would prefer.
Make that "any developer would WRONGLY prefer" and I am fine.
****
Why "any developer would prefer"? What is so magical about strings? Does it matter if I
say "IDS_FILE_OPEN_FAILURE" or IDS_FILE_OPEN_FAILURE? It's just a couple quote marks!
I would *not* prefer to use strings. They don't buy that much, and are clumsy to use. In
the Locale Explorer, I stored the help text as embedded .rtf files with string names, and
it was fine when I had no tabs in the app, and is horrid now that I have a whole lot more.
It is one of the features I regret in the design. It Seemed Like A Good Idea At The Time.
It wasn't.
****
Post by Mihai N.Post by David Ching(Yet strings are full UTF-16).
Really? So the cpp files are UTF-16 in Qt? gcc can compile that?
****
Probably as well as VS can. \xNNNN syntax works. Unreadable, but works.
joe
****
Joseph M. Newcomer [MVP]
email: ***@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm