* update (not-so-)optional package ICU to 4.8.1, which contains interesting stuff

for message formatting
* adjust LocaleKit to use namespace 'icu', as ICU has been configured to no longer
  use a version specific namespace
* adjust LocaleKit to general API changes in ICU 4.8
Note: all software using ICU (like WebPositive) needs to be rebuilt!
Note: the ICU package for PPC needs to be updated before it can be used!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42638 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe 2011-08-18 22:13:06 +00:00
parent fcb8a5cb4e
commit 45f2f22b52
18 changed files with 72 additions and 76 deletions

View File

@ -56,10 +56,12 @@ if $(HAIKU_BUILD_FEATURE_SSL) {
# ICU
# Note ICU isn't actually optional, but is still an external package
HAIKU_ICU_GCC_2_PACKAGE = icu-4.4.1-r1a3-x86-gcc2-2011-05-29.zip ;
HAIKU_ICU_GCC_4_PACKAGE = icu-4.4.1-r1a3-x86-gcc4-2011-05-29.zip ;
HAIKU_ICU_GCC_2_PACKAGE = icu-4.8.1-x86-gcc2-2011-08-18.zip ;
HAIKU_ICU_GCC_4_PACKAGE = icu-4.8.1-x86-gcc4-2011-08-18.zip ;
HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1-2011-08-18.zip ;
# TODO: this needs to be upgraded before ICU can be used on PPC!
HAIKU_ICU_PPC_PACKAGE = icu-4.4.1-ppc-2010-08-17.zip ;
HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.4.1-2010-07-26.zip ;
if $(TARGET_ARCH) = ppc {
local icu_package = $(HAIKU_ICU_PPC_PACKAGE) ;
@ -105,13 +107,20 @@ if $(TARGET_ARCH) = ppc {
# extract libraries
HAIKU_ICU_LIBS = [ ExtractArchive $(HAIKU_ICU_DIR)
:
libicudata.so.44
libicui18n.so.44
libicuio.so.44
libicule.so.44
libiculx.so.44
libicutu.so.44
libicuuc.so.44
libicudata.so.48
libicudata.so.48.1
libicui18n.so.48
libicui18n.so.48.1
libicuio.so.48
libicuio.so.48.1
libicule.so.48
libicule.so.48.1
libiculx.so.48
libiculx.so.48.1
libicutu.so.48
libicutu.so.48.1
libicuuc.so.48
libicuuc.so.48.1
: $(zipFile)
: extracted-icu
] ;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2003-2010, Haiku, Inc.
* Copyright 2003-2011, Haiku, Inc.
* Distributed under the terms of the MIT Licence.
*/
#ifndef _COLLATOR_H_
@ -10,7 +10,7 @@
#include <SupportDefs.h>
namespace icu_44 {
namespace icu {
class Collator;
class RuleBasedCollator;
};
@ -75,7 +75,7 @@ public:
private:
status_t _SetStrength(int8 strength) const;
mutable icu_44::Collator* fICUCollator;
mutable icu::Collator* fICUCollator;
int8 fDefaultStrength;
bool fIgnorePunctuation;
};

View File

@ -1,5 +1,5 @@
/*
* Copyright 2003-2010, Haiku, Inc.
* Copyright 2003-2011, Haiku, Inc.
* Distributed under the terms of the MIT Licence.
*/
#ifndef _COUNTRY_H_
@ -16,7 +16,7 @@ class BBitmap;
class BLanguage;
class BMessage;
namespace icu_44 {
namespace icu {
class DateFormat;
class Locale;
}
@ -45,7 +45,7 @@ public:
private:
friend class Private;
icu_44::Locale* fICULocale;
icu::Locale* fICULocale;
};

View File

@ -1,5 +1,5 @@
/*
* Copyright 2010, Haiku, Inc.
* Copyright 2010-2011, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _B_DURATION_FORMAT_H_
@ -13,7 +13,7 @@
class BTimeZone;
namespace icu_44 {
namespace icu {
class GregorianCalendar;
}
@ -42,7 +42,7 @@ public:
private:
BString fSeparator;
BTimeUnitFormat fTimeUnitFormat;
icu_44::GregorianCalendar* fCalendar;
icu::GregorianCalendar* fCalendar;
};

View File

@ -1,5 +1,5 @@
/*
* Copyright 2003-2010, Haiku, Inc.
* Copyright 2003-2011, Haiku, Inc.
* Distributed under the terms of the MIT Licence.
*/
#ifndef _FORMATTING_CONVENTIONS_H_
@ -17,7 +17,7 @@ class BBitmap;
class BLanguage;
class BMessage;
namespace icu_44 {
namespace icu {
class DateFormat;
class Locale;
}
@ -122,7 +122,7 @@ private:
bool fUseStringsFromPreferredLanguage;
icu_44::Locale* fICULocale;
icu::Locale* fICULocale;
};

View File

@ -15,7 +15,7 @@ class BBitmap;
// We must not include the icu headers in there as it could mess up binary
// compatibility.
namespace icu_44 {
namespace icu {
class Locale;
}
@ -64,7 +64,7 @@ private:
friend class Private;
uint8 fDirection;
icu_44::Locale* fICULocale;
icu::Locale* fICULocale;
};

View File

@ -1,5 +1,5 @@
/*
* Copyright 2003-2010, Haiku, Inc.
* Copyright 2003-2011, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _B_LOCALE_H_
@ -12,7 +12,7 @@
#include <Locker.h>
namespace icu_44 {
namespace icu {
class DateFormat;
}
@ -145,9 +145,9 @@ public:
BString* sortKey) const;
private:
icu_44::DateFormat* _CreateDateFormatter(
icu::DateFormat* _CreateDateFormatter(
const BString& format) const;
icu_44::DateFormat* _CreateTimeFormatter(
icu::DateFormat* _CreateTimeFormatter(
const BString& format) const;
mutable BLocker fLock;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2010, Haiku, Inc.
* Copyright 2010-2011, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _B_TIME_UNIT_FORMAT_H_
@ -12,7 +12,7 @@
class BString;
namespace icu_44 {
namespace icu {
class TimeUnitFormat;
}
@ -53,7 +53,7 @@ public:
) const;
private:
icu_44::TimeUnitFormat* fFormatter;
icu::TimeUnitFormat* fFormatter;
};

View File

@ -1,5 +1,5 @@
/*
* Copyright 2010, Haiku, Inc. All rights reserved.
* Copyright 2010-2011, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _TIME_ZONE_H
@ -9,7 +9,7 @@
#include <String.h>
namespace icu_44 {
namespace icu {
class Locale;
class TimeZone;
}
@ -46,8 +46,8 @@ public:
private:
friend class Private;
icu_44::TimeZone* fICUTimeZone;
icu_44::Locale* fICULocale;
icu::TimeZone* fICUTimeZone;
icu::Locale* fICULocale;
status_t fInitStatus;
mutable uint32 fInitializedFields;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2010, Oliver Tappe <zooey@hirschkaefer.de>
* Copyright 2010-2011, Oliver Tappe <zooey@hirschkaefer.de>
* Distributed under the terms of the MIT License.
*/
#ifndef _FORMATTING_CONVENTIONS_PRIVATE_H
@ -23,7 +23,7 @@ public:
fFormattingConventions = conventions;
}
icu_44::Locale*
icu::Locale*
ICULocale()
{
return fFormattingConventions->fICULocale;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2010, Oliver Tappe <zooey@hirschkaefer.de>
* Copyright 2010-2011, Oliver Tappe <zooey@hirschkaefer.de>
* Distributed under the terms of the MIT License.
*/
#ifndef _LANGUAGE_PRIVATE_H
@ -23,7 +23,7 @@ public:
fLanguage = language;
}
icu_44::Locale*
icu::Locale*
ICULocale()
{
return fLanguage->fICULocale;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2010, Oliver Tappe <zooey@hirschkaefer.de>
* Copyright 2010-2011, Oliver Tappe <zooey@hirschkaefer.de>
* Distributed under the terms of the MIT License.
*/
#ifndef _TIME_ZONE_PRIVATE_H
@ -23,7 +23,7 @@ public:
fTimeZone = timeZone;
}
icu_44::TimeZone*
icu::TimeZone*
ICUTimeZone()
{
return fTimeZone->fICUTimeZone;

View File

@ -27,19 +27,16 @@
#include <stdlib.h>
#define ICU_VERSION icu_44
BCountry::BCountry(const char* countryCode)
:
fICULocale(new ICU_VERSION::Locale("", countryCode))
fICULocale(new icu::Locale("", countryCode))
{
}
BCountry::BCountry(const BCountry& other)
:
fICULocale(new ICU_VERSION::Locale(*other.fICULocale))
fICULocale(new icu::Locale(*other.fICULocale))
{
}

View File

@ -1,7 +1,7 @@
/*
* Copyright 2003-2009, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2009-2010, Adrien Destugues, pulkomandy@gmail.com.
* Copyright 2010, Oliver Tappe <zooey@hirschkaefer.de>.
* Copyright 2010-2011, Oliver Tappe <zooey@hirschkaefer.de>.
* Distributed under the terms of the MIT License.
*/
@ -32,9 +32,6 @@
#include <stdlib.h>
#define ICU_VERSION icu_44
// #pragma mark - helpers
@ -191,7 +188,7 @@ BFormattingConventions::BFormattingConventions(const char* id)
fCachedUse24HourClock(CLOCK_HOURS_UNSET),
fExplicitUse24HourClock(CLOCK_HOURS_UNSET),
fUseStringsFromPreferredLanguage(false),
fICULocale(new ICU_VERSION::Locale(id))
fICULocale(new icu::Locale(id))
{
}
@ -206,7 +203,7 @@ BFormattingConventions::BFormattingConventions(
fExplicitMonetaryFormat(other.fExplicitMonetaryFormat),
fExplicitUse24HourClock(other.fExplicitUse24HourClock),
fUseStringsFromPreferredLanguage(other.fUseStringsFromPreferredLanguage),
fICULocale(new ICU_VERSION::Locale(*other.fICULocale))
fICULocale(new icu::Locale(*other.fICULocale))
{
for (int s = 0; s < B_DATE_FORMAT_STYLE_COUNT; ++s)
fCachedDateFormats[s] = other.fCachedDateFormats[s];
@ -227,7 +224,7 @@ BFormattingConventions::BFormattingConventions(const BMessage* archive)
{
BString conventionsID;
status_t status = archive->FindString("conventions", &conventionsID);
fICULocale = new ICU_VERSION::Locale(conventionsID);
fICULocale = new icu::Locale(conventionsID);
for (int s = 0; s < B_DATE_FORMAT_STYLE_COUNT && status == B_OK; ++s) {
BString format;

View File

@ -25,9 +25,6 @@
#include <unicode/locid.h>
#define ICU_VERSION icu_44
BLanguage::BLanguage()
:
fDirection(B_LEFT_TO_RIGHT),
@ -64,7 +61,7 @@ status_t
BLanguage::SetTo(const char* language)
{
delete fICULocale;
fICULocale = new ICU_VERSION::Locale(language);
fICULocale = new icu::Locale(language);
if (fICULocale == NULL)
return B_NO_MEMORY;

View File

@ -1,6 +1,6 @@
/*
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de.
** Copyright 2010, Oliver Tappe, zooey@hirschkaefer.de.
** Copyright 2010-2011, Oliver Tappe, zooey@hirschkaefer.de.
** All rights reserved. Distributed under the terms of the OpenBeOS License.
*/
@ -16,6 +16,8 @@
#include <MutableLocaleRoster.h>
#include <TimeZone.h>
#include <ICUWrapper.h>
#include <unicode/datefmt.h>
#include <unicode/dcfmtsym.h>
#include <unicode/decimfmt.h>
@ -23,14 +25,10 @@
#include <unicode/numfmt.h>
#include <unicode/smpdtfmt.h>
#include <unicode/ustring.h>
#include <ICUWrapper.h>
#include <vector>
#define ICU_VERSION icu_44
using BPrivate::ObjectDeleter;
using BPrivate::B_WEEK_START_MONDAY;
using BPrivate::B_WEEK_START_SUNDAY;
@ -268,7 +266,7 @@ BLocale::FormatDate(BString* string, int*& fieldPositions, int& fieldCount,
fieldPositions = NULL;
UErrorCode error = U_ZERO_ERROR;
ICU_VERSION::FieldPositionIterator positionIterator;
icu::FieldPositionIterator positionIterator;
UnicodeString icuString;
dateFormatter->format((UDate)time * 1000, icuString, &positionIterator,
error);
@ -276,7 +274,7 @@ BLocale::FormatDate(BString* string, int*& fieldPositions, int& fieldCount,
if (error != U_ZERO_ERROR)
return B_ERROR;
ICU_VERSION::FieldPosition field;
icu::FieldPosition field;
std::vector<int> fieldPosStorage;
fieldCount = 0;
while (positionIterator.next(field)) {
@ -315,7 +313,7 @@ BLocale::GetDateFields(BDateElement*& fields, int& fieldCount,
fields = NULL;
UErrorCode error = U_ZERO_ERROR;
ICU_VERSION::FieldPositionIterator positionIterator;
icu::FieldPositionIterator positionIterator;
UnicodeString icuString;
time_t now;
dateFormatter->format((UDate)time(&now) * 1000, icuString,
@ -324,7 +322,7 @@ BLocale::GetDateFields(BDateElement*& fields, int& fieldCount,
if (U_FAILURE(error))
return B_ERROR;
ICU_VERSION::FieldPosition field;
icu::FieldPosition field;
std::vector<int> fieldPosStorage;
fieldCount = 0;
while (positionIterator.next(field)) {
@ -534,7 +532,7 @@ BLocale::FormatTime(BString* string, int*& fieldPositions, int& fieldCount,
fieldPositions = NULL;
UErrorCode error = U_ZERO_ERROR;
ICU_VERSION::FieldPositionIterator positionIterator;
icu::FieldPositionIterator positionIterator;
UnicodeString icuString;
timeFormatter->format((UDate)time * 1000, icuString, &positionIterator,
error);
@ -542,7 +540,7 @@ BLocale::FormatTime(BString* string, int*& fieldPositions, int& fieldCount,
if (error != U_ZERO_ERROR)
return B_ERROR;
ICU_VERSION::FieldPosition field;
icu::FieldPosition field;
std::vector<int> fieldPosStorage;
fieldCount = 0;
while (positionIterator.next(field)) {
@ -580,7 +578,7 @@ BLocale::GetTimeFields(BDateElement*& fields, int& fieldCount,
fields = NULL;
UErrorCode error = U_ZERO_ERROR;
ICU_VERSION::FieldPositionIterator positionIterator;
icu::FieldPositionIterator positionIterator;
UnicodeString icuString;
time_t now;
timeFormatter->format((UDate)time(&now) * 1000, icuString,
@ -589,7 +587,7 @@ BLocale::GetTimeFields(BDateElement*& fields, int& fieldCount,
if (error != U_ZERO_ERROR)
return B_ERROR;
ICU_VERSION::FieldPosition field;
icu::FieldPosition field;
std::vector<int> fieldPosStorage;
fieldCount = 0;
while (positionIterator.next(field)) {
@ -651,7 +649,7 @@ BLocale::FormatNumber(BString* string, double value) const
UErrorCode err = U_ZERO_ERROR;
ObjectDeleter<NumberFormat> numberFormatter(NumberFormat::createInstance(
*BFormattingConventions::Private(&fConventions).ICULocale(),
NumberFormat::kNumberStyle, err));
UNUM_DECIMAL, err));
if (numberFormatter.Get() == NULL)
return B_NO_MEMORY;
@ -691,7 +689,7 @@ BLocale::FormatNumber(BString* string, int32 value) const
UErrorCode err = U_ZERO_ERROR;
ObjectDeleter<NumberFormat> numberFormatter(NumberFormat::createInstance(
*BFormattingConventions::Private(&fConventions).ICULocale(),
NumberFormat::kNumberStyle, err));
UNUM_DECIMAL, err));
if (numberFormatter.Get() == NULL)
return B_NO_MEMORY;

View File

@ -316,7 +316,7 @@ TimeZoneView::_BuildZoneMenu()
BString region(zoneID, slashPos);
if (region == B_TRANSLATE("Etc"))
if (region == "Etc")
region = kOtherRegion;
else if (countryName.Length() == 0) {
// skip global timezones from other regions, we are just
@ -324,7 +324,6 @@ TimeZoneView::_BuildZoneMenu()
continue;
}
// just accept timezones from "proper" regions, others are aliases
ZoneItemMap::iterator regionIter = zoneMap.find(region);
if (regionIter == zoneMap.end())

View File

@ -44,8 +44,7 @@ ICUNumericData::SetTo(const Locale& locale, const char* posixLocaleName)
if (result == B_OK) {
UErrorCode icuStatus = U_ZERO_ERROR;
DecimalFormat* numberFormat = dynamic_cast<DecimalFormat*>(
NumberFormat::createInstance(locale, DecimalFormat::kNumberStyle,
icuStatus));
NumberFormat::createInstance(locale, UNUM_DECIMAL, icuStatus));
if (!U_SUCCESS(icuStatus))
return B_UNSUPPORTED;
if (!numberFormat)