Loads a new spreadsheet and dumps ~2000 configuration values in a few seconds.
import uno
def getLocaleString(oL):
s = '-'
a = [oL.Language]
if oL.Country:a.append(oL.Country)
if oL.Variant:a.append(oL.Variant)
return s.join(a)
def printAllLocalesToNewSpreadSheet():
ctx = uno.getComponentContext()
smgr = ctx.ServiceManager
StarDesktop = smgr.createInstanceWithContext("com.sun.star.frame.Desktop", ctx)
oDoc = StarDesktop.loadComponentFromURL("private:factory/scalc","_default",0,tuple())
oNF = oDoc.getNumberFormats()
oSheet = oDoc.getSheets().getByIndex(0)
iEndCol = 255 # too much: oSheet.RangeAddress.EndColumn
i18n = smgr.createInstance("com.sun.star.i18n.LocaleData")
a = i18n.getAllInstalledLocaleNames()
cCols = 7
r = list()
r.append(("Locale","Language","Country","Decimal","Date","Time","1000","List"))
for i in a:
oInfo = i18n.getLanguageCountryInfo(i)
oItem = i18n.getLocaleItem(i)
b = (
getLocaleString(i),
oInfo.LanguageDefaultName,
oInfo.CountryDefaultName,
oItem.decimalSeparator,
oItem.dateSeparator,
oItem.timeSeparator,
oItem.thousandSeparator,
oItem.listSeparator
)
r.append(b)
rc = len(r)
nf = oNF.getStandardIndex(i)
oSheet.getCellRangeByPosition(0, rc-1, iEndCol, rc-1).NumberFormat = nf
oSheet.getCellRangeByPosition(0, 0, cCols, rc-1).setDataArray(tuple(r))
g_exportedScripts = (printAllLocalesToNewSpreadSheet,)