Lines 993-998
Link Here
|
993 |
} |
993 |
} |
994 |
|
994 |
|
995 |
// ----------------------------------------------------------------------- |
995 |
// ----------------------------------------------------------------------- |
|
|
996 |
|
997 |
struct IsoLangGLIBCModifiersEntry |
998 |
{ |
999 |
LanguageType mnLang; |
1000 |
sal_Char maLangStr[4]; |
1001 |
sal_Char maCountry[3]; |
1002 |
sal_Char maAtString[9]; |
1003 |
}; |
1004 |
|
1005 |
static IsoLangGLIBCModifiersEntry const aImplIsoLangGLIBCModifiersEntries[] = |
1006 |
{ |
1007 |
// MS-LANGID codes ISO639-1/2/3 ISO3166 glibc modifier |
1008 |
{ LANGUAGE_BOSNIAN_CYRILLIC_BOSNIA_HERZEGOVINA, "bs", "BA", "cyrillic" }, |
1009 |
{ LANGUAGE_USER_SERBIAN_LATIN_SERBIA, "sr", "RS", "latin" }, // Serbian Latin in Serbia |
1010 |
{ LANGUAGE_SERBIAN_LATIN, "sr", "CS", "latin" }, // Serbian Latin in Serbia and Montenegro |
1011 |
{ LANGUAGE_USER_SERBIAN_LATIN_MONTENEGRO, "sr", "ME", "latin" }, // Serbian Latin in Montenegro |
1012 |
{ LANGUAGE_SERBIAN_LATIN_NEUTRAL, "sr", "", "latin" }, |
1013 |
{ LANGUAGE_AZERI_CYRILLIC, "az", "AZ", "cyrillic" }, |
1014 |
{ LANGUAGE_UZBEK_CYRILLIC, "uz", "UZ", "cyrillic" }, |
1015 |
{ LANGUAGE_DONTKNOW, "", "", "" } // marks end of table |
1016 |
}; |
1017 |
|
996 |
// convert a unix locale string into LanguageType |
1018 |
// convert a unix locale string into LanguageType |
997 |
|
1019 |
|
998 |
// static |
1020 |
// static |
Lines 1001-1015
Link Here
|
1001 |
{ |
1023 |
{ |
1002 |
rtl::OString aLang; |
1024 |
rtl::OString aLang; |
1003 |
rtl::OString aCountry; |
1025 |
rtl::OString aCountry; |
|
|
1026 |
rtl::OString aAtString; |
1004 |
|
1027 |
|
1005 |
sal_Int32 nLangSepPos = rString.indexOf( (sal_Char)'_' ); |
1028 |
sal_Int32 nLangSepPos = rString.indexOf( (sal_Char)'_' ); |
1006 |
sal_Int32 nCountrySepPos = rString.indexOf( (sal_Char)'.' ); |
1029 |
sal_Int32 nCountrySepPos = rString.indexOf( (sal_Char)'.' ); |
|
|
1030 |
sal_Int32 nAtPos = rString.indexOf( (sal_Char)'@' ); |
1007 |
|
1031 |
|
1008 |
if (nCountrySepPos < 0) |
1032 |
if (nCountrySepPos < 0) |
1009 |
nCountrySepPos = rString.indexOf( (sal_Char)'@' ); |
1033 |
nCountrySepPos = nAtPos; |
1010 |
if (nCountrySepPos < 0) |
1034 |
if (nCountrySepPos < 0) |
1011 |
nCountrySepPos = rString.getLength(); |
1035 |
nCountrySepPos = rString.getLength(); |
1012 |
|
1036 |
|
|
|
1037 |
if (nAtPos >= 0) |
1038 |
aAtString = rString.copy( nAtPos+1 ); |
1039 |
|
1013 |
if ( ((nLangSepPos >= 0) && (nLangSepPos > nCountrySepPos)) |
1040 |
if ( ((nLangSepPos >= 0) && (nLangSepPos > nCountrySepPos)) |
1014 |
|| ((nLangSepPos < 0)) ) |
1041 |
|| ((nLangSepPos < 0)) ) |
1015 |
{ |
1042 |
{ |
Lines 1023-1028
Link Here
|
1023 |
aCountry = rString.copy( nLangSepPos+1, nCountrySepPos - nLangSepPos - 1); |
1050 |
aCountry = rString.copy( nLangSepPos+1, nCountrySepPos - nLangSepPos - 1); |
1024 |
} |
1051 |
} |
1025 |
|
1052 |
|
|
|
1053 |
// if there is a glibc modifier, first look for exact match in modifier table |
1054 |
if (aAtString.getLength()) |
1055 |
{ |
1056 |
// language is lower case in table |
1057 |
rtl::OString aLowerLang = aLang.toAsciiLowerCase(); |
1058 |
// country is upper case in table |
1059 |
rtl::OString aUpperCountry = aCountry.toAsciiUpperCase(); |
1060 |
const IsoLangGLIBCModifiersEntry* pGLIBCModifiersEntry = aImplIsoLangGLIBCModifiersEntries; |
1061 |
do |
1062 |
{ |
1063 |
if (( aLowerLang.equals( pGLIBCModifiersEntry->maLangStr ) ) && |
1064 |
( aAtString.equals( pGLIBCModifiersEntry->maAtString ) )) |
1065 |
{ |
1066 |
if ( !aUpperCountry.getLength() || |
1067 |
aUpperCountry.equals( pGLIBCModifiersEntry->maCountry ) ) |
1068 |
{ |
1069 |
return pGLIBCModifiersEntry->mnLang; |
1070 |
} |
1071 |
} |
1072 |
++pGLIBCModifiersEntry; |
1073 |
} |
1074 |
while ( pGLIBCModifiersEntry->mnLang != LANGUAGE_DONTKNOW ); |
1075 |
} |
1076 |
|
1026 |
return convertIsoNamesToLanguage( aLang, aCountry ); |
1077 |
return convertIsoNamesToLanguage( aLang, aCountry ); |
1027 |
} |
1078 |
} |
1028 |
|
1079 |
|