[comp.windows.ms.programmer] STRING'ing around

gardner@iccgcc.decnet.ab.com (11/26/90)

I was wondering if anyone could explain how to use a STRING resource in a
dialog box... I am writing an accounting package that could be targeted to
various international markets and the use of STRING's would make it much
more portable...

Any help would be greatly appreciated!


				Thanks,
					Mike Gardner
					Summit Software Engineering

gardner@iccgcc.decnet.ab.com (11/27/90)

After re-reading the previous help message concerning the use of STRING
resources, I found that it wasn't very specific... So lets try again!

I want to be able to create a string table and use the entries as replacements
for the usual "static text" used in a dialog box for controls.  For example,
in my About... dialog box, I would like to have a STRING resource be used for
all the information that is displayed.

		+------------------------------------------+
		|                  About                   |
		+------------------------------------------+
		|					   |
		|            Copyright (c) 1990            |
		|                                          |
		|                +----------+              |
		|                |    Ok    |              |
                |                +----------+              |
 		+------------------------------------------+
	


(in resource file...)

	STRINGTABLE
	BEGIN
		IDS_ABOUT_CAPTION,	"About"
		IDS_COPYRIGHT,		"Copyright (c) 1990"
		IDS_OK,			"Ok"
	END



Does anyone know if it is possible (...and if so, how...) to write these
string resources to a dialog box?  Any help would be greatly appreciated!


				Thanks,
					Mike Gardner
					Summit Software Engineering

spolsky-joel@cs.yale.edu (Joel Spolsky) (11/27/90)

In article <2116.2750d1c5@iccgcc.decnet.ab.com> gardner@iccgcc.decnet.ab.com writes:
>I was wondering if anyone could explain how to use a STRING resource in a
>dialog box...

The idea of internationalizationability (whew!) is that you have all
the text the user sees in one place, ideally one file, so by
translating that one file you can localize. In the Windows model, that
file is the .RC (resource) file which contains dialog boxes, strings,
Accelerators, etc.

If your dialog box template is defined in your .rc file, you will not
need to use STRING resources. Let the translators just translate the
whole dialog box. In some cases, this will require modifying the
layout of the dialog box -- for example when you go to Tok Pisin you
will discover that "File Name" takes aobut 50 characters... or when
you go to Arabic, the layout will probably be right - to - left. Also
the accelerators will change: if Alt-S used to mean File Save, and you
are converting to Esperanto where this function is now called Filo
Ekribe you may want to change the accelerator to Alt-E.

Joel Spolsky
spolsky@cs.yale.edu                                     Silence = Death

spolsky-joel@cs.yale.edu (Joel Spolsky) (11/27/90)

In article <2129.27512297@iccgcc.decnet.ab.com> gardner@iccgcc.decnet.ab.com writes:
>
>Does anyone know if it is possible (...and if so, how...) to write these
>string resources to a dialog box?  Any help would be greatly appreciated!

If my previous response didn't satisfy you, the answer is that you
load the string using LoadString and then stuff it into the control using
SetDlgItemText.  

But if your dialog boxes are already defined in the resource file, it
is silly to do this.

Joel Spolsky
spolsky@cs.yale.edu                                     Silence = Death