diff options
author | Kurt Zenker <kz@openoffice.org> | 2009-12-04 13:14:28 +0100 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2009-12-04 13:14:28 +0100 |
commit | 15c44d3dcdc0fbcebb2b5a573063e6b9ae9225cf (patch) | |
tree | 4a49c9b1ef9705f269aa191a467a1b394ddfdaea | |
parent | e498ea80702bba99caef311d2d1092f316134f2b (diff) | |
parent | 2c993660864d3e0ac89d9a88155827eaa88ecef5 (diff) |
CWS-TOOLING: integrate CWS localization37_DEV300
-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 7f177233d7cc..43fbd410dbe3 100644 --- a/shell/source/tools/lngconvex/lngconvex.cxx +++ b/shell/source/tools/lngconvex/lngconvex.cxx @@ -65,6 +65,7 @@ #include <sstream> #include <iterator> #include <algorithm> +#include <string> namespace /* private */ { @@ -324,6 +325,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, @@ -334,21 +337,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 ); + } + } } } |