I'm having a dialog based app written in VC++ using Visual Studio 6. It's a simple app with very few texts, but now those needs to support multiple languages. As it's not many texts, the plan is to add all the different languages into just one string table with a unique identifier. So now a sample string table looks like this,
STRINGTABLE
BEGIN
IDS_STRING_OK_BUTTON_ENG "OK" //English text
IDS_STRING_EXIT_BUTTON_ENG "Exit" //English text
IDS_STRING_OK_BUTTON_FRA "D'accord" //French text
IDS_STRING_EXIT_BUTTON_FRA "Sortie" //French text
END
Now i have a function that will return a string based on the OS language setting.
CString strLang = "";
//Retrieves the system default locale identifier
LCID lcid = GetSystemDefaultLCID();
//Determine the language identifier from the locale identifier
LANGID langid = LANGIDFROMLCID(lcid);
//Does many processing here........
//.................................
//.................................
// So if English is the OS language then this function will return "_ENG".
Now in another part of the code, this unique language ID is concatenated with another string to find the language specific text.
CString okButton = "IDS_STRING_OK_BUTTON" + m_strLanguageIndex; //Here m_strLanguageIndex for example will be "_ENG"
So this way, i can have just one string table with all different languages and then use the above method to create a unique resource ID.
But now the challenge is, the resource IDs in resource.h file are integers. So the above CString is of no use to find the corresponding the text.
So am not sure whether this is going to work. Am just throwing it out to see whether anyone has better ideas or have any suggestion to make the above method work.
I don't want to create multiple DLLs for every language as this is a simple dialog based app.