Do Not Localize Strings Saved As Part of Your File Format

If you plan to use text strings as part of your file format, do not translate them. Rich Text Format (RTF) keywords—\bold, for example—are always in English. All language editions of applications that understand RTF can read RTF files; translating RTF keywords would be akin to creating a new file format. One of the cardinal rules of internationalization is to share a single file format among all language editions of a product.

Suppose, however, that your application makes use of keywords for the purpose of a macro or programming language. You want to localize all the keywords, but you also want each language edition of your program to be able to run macros created in any other language edition. One way to fulfill both requirements is to assign all of the keywords to an array. When the user saves a keyword in a document, the program saves the index to the keyword instead of the keyword itself. The indexes remain constant among all language editions of the program. When the user opens a document, the program simply accesses the array and displays the keywords in the language of the resources.

... in the .RC file ...
STRINGTABLE DISCARDABLE
BEGIN
IDS_MACRO_OPEN "Open"
IDS_MACRO_SAVE "Save"
IDS_MACRO_FIND "Find"
IDS_MACRO_COPY "Copy"
IDS_MACRO_PASTE "Paste"
END

... in the .RC file ...
#define iOpen 0
#define iSave 1
#define iFind 2
#define iCopy 3
#define iPaste 4

#define iMacroKeywdMax 5 // large enough to hold all keywords in
// all languages

char szMacroKeywords[cbMaxSz][iMacroKeywdMax]; // array declaration

// Load all keywords into the array.
InitMacroKeywords(szMacroKeywords);

while ((iKeyword = IReadKeywordFromFile()) != iEOF)
DisplayKeyword(szMacroKeyword[0][iKeyword]);

Visual Basic for Applications (VBA) uses another method for creating portable macros. VBA saves keywords and locale-sensitive information as text in the original language. It resolves these items against an application-defined dictionary. There is a separate dictionary for each language edition of VBA. Users need the dictionary from the appropriate language to interpret macros correctly.