Libreoffice Latvian format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Eike,

When cleaning LO profile and starting Calc then tools/options/languages, I noticed this log:

lv-LV requested
lv-LV loaded

warn:unotools.i18n:128132:128132:unotools/source/i18n/localedatawrapper.cxx:1529: LocaleDataWrapper::scanDateOrder: no magic applicable

By adding some debug, I found it was:

"

rCode=YYYY. "gada" DD. MMMM, NNNN

LocaleDataWrapper::scanDateOrder: no magic applicable nDay=13 nMonth=17 nYear=0
lv-LV requested
lv-LV loaded
warn:unotools.i18n:128132:128132:unotools/source/i18n/localedatawrapper.cxx:1529: LocaleDataWrapper::scanDateOrder: no magic applicable nDay=13 nMonth=17 nYear=0

"

i18npool/source/localedata/data/lv_LV.xml contains:

    110     <FormatElement msgid="DateFormatskey9" default="true" type="long" usage="DATE" formatindex="19">
    111       <FormatCode>YYYY. "gada" DD. MMMM, NNNN</FormatCode>
    112     </FormatElement>

    143     <FormatElement msgid="DateFormatskey15" default="false" type="long" usage="DATE" formatindex="30">
    144       <FormatCode>NNNN, YYYY. "gada" DD. MMMM</FormatCode>
    145     </FormatElement>

Taking a look at https://www.localeplanet.com/icu/lv-LV/index.html, I saw these formats:

Date.3     Example: 03.05.21
Pattern: dd.MM.yy
Local Pattern: dd.MM.yy

Date.2     Example: 2021. gada 3. maijs
Pattern: y. 'gada' d. MMM
Local Pattern: y. 'gada' d. MMM

Date.1     Example: 2021. gada 3. maijs
Pattern: y. 'gada' d. MMMM
Local Pattern: y. 'gada' d. MMMM

Date.0     Example: pirmdiena, 2021. gada 3. maijs
Pattern: EEEE, y. 'gada' d. MMMM
Local Pattern: EEEE, y. 'gada' d. MMMM

So I thought about this patch:

diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index e0e91bbbac79..5ba530de2668 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -780,6 +780,12 @@ DateOrder LocaleDataWrapper::scanDateOrderImpl( const OUString& rCode ) const
         return DateOrder::YMD;
     else
     {
+        // lv_LV can use:
+        // - YYYY. "gada" DD. MMMM, NNNN
+        // - NNNN, YYYY. "gada" DD. MMMM
+        if ( nYear <= nDay && nDay << nMonth && rCode.indexOf('g') != -1)
+            return DateOrder::YDM;
+
         if (areChecksEnabled())
         {
             outputCheckMessage( appendLocaleInfo( "LocaleDataWrapper::scanDateOrder: no magic applicable" ) );

but DateOrder::YDM doesn't exist:

48  enum class DateOrder {
49      Invalid = -1,
50      MDY = 0,
51      DMY,
52      YMD,
53  };
See https://opengrok.libreoffice.org/xref/core/include/unotools/localedatawrapper.hxx?r=86b345a9&mo=1897&fi=48#48

Any thoughts here? Should I add this other DateOrder const?

Regards,

Julien

_______________________________________________
LibreOffice mailing list
LibreOffice@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/libreoffice




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux