summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2018-05-30 17:28:17 +0200
committerLászló Németh <nemeth@numbertext.org>2018-06-08 18:00:20 +0200
commit32f1c56d8ff5e6f87dbcf086fd3743d6d36182bc (patch)
tree47d51358300a5f425fa0bd4b504af0866ab3b0eb /i18npool
parent4328d181b670356c9dbd69f1ec1dedb473b59e8e (diff)
tdf#115007: add import/export to NatNum12 (spell out numbers,
dates and money amounts, supporting all the XNumberText/libnumbertext formatting codes, for example "ordinal", "ordinal-number", "ordinal-feminine", etc., and ISO 4217 currency codes, also their possible combinations. NatNum12 formatting codes are stored by using the newly introduced (yet, loext:)transliteration-spellout attribute. creator-initials also added to token list Change-Id: I20f93c9d16778f142067a56d53b336d0acbe2d92 Reviewed-on: https://gerrit.libreoffice.org/54673 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx5
-rw-r--r--i18npool/source/nativenumber/nativenumbersupplier.cxx9
2 files changed, 8 insertions, 6 deletions
diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
index 45a222ce9efd..d363407c19fe 100644
--- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
+++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
@@ -642,12 +642,13 @@ DefaultNumberingProvider::makeNumberingString( const Sequence<beans::PropertyVal
locale = aLocale;
bCapitalize = true;
break;
- case TEXT_CARDINAL: // cardinal number names (one, two, three, ...)
+ case TEXT_CARDINAL: // cardinal number names (One, Two, Three, ...)
natNum = NativeNumberMode::NATNUM12;
+ sNatNumParams = "cardinal";
locale = aLocale;
bCapitalize = true;
break;
- case TEXT_ORDINAL: // ordinal number names (first, second, third, ...)
+ case TEXT_ORDINAL: // ordinal number names (First, Second, Third, ...)
natNum = NativeNumberMode::NATNUM12;
sNatNumParams = "ordinal";
locale = aLocale;
diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx
index 025cd0d897eb..5c5942ed987f 100644
--- a/i18npool/source/nativenumber/nativenumbersupplier.cxx
+++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx
@@ -597,9 +597,10 @@ OUString getNumberText(const Locale& rLocale, const OUString& rNumberString,
static auto xNumberText
= css::linguistic2::NumberText::create(comphelper::getProcessComponentContext());
- OUString numbertext_prefix = sNumberTextParams;
- if (!numbertext_prefix.isEmpty())
- numbertext_prefix += " ";
+ OUString numbertext_prefix;
+ // default "cardinal" gets empty prefix
+ if (sNumberTextParams != "cardinal")
+ numbertext_prefix = sNumberTextParams + " ";
// Several hundreds of headings could result typing lags because
// of the continuous update of the multiple number names during typing.
// We fix this by buffering the result of the conversion.
@@ -776,7 +777,7 @@ sal_Bool SAL_CALL NativeNumberSupplierService::isValidNatNum( const Locale& rLoc
switch (nNativeNumberMode) {
case NativeNumberMode::NATNUM0: // Ascii
case NativeNumberMode::NATNUM3: // Char, FullWidth
- case NativeNumberMode::NATNUM12: // Spell number
+ case NativeNumberMode::NATNUM12: // spell out numbers, dates and money amounts
return true;
case NativeNumberMode::NATNUM1: // Char, Lower
return (langnum >= 0);