diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-12-05 19:29:07 +0100 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-12-05 19:29:07 +0100 |
commit | 8d669bc21b9d1976842ba8252d2f0fb953160bdd (patch) | |
tree | 63e5a53c8ff9c4cdff33070e177eda653922f28a /shell/source/tools | |
parent | f232b25c1eceb8e1c32cfd917d666b3a16b14405 (diff) | |
parent | 875ac20478f16e5107acb222c0b851b99d2e0f27 (diff) |
merge to m67
Diffstat (limited to 'shell/source/tools')
-rw-r--r-- | shell/source/tools/lngconvex/lngconvex.cxx | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/shell/source/tools/lngconvex/lngconvex.cxx b/shell/source/tools/lngconvex/lngconvex.cxx index 807d65f6700b..f605d6f340d9 100644 --- a/shell/source/tools/lngconvex/lngconvex.cxx +++ b/shell/source/tools/lngconvex/lngconvex.cxx @@ -58,6 +58,7 @@ #include <sstream> #include <iterator> #include <algorithm> +#include <string> namespace /* private */ { @@ -317,6 +318,8 @@ private: iso_lang_identifier active_iso_lang_; }; +typedef std::map< unsigned short , std::string , std::less< unsigned short > > shortmap; + //########################################### void add_group_entries( Config& aConfig, @@ -327,21 +330,35 @@ void add_group_entries( aConfig.SetGroup(GroupName); size_t key_count = aConfig.GetKeyCount(); + shortmap map; for (size_t i = 0; i < key_count; i++) { ByteString iso_lang = aConfig.GetKeyName(sal::static_int_cast<USHORT>(i)); ByteString key_value_utf8 = aConfig.ReadKey(sal::static_int_cast<USHORT>(i)); + iso_lang_identifier myiso_lang( iso_lang ); + LanguageType ltype = MsLangId::convertIsoNamesToLanguage(myiso_lang.language(), myiso_lang.country()); + if( ( ltype & 0x0200 ) == 0 && map[ ltype ].empty() ) + { + Substitutor.set_language(iso_lang_identifier(iso_lang)); - Substitutor.set_language(iso_lang_identifier(iso_lang)); - - key_value_utf8.EraseLeadingAndTrailingChars('\"'); + key_value_utf8.EraseLeadingAndTrailingChars('\"'); - OUString key_value_utf16 = - rtl::OStringToOUString(key_value_utf8, RTL_TEXTENCODING_UTF8); + OUString key_value_utf16 = + rtl::OStringToOUString(key_value_utf8, RTL_TEXTENCODING_UTF8); - Substitutor.add_substitution( - GroupName.GetBuffer(), make_winrc_unicode_string(key_value_utf16)); + Substitutor.add_substitution( + GroupName.GetBuffer(), make_winrc_unicode_string(key_value_utf16)); + map[ static_cast<unsigned short>(ltype) ] = std::string( iso_lang.GetBuffer() ); + } + else + { + if( !map[ ltype ].empty() ) + { + printf("ERROR: Duplicated ms id %d found for the languages %s and %s !!!! This does not work in microsoft resources\nPlease remove one!\n", ltype , map[ ltype ].c_str() , iso_lang.GetBuffer()); + exit( -1 ); + } + } } } |