Decimal dot/point and Thousands separator on Linux

On MS Office I can choose which would be the decimal dot (for me is .), the thousands sep (for me could be either or no sep at all) and the list separator (for me could be either , or ; ) for the actual document, and also have a configuration to all the PC, I know this has something to do with the Locale of the OS, but also I can change those configuration.

In my Linux machine I change the Locale file to match my likings. But Libre Office do not seems to see it, and have no way to change that behavior in any of these variables.

I know I could change the language of the document, but any of them includes a Thousands Sep, which I do not wanna include, or the list sep doesn’t match.

I want to know if there is a way to change this behavior, or if it would be added in the future.

Tools>Options>LanguageSettings>Languages>Locale.
LibreOffice applies its own locale setting after reading the locale itself from the OS but not the locale settings.
English(UK), for instance, applies the point as decimal separator, slash as date separator and comma as thousands separator. In Calc formulas you can use semicolon or comma as list separator.

I do not want thousands sep, I want it to be a space or any at all. That is what I encounter.

Simply don’t use any thousands separator. It is completely optional.

I don’t get how to. Could you please guide me?

How to not use something?

Should be something like this in formatcode: # ### ##0

I set my Locale (es-ES) before installing LibreOffice to be Decimal Dot=. Thousands Sep= and List Sep=,. The whole system use it, but LibreOffice don’t. LibreOffice seems to use their own Locale config

All right, will test

That’s what I told you. LibreOffice uses its own set of locale settings. You can change the locale in the options dialog. Apply some non-US English and everything should be fine.

I get this orginal when changing the language to ES - just tested as you have answered. And if I set ES in Tools>Options>LanguageSettings>Languages>Locale, as @Villeroy wrote, it will work with a space when choosing “thousands separator”.

Locales with space as thousands separator are:
en-ZA
es-CR
fr-FR
fr-CA
fr-LU
fr-MC
fr-BF
fr-CI
fr-ML
fr-SN
fr-BJ
fr-NE
fr-TG
sv-SE
sv-FI
cs-CZ
sk-SK
fi-FI
no-NO
nn-NO
nb-NO
pl-PL
pt-PT
ru-RU
tt-RU
et-EE
vro-EE
lv-LV
uk-UA
bg-BG
ka-GE
be-BY
br-FR
cv-RU
oc-FR
ltg-LV
dsb-DE
cu-RU
szl-PL
ar-DZ
af-ZA
hu-HU
qlt-MN-mn-Cyrl-MN
az-AZ
eo
zu-ZA
nso-ZA
tn-ZA
xh-ZA
st-ZA
ss-ZA
ve-ZA
nr-ZA
ts-ZA
tg-TJ
ky-KG
kk-KZ
uz-UZ
ln-CD
hy-AM
tk-TM
mos-BF

However, the thousands-separator does not matter at all. If you enter your numbers without any TS, this separator has no influence on your actual numeric values.

Did you obtain that iterating over known locales? Looks like from a css::lang::Locale struct by just concatenating Language-Country-Variant. For which if the Language value is qlt that is a local-use language code (used by LibreOffice if the language tag can not be expressed by only ISO 639-1/3 and ISO 3166-1 alpha-2 codes), and the actual BCP 47 language tag is in the Variant field, here mn-Cyrl-MN. The Country field in this case may contain an ISO 3166 code if one is present in the language tag.
See also LibreOffice: Locale Struct Reference .

1 Like
import uno

class Office:
    '''Frequently used methods in office context'''
    def __init__(self, ctx=uno.getComponentContext()):
        self.ctx = ctx
        self.smgr = self.ctx.ServiceManager
        
    def createUnoService(self, service):
        return self.smgr.createInstance(service)

    def getDesktop(self):
        return self.smgr.createInstanceWithContext("com.sun.star.frame.Desktop",self.ctx)

    def getCurrentComponent(self):
        return self.getDesktop().getCurrentComponent()

    def getCurrentFrame(self):
        return self.getDesktop().getCurrentFrame()

    def getCurrentComponentWindow(self):
        return self.getCurrentFrame().getComponentWindow()

    def getCurrentContainerWindow(self):
        return self.getCurrentFrame().getContainerWindow()

    def getCurrentController(self):
        return self.getCurrentFrame().getController()

    def callMRI(self,obj=None):
        if not obj:
            obj = self.getCurrentController().getSelection()
        mri = self.createUnoService("mytools.Mri")
        mri.inspect(obj)

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():
    office = Office()
    StarDesktop = office.getDesktop()
    oDoc = StarDesktop.loadComponentFromURL("private:factory/scalc","_default",0,tuple())
    oNF = oDoc.getNumberFormats()
    oSheet = oDoc.getSheets().getByIndex(0)
    i18n = office.createUnoService("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, 255, rc-1).NumberFormat = nf
    oSheet.getCellRangeByPosition(0, 0, cCols, rc-1).setDataArray(tuple(r))

g_exportedScripts = (printAllLocalesToNewSpreadSheet,)
2 Likes