[Libreoffice-commits] .: 2 commits - i18npool/source svl/source
Eike Rathke
erack at kemper.freedesktop.org
Wed Nov 23 03:30:24 PST 2011
i18npool/source/localedata/data/be_BY.xml | 62 ++++++++++++++++++++++++++++++
svl/source/numbers/zformat.cxx | 43 ++++++++++++++++----
2 files changed, 97 insertions(+), 8 deletions(-)
New commits:
commit e9f303624c26d548fa4581ffe87d3ffec3bf6c26
Author: Eike Rathke <erack at redhat.com>
Date: Wed Nov 23 12:28:11 2011 +0100
use cased month names only if no hard coded literal string follows
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index e4c347b..5ab0175 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -2948,37 +2948,64 @@ bool SvNumberformat::ImpGetTimeOutput(double fNumber,
/** If a day of month occurs within the format, the month name is in possessive
genitive case if the day follows the month, and partitive case if the day
precedes the month. If there is no day of month the nominative case (noun)
- is returned.
+ is returned. Also if the month is immediately preceded or followed by a
+ literal string other than space the nominative name is used, this prevents
+ duplicated casing for MMMM\t\a and such in documents imported from (e.g.
+ Finnish) Excel or older LibO/OOo releases.
*/
+
+// IDEA: instead of eCodeType pass the index to nTypeArray and restrict
+// inspection of month name around that one, that would enable different month
+// cases in one format. Though probably the most rare use case ever..
+
sal_Int32 SvNumberformat::ImpUseMonthCase( int & io_nState, const ImpSvNumFor& rNumFor, NfKeywordIndex eCodeType ) const
{
using namespace ::com::sun::star::i18n;
if (!io_nState)
{
- io_nState = 1;
bool bMonthSeen = false;
+ bool bDaySeen = false;
const ImpSvNumberformatInfo& rInfo = rNumFor.Info();
const sal_uInt16 nCount = rNumFor.GetCount();
- for ( sal_uInt16 i = 0; i < nCount && io_nState == 1; ++i )
+ for (sal_uInt16 i = 0; i < nCount && io_nState == 0; ++i)
{
- switch ( rInfo.nTypeArray[i] )
+ switch (rInfo.nTypeArray[i])
{
case NF_KEY_D :
case NF_KEY_DD :
- io_nState = (bMonthSeen ? 2 : 3); // and end loop
+ if (bMonthSeen)
+ io_nState = 2;
+ else
+ bDaySeen = true;
break;
case NF_KEY_MMM:
case NF_KEY_MMMM:
case NF_KEY_MMMMM:
- bMonthSeen = true;
+ {
+ xub_StrLen nLen;
+ if ((i < nCount-1 &&
+ rInfo.nTypeArray[i+1] == NF_SYMBOLTYPE_STRING &&
+ rInfo.sStrArray[i+1].GetChar(0) != ' ') ||
+ (i > 0 &&
+ rInfo.nTypeArray[i-1] == NF_SYMBOLTYPE_STRING &&
+ ((nLen = rInfo.sStrArray[i-1].Len()) > 0) &&
+ rInfo.sStrArray[i-1].GetChar(nLen-1) != ' '))
+ io_nState = 1;
+ else if (bDaySeen)
+ io_nState = 3;
+ else
+ bMonthSeen = true;
+ }
break;
}
}
+ if (io_nState == 0)
+ io_nState = 1; // no day of month
}
switch (io_nState)
{
case 1:
- // no day of month
+ // no day of month or forced nominative
switch (eCodeType)
{
case NF_KEY_MMM:
@@ -3017,7 +3044,7 @@ sal_Int32 SvNumberformat::ImpUseMonthCase( int & io_nState, const ImpSvNumFor& r
; // nothing
}
}
- OSL_FAIL( "ImpUseMonthCase: should not be reached");
+ OSL_FAIL( "ImpUseMonthCase: unhandled keyword index eCodeType");
return CalendarDisplayCode::LONG_MONTH_NAME;
}
commit 75a49370e6abef09d0e174dc87af33d2a29165be
Author: Yury Tarasievich <yury.tarasievich at gmail.com>
Date: Wed Nov 23 12:00:58 2011 +0100
added Belarusian [be-BY] genitive case month names
diff --git a/i18npool/source/localedata/data/be_BY.xml b/i18npool/source/localedata/data/be_BY.xml
index 70a2ed1..f866f46 100644
--- a/i18npool/source/localedata/data/be_BY.xml
+++ b/i18npool/source/localedata/data/be_BY.xml
@@ -285,6 +285,68 @@
<DefaultFullName>СнежанÑ</DefaultFullName>
</Month>
</MonthsOfYear>
+ <GenitiveMonths>
+ <Month>
+ <MonthID>jan</MonthID>
+ <DefaultAbbrvName>ÑÑÑ</DefaultAbbrvName>
+ <DefaultFullName>ÑÑÑдзенÑ</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>feb</MonthID>
+ <DefaultAbbrvName>лÑÑ</DefaultAbbrvName>
+ <DefaultFullName>лÑÑага</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>mar</MonthID>
+ <DefaultAbbrvName>Ñак</DefaultAbbrvName>
+ <DefaultFullName>ÑакавÑка</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>apr</MonthID>
+ <DefaultAbbrvName>кÑа</DefaultAbbrvName>
+ <DefaultFullName>кÑаÑавÑка</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>may</MonthID>
+ <DefaultAbbrvName>ÑÑа</DefaultAbbrvName>
+ <DefaultFullName>ÑÑаÑнÑ</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>jun</MonthID>
+ <DefaultAbbrvName>ÑÑÑ</DefaultAbbrvName>
+ <DefaultFullName>ÑÑÑвенÑ</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>jul</MonthID>
+ <DefaultAbbrvName>лÑп</DefaultAbbrvName>
+ <DefaultFullName>лÑпенÑ</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>aug</MonthID>
+ <DefaultAbbrvName>жнÑ</DefaultAbbrvName>
+ <DefaultFullName>жнÑÑнÑ</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>sep</MonthID>
+ <DefaultAbbrvName>веÑ</DefaultAbbrvName>
+ <DefaultFullName>веÑаÑнÑ</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>oct</MonthID>
+ <DefaultAbbrvName>каÑ</DefaultAbbrvName>
+ <DefaultFullName>каÑÑÑÑÑнÑка</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>nov</MonthID>
+ <DefaultAbbrvName>лÑÑ</DefaultAbbrvName>
+ <DefaultFullName>лÑÑÑапада</DefaultFullName>
+ </Month>
+ <Month>
+ <MonthID>dec</MonthID>
+ <DefaultAbbrvName>Ñне</DefaultAbbrvName>
+ <DefaultFullName>ÑнежнÑ</DefaultFullName>
+ </Month>
+ </GenitiveMonths>
<Eras>
<Era>
<EraID>bc</EraID>
More information about the Libreoffice-commits
mailing list