function ExcelLangID()
local oExcel
local aID := { ;
{ 1033, 2057, 10249, 4105, 9225, 14345, 6153, 8201, 5129, 13321, 7177, 11273, 12297 }, ;
{ 3082,1034,11274,16394,13322,9226,5130,7178,12298,17418,4106,18442,;
58378,2058,19466,6154,15370,10250,20490,21514,14346,8202 }, ;
{ 1036,2060,11276,3084,9228,12300,15372,5132,13324,6156,14348,58380,8204,10252,4108,7180 }, ;
{ 1046, 2070 }, ;
{ 1031,3079,5127,4103,2055 }, ;
{ 1040, 2064 }, ;
{ 1043 } }
// 1 English, 2 Spanish, 3 French, 4 Portuguese, 5 German, 6 Italian, 7 Dutch
if nExcelLangID == nil
oExcel := ExcelObj()
nExcelLangID := If( oExcel == nil, 0, oExcel:LanguageSettings:LanguageID( 2 ) )
nExcelLangNo := AScan( aID, { |a| AScan( a, nExcelLangID ) > 0 } )
TRY
cDecimalSeparator := oExcel:International[ 3 ]
cThousandsSeparator := oExcel:International[ 4 ]
cListSeparator := oExcel:International[ 5 ]
CATCH
END
endif
return nExcelLangID
//----------------------------------------------------------------------------//
function ExcelLang()
if nExcelLangNo == nil
ExcelLangID()
endif
return { 'en', 'es', 'fr', 'pt', 'de', 'it', 'nl' }[ Max( 1, nExcelLangNo ) ]
//----------------------------------------------------------------------------//
function ExcelTranslate( cFunc )
local cRet, nAt, cName
// 1 English, 2 Spanish, 3 French, 4 Portuguese, 5 German, 6 Italian, 7 Dutch
local aTranslates := { ;
{ "TRUE", "VERDADERO", "VRAI", "VERDADEIRO", "WAHR", "VERO", "WAAR" }, ;
{ "FALSE", "FALSO", "FAUX", "FALSO", "FALSCH", "FALSO", "ONWAAR" }, ;
{ "SUM(", "SUMA(", "SOMME(", "SOMA(", "SUMME(", "SOMMA(", "SOM(" }, ;
{ "SUBTOTAL(", "SUBTOTALES(", "SOUS.TOTAL(", "SUBTOTAL(", "TEILERGEBNIS(", "SUBTOTALE(", "SUBTOTAAL(" }, ;
{ ',', ';', ';', ';', ';', ';', ';' } ;
}
if nExcelLangNo == nil
ExcelLangID()
endif
cFunc := Upper( cFunc )
cRet := cFunc
if nExcelLangNo > 1 .and. nExcelLangNo <= 7
// Translation required
cName := cFunc
if ( nAt := At( '(', cFunc ) ) > 0
cName := Left( cFunc, nAt )
endif
if ( nAt := AScan( aTranslates, { |a| a[ 1 ] == cName } ) ) > 0
cRet := StrTran( cFunc, cName, aTranslates[ nAt, nExcelLangNo ] )
endif
elseif nExcelLangNo != 1
if cRet == "TRUE"; cRet := "1=1"; endif
if cRet == "FALSE"; cRet := "1=0"; endif
endif
if cListSeparator != ','
cRet := StrTran( cRet, ',', cListSeparator )
endif
return cRet