peiyongz 2002/12/12 15:40:39 Modified: c/tools/NLS/Xlat Xlat_ICUResourceBundle.cpp Xlat.cpp Log: normlize locale string. Revision Changes Path 1.3 +7 -23 xml-xerces/c/tools/NLS/Xlat/Xlat_ICUResourceBundle.cpp Index: Xlat_ICUResourceBundle.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/tools/NLS/Xlat/Xlat_ICUResourceBundle.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Xlat_ICUResourceBundle.cpp 5 Nov 2002 21:15:16 -0000 1.2 +++ Xlat_ICUResourceBundle.cpp 12 Dec 2002 23:40:38 -0000 1.3 @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.3 2002/12/12 23:40:38 peiyongz + * normlize locale string. + * * Revision 1.2 2002/11/05 21:15:16 peiyongz * generate correct <locale>.txt file * @@ -210,28 +213,9 @@ const unsigned int bufSize = 4095; XMLCh tmpBuf[bufSize + 1]; - // - // we got to comform to locale specs - // that is en_US - // - XMLCh tempLocale[bufSize+1]; - XMLCh tempLan[64]; - int lang_end = XMLString::indexOf(locale, chUnderscore); - if (lang_end != -1) - { - XMLString::subString(tempLan, locale, 0, lang_end); - tempLan[lang_end] = 0; - XMLString::lowerCase(tempLan); - XMLString::copyString(tempLocale, tempLan); - tempLocale[lang_end] = 0; - XMLString::catString(&(tempLocale[lang_end]), &(locale[lang_end])); - } - else - { - XMLString::copyString(tempLocale, locale); - } - swprintf(tmpBuf, L"%s/%s.txt", outPath, tempLocale); + + swprintf(tmpBuf, L"%s/%s.txt", outPath, locale); fOutFl = _wfopen(tmpBuf, L"wt"); if (!fOutFl) { @@ -240,6 +224,6 @@ } // Set the message delimiter - fwprintf(fOutFl, L"%s { \n", tempLocale); + fwprintf(fOutFl, L"%s { \n", locale); } 1.16 +26 -1 xml-xerces/c/tools/NLS/Xlat/Xlat.cpp Index: Xlat.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/tools/NLS/Xlat/Xlat.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- Xlat.cpp 12 Nov 2002 17:24:58 -0000 1.15 +++ Xlat.cpp 12 Dec 2002 23:40:39 -0000 1.16 @@ -57,6 +57,9 @@ /* * $Log$ + * Revision 1.16 2002/12/12 23:40:39 peiyongz + * normlize locale string. + * * Revision 1.15 2002/11/12 17:24:58 tng * DOM Message: add new domain for DOM Messages. * @@ -503,10 +506,32 @@ const unsigned int count = msgSetList->getLength(); // + // Normalize locale string + // + // locale = ll[[_CC][_VARIANT]] + // where ll is language code + // CC is country code + // VARIANT is variant code + // + XMLCh normalizedLocale[256]; + + normalizedLocale[0] = localeStr[0]; + normalizedLocale[1] = localeStr[1]; + normalizedLocale[2] = 0; + XMLString::lowerCase(normalizedLocale); + + if (XMLString::stringLen(localeStr) > 2) + { + XMLString::catString(&(normalizedLocale[2]), &(localeStr[2])); + XMLString::upperCase(&(normalizedLocale[2])); + } + + // // Ok, its good enough to get started. So lets call the start output // method on the formatter. // - formatter->startOutput(localeStr, gOutPath); + + formatter->startOutput(normalizedLocale, gOutPath); // // For each message domain element, we call start and end domain
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]