We are trying to look at optimizing our localization testing.
Our QA group had a suggestion of a special mode to force all strings from the resources to be entirely contained of X. We already API hijack LoadString, and the MFC implementation of it, so doing it should not be a major hurdle.
My question is how would you solve the formatting issues?
Examples -
CString str ;
str . LoadString ( IDS_MYSTRING ) ;
where IDS_MYSTRING is "Hello World", should return "XXXXX XXXXX"
where IDS_MYSTRING is "Hello\nWorld", should return "XXXXX\nXXXXX"
where IDS_MYSTRING is "Hello%dWorld", should return "XXXXX%dXXXXX"
where IDS_MYSTRING is "Hello%.2fWorld", should return "XXXXX%.2fXXXXX"
where IDS_MYSTRING is "Hello%%World", should return "XXXXX%%XXXXX"
So in summary the string should work if used in a printf or Format statement, it should honor escape characters.
So this is a pure code question, C++/MFC,
CString ConvertStringToXXXX ( const CString& aSource )
{
CString lResult = aSource ;
// Insert your code here
return lResult ;
}
I know this could be done using tools on the .RC files, but we want to build English, then run like so -
application -L10NTEST