[PATCH] localedata fallbacks ...

Eike Rathke erack at redhat.com
Fri Dec 21 11:09:26 PST 2012


Hi Michael,

On Friday, 2012-12-21 17:07:18 +0000, Michael Meeks wrote:

> 	Was just reading this code for one reason and another, and stumbled
> across the gem the appended tries to fix; since I'm not 100% certain
> what it's supposed to be doing, I thought I'd ask a man that knows
> things :-)

For the case that the localeName argument passed to the function is
a language-only name, for example "en", it determines the fall-back
locale, i.e. a locale we know, in this case "en-US", so we can load
locale data of a known locale.

> presumably a loop-invariant condition that will evaluate to
> true for the first item - is great for en_US but ... of course, I'm
> suspicious that the code / fallback fundamentally doesn't work in more
> interesting ways ;-) 

Indeed, it doesn't ... and going back to some previous code of 2004
revealed that there was a similar condition but slightly different as
the code maintained it's own fall-back table, the change introducing the
new fall-back got the condition wrong.

>          if (localeName.equalsAscii(aLibTable[i].pLocale) ||
> -                (bFallback && localeName == aFallback))
> +            (bFallback && aFallback.equalsAscii(aLibTable[i].pLocale)))

Makes sense.
http://cgit.freedesktop.org/libreoffice/core/commit/?id=896e326ace53bedf9b17fa624d260032b91bcfd1
http://cgit.freedesktop.org/libreoffice/core/commit/?h=libreoffice-4-0&id=d3b7a2bfe2a95153134f340c5a13a467de95a0dd
http://cgit.freedesktop.org/libreoffice/core/commit/?h=libreoffice-3-6&id=e4fc7017ec672be095f1bc98c4f957de3c8ddae1

Thanks for spotting

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GnuPG key 0x293C05FD : 997A 4C60 CE41 0149 0DB3  9E96 2F1A D073 293C 05FD
Support the FSFE, care about Free Software! https://fsfe.org/support/?erack
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20121221/cc69f353/attachment.pgp>


More information about the LibreOffice mailing list