Anton
2006-09-13 19:35:29
Suppose I have following strings in my application (extracted with help of Restorator):
I want to automatically translate them into German via command line. So I create following file:
Everything works fine... while resource identifiers stay the same during every build. But in some cases these identifiers may be changed, and the English version continues to run smoothly (symbolic identifiers are used both in application code and in original resource file), though German version would show invalid day names.
To solve this problem I propose to introduce symbolic identifiers of resources, which shall be initialized in C-style header file.
Such functionality allows us to rewrite the example as follows:
resource.rh (this file is used to compile the application as well)
week.rc
Looks good, right?
Same approach may be used for other types of resources (icons, bitmaps, etc.) to get rid of hard-coded constants.
PS: I know I might have used symbolic names for resources, but...
Code: Select all
STRINGTABLE
{
1, "Monday"
2, "Tuesday"
3, "Wednesday"
}
Code: Select all
STRINGTABLE
{
1, "Montag"
2, "Dienstag"
3, "Mittwoch"
}
To solve this problem I propose to introduce symbolic identifiers of resources, which shall be initialized in C-style header file.
Such functionality allows us to rewrite the example as follows:
resource.rh (this file is used to compile the application as well)
Code: Select all
#define IDS_MONDAY 1
#define IDS_TUESDAY 2
#define IDS_WEDNESDAY 3
Code: Select all
#include "resource.rh"
STRINGTABLE
{
IDS_MONDAY, "Montag"
IDS_TUESDAY, "Dienstag"
IDS_WEDNESDAY, "Mittwoch"
}
Same approach may be used for other types of resources (icons, bitmaps, etc.) to get rid of hard-coded constants.
PS: I know I might have used symbolic names for resources, but...