Applied patch by PulkoMandy, adjusted and extended by myself:

* integrating most of the locale kit into the build (and image)
* removed LocaleBuild.h and _IMPEXP_LOCALE since that does not make
  sense for elf (which usually exports all symbols anyway)
* added a couple of locale kit related pseudo targets for convenience
Hey, some of that stuff already seems to work :-)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30545 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe 2009-05-01 21:56:16 +00:00
parent 28b2684912
commit 723383c0f4
47 changed files with 258 additions and 257 deletions

19
Jamfile
View File

@ -132,6 +132,25 @@ Depends ScreenSaverKit :
Haiku
;
# Pseudo-target to build the locale kit only
NotFile LocaleKit ;
Depends LocaleKit :
liblocale.so
Locale
# binaries for building localized software on haiku
collectcatkeys
dumpcatalog
linkcatkeys
# addons
LocaleKitCollatorAddons
LocaleKitCatalogAddons
# tests
LocaleKitTests
;
# Evaluate optional package dependencies and prepare the optional build
# features before parsing the Jamfile tree.
include [ FDirName $(HAIKU_BUILD_RULES_DIR) OptionalPackageDependencies ] ;

View File

@ -29,9 +29,10 @@ if $(HAIKU_ATA_STACK) = 1 {
SYSTEM_BIN = "[" addattr alert arp base64 basename bash bc beep bootman bzip2
cal cat catattr checkfs chgrp chmod chop chown chroot cksum clear
clockconfig cmp comm compress copyattr CortexAddOnHost cp
clockconfig cmp collectcatkeys comm compress copyattr CortexAddOnHost cp
csplit ctags cut date dc dd desklink df diff diff3 dircolors dirname
draggers driveinfo dstcheck du echo eject env error expand expr
draggers driveinfo dstcheck du dumpcatalog
echo eject env error expand expr
factor false fdinfo ffm filepanel find finddir fmt fold fortune frcode
ftp ftpd
funzip fwcontrol
@ -39,7 +40,8 @@ SYSTEM_BIN = "[" addattr alert arp base64 basename bash bc beep bootman bzip2
id ident ideinfo idestatus ifconfig <bin>install installsound iroster
isvolume
join
keymap kill less lessecho lesskey link listarea listattr listimage listdev
keymap kill less lessecho lesskey link linkcatkeys listarea listattr
listimage listdev
listport listres listsem listusb ln locate logger login logname ls lsindex
makebootable md5sum merge mimeset mkdos mkdir mkfifo mkfs mkindex
modifiers mount mount_nfs mountvolume mv
@ -68,8 +70,8 @@ SYSTEM_APPS = AboutSystem ActivityMonitor CharacterMap CodyCam DeskCalc DiskProb
StyledEdit Terminal TextSearch TV Workspaces
;
SYSTEM_PREFERENCES = Appearance Backgrounds CPUFrequency DataTranslations E-mail
FileTypes Fonts Keyboard Keymap Media Menu Mouse Network Printers Screen
ScreenSaver Sounds Time Touchpad <preference>Tracker VirtualMemory
FileTypes Fonts Keyboard Keymap Locale Media Menu Mouse Network Printers
Screen ScreenSaver Sounds Time Touchpad <preference>Tracker VirtualMemory
;
SYSTEM_DEMOS = BSnow Chart Clock Cortex FontDemo
GLDirectMode GLTeapot Mandelbrot Pairs
@ -80,7 +82,7 @@ SYSTEM_LIBS = libbe.so $(HAIKU_LIBSTDC++) libmedia.so libtracker.so
libmail.so libtextencoding.so libz.so libfreetype.so libpng.so libmidi.so
libmidi2.so libdevice.so libgame.so libscreensaver.so <revisioned>libroot.so
libGL.so libfluidsynth.so liblpsolve55.so liblinprog.so libalm.so
libilmimf.so libiconv.so
libilmimf.so libiconv.so liblocale.so
;
SYSTEM_SERVERS = registrar debug_server syslog_daemon media_server
net_server media_addon_server input_server app_server fake_app_server
@ -346,6 +348,11 @@ SEARCH on $(spellFiles)
= [ FDirName $(HAIKU_TOP) src apps mail ] ;
AddFilesToHaikuImage system etc word_dictionary : $(spellFiles) ;
# Locale kit language files
local languageDir = [ FDirName $(HAIKU_TOP) src data etc locale languages ] ;
local languages = [ Glob $(languageDir) : *.language ] ;
AddFilesToHaikuImage system etc locale languages : $(languages) ;
local etcFiles = bash_completion inputrc profile teapot.data ;
etcFiles = $(etcFiles:G=etc) ;
SEARCH on $(etcFiles) = [ FDirName $(HAIKU_TOP) data etc ] ;

View File

@ -1,8 +1,6 @@
#ifndef _CATALOG_H_
#define _CATALOG_H_
#include <LocaleBuild.h>
#include <SupportDefs.h>
#include <String.h>
@ -12,7 +10,7 @@ class BMessage;
struct entry_ref;
class _IMPEXP_LOCALE BCatalog {
class BCatalog {
public:
BCatalog();
@ -51,8 +49,8 @@ class _IMPEXP_LOCALE BCatalog {
};
extern _IMPEXP_LOCALE BCatalog* be_catalog;
extern _IMPEXP_LOCALE BCatalog* be_app_catalog;
extern BCatalog* be_catalog;
extern BCatalog* be_app_catalog;
#ifndef B_AVOID_TRANSLATION_MACROS
@ -60,22 +58,22 @@ extern _IMPEXP_LOCALE BCatalog* be_app_catalog;
// you don't want these:
#undef TR_CONTEXT
// In a single application, several strings (e.g. 'Ok') will be used
// more than once, in different contexts.
// In a single application, several strings (e.g. 'Ok') will be used
// more than once, in different contexts.
// As the application programmer can not know if all translations of
// this string will be the same for all languages, each occurrence of
// the string must be translated on its own.
// Specifying the context explicitly with each string allows the person
// translating a catalog to separate these different occurrences of the
// same string and tell which strings appears in what context of the
// same string and tell which strings appears in what context of the
// application.
// In order to give the translator a useful hint, the application
// programmer needs to define TR_CONTEXT with the context he'd like
// programmer needs to define TR_CONTEXT with the context he'd like
// to be associated with the strings used in this specifc source file.
// example:
// #define TR_CONTEXT "Folder-Window"
// Tip: Use a descriptive name of the class implemented in that
// source-file.
// Tip: Use a descriptive name of the class implemented in that
// source-file.
// Translation macros which may be used to shorten translation requests:
@ -112,7 +110,7 @@ extern _IMPEXP_LOCALE BCatalog* be_app_catalog;
for (char **ch = choices; *ch; ch++) {
menu->AddItem(
new BMenuItem(
TR(*ch),
TR(*ch),
new BMessage(...)
)
)
@ -130,25 +128,25 @@ extern _IMPEXP_LOCALE BCatalog* be_app_catalog;
#undef TR_MARK_ALL
#define TR_MARK_ALL(str,ctx,cmt) \
BCatalogAddOn::MarkForTranslation((str), (ctx), (cmt))
#undef TR_MARK_ID
#define TR_MARK_ID(id) \
BCatalogAddOn::MarkForTranslation((id))
#endif /* B_AVOID_TRANSLATION_MACROS */
/************************************************************************/
// For BCatalog add-on implementations:
class _IMPEXP_LOCALE BCatalogAddOn {
class BCatalogAddOn {
friend class BLocaleRoster;
public:
BCatalogAddOn(const char *signature, const char *language,
int32 fingerprint);
virtual ~BCatalogAddOn();
virtual const char *GetString(const char *string,
virtual const char *GetString(const char *string,
const char *context=NULL,
const char *comment=NULL) = 0;
virtual const char *GetString(uint32 id) = 0;
@ -157,14 +155,14 @@ class _IMPEXP_LOCALE BCatalogAddOn {
BCatalogAddOn *Next();
// the following could be used to localize non-textual data (e.g. icons),
// but these will only be implemented if there's demand for such a
// but these will only be implemented if there's demand for such a
// feature:
virtual bool CanHaveData() const;
virtual status_t GetData(const char *name, BMessage *msg);
virtual status_t GetData(uint32 id, BMessage *msg);
// interface for catalog-editor-app and testing apps:
virtual status_t SetString(const char *string,
virtual status_t SetString(const char *string,
const char *translated,
const char *context=NULL,
const char *comment=NULL);
@ -187,7 +185,7 @@ class _IMPEXP_LOCALE BCatalogAddOn {
// magic marker functions which are used to mark a string/id
// which will be translated elsewhere in the code (where it can
// not be found since it is references by a variable):
static const char *MarkForTranslation(const char *str, const char *ctx,
static const char *MarkForTranslation(const char *str, const char *ctx,
const char *cmt);
static int32 MarkForTranslation(int32 id);
@ -199,29 +197,29 @@ class _IMPEXP_LOCALE BCatalogAddOn {
BString fLanguageName;
int32 fFingerprint;
BCatalogAddOn *fNext;
friend class BCatalog;
friend status_t get_add_on_catalog(BCatalog*, const char *);
};
// every catalog-add-on should export these symbols...
// ...the function that instantiates a catalog for this add-on-type...
extern "C" _IMPEXP_LOCALE
extern "C"
BCatalogAddOn *instantiate_catalog(const char *signature,
const char *language, int32 fingerprint);
// ...the function that creates an empty catalog for this add-on-type...
extern "C" _IMPEXP_LOCALE
extern "C"
BCatalogAddOn *create_catalog(const char *signature,
const char *language);
// ...and the priority which will be used to order the catalog-add-ons:
extern _IMPEXP_LOCALE uint8 gCatalogAddOnPriority;
extern uint8 gCatalogAddOnPriority;
/*
* BCatalog - inlines for trivial accessors:
*/
inline status_t
BCatalog::GetSignature(BString *sig)
BCatalog::GetSignature(BString *sig)
{
if (!sig)
return B_BAD_VALUE;
@ -232,8 +230,8 @@ BCatalog::GetSignature(BString *sig)
}
inline status_t
BCatalog::GetLanguage(BString *lang)
inline status_t
BCatalog::GetLanguage(BString *lang)
{
if (!lang)
return B_BAD_VALUE;
@ -241,11 +239,11 @@ BCatalog::GetLanguage(BString *lang)
return B_NO_INIT;
*lang = fCatalog->fLanguageName;
return B_OK;
}
}
inline status_t
BCatalog::GetFingerprint(int32 *fp)
inline status_t
BCatalog::GetFingerprint(int32 *fp)
{
if (!fp)
return B_BAD_VALUE;
@ -259,13 +257,13 @@ BCatalog::GetFingerprint(int32 *fp)
inline status_t
BCatalog::InitCheck() const
{
return fCatalog
? fCatalog->InitCheck()
return fCatalog
? fCatalog->InitCheck()
: B_NO_INIT;
}
inline int32
inline int32
BCatalog::CountItems() const
{
if (!fCatalog)
@ -275,7 +273,7 @@ BCatalog::CountItems() const
inline BCatalogAddOn *
BCatalog::CatalogAddOn()
BCatalog::CatalogAddOn()
{
return fCatalog;
}
@ -285,22 +283,22 @@ BCatalog::CatalogAddOn()
* BCatalogAddOn - inlines for trivial accessors:
*/
inline BCatalogAddOn *
BCatalogAddOn::Next()
BCatalogAddOn::Next()
{
return fNext;
}
inline const char *
BCatalogAddOn::MarkForTranslation(const char *str, const char *ctx,
const char *cmt)
BCatalogAddOn::MarkForTranslation(const char *str, const char *ctx,
const char *cmt)
{
return str;
}
inline int32
BCatalogAddOn::MarkForTranslation(int32 id)
BCatalogAddOn::MarkForTranslation(int32 id)
{
return id;
}
@ -311,14 +309,14 @@ namespace BPrivate {
/*
* EditableCatalog
*/
class _IMPEXP_LOCALE EditableCatalog : public BCatalog {
class EditableCatalog : public BCatalog {
public:
EditableCatalog(const char *type, const char *signature,
EditableCatalog(const char *type, const char *signature,
const char *language);
~EditableCatalog();
status_t SetString(const char *string,
status_t SetString(const char *string,
const char *translated,
const char *context=NULL,
const char *comment=NULL);

View File

@ -5,8 +5,6 @@
#include <SupportDefs.h>
#include <Archivable.h>
#include <LocaleBuild.h>
class BString;
class BCollatorAddOn;
@ -23,7 +21,7 @@ enum collator_strengths {
};
class _IMPEXP_LOCALE BCollator : public BArchivable {
class BCollator : public BArchivable {
public:
BCollator();
BCollator(BCollatorAddOn *collator, int8 strength, bool ignorePunctuation);
@ -55,21 +53,21 @@ class _IMPEXP_LOCALE BCollator : public BArchivable {
};
inline bool
inline bool
BCollator::Equal(const char *s1, const char *s2, int32 len, int8 strength)
{
return Compare(s1, s2, len, strength) == 0;
}
inline bool
inline bool
BCollator::Greater(const char *s1, const char *s2, int32 len, int8 strength)
{
return Compare(s1, s2, len, strength) > 0;
}
inline bool
inline bool
BCollator::GreaterOrEqual(const char *s1, const char *s2, int32 len, int8 strength)
{
return Compare(s1, s2, len, strength) >= 0;
@ -80,7 +78,7 @@ BCollator::GreaterOrEqual(const char *s1, const char *s2, int32 len, int8 streng
// For BCollator add-on implementations:
class _IMPEXP_LOCALE BCollatorAddOn : public BArchivable {
class BCollatorAddOn : public BArchivable {
public:
BCollatorAddOn();
BCollatorAddOn(BMessage *archive);
@ -114,6 +112,6 @@ class _IMPEXP_LOCALE BCollatorAddOn : public BArchivable {
// If your add-on should work with the standard tool to create a language, it
// should export that function. However, once the language file has been written
// only the archived collator is used, and that function won't be called anymore.
extern "C" _IMPEXP_LOCALE BCollatorAddOn *instantiate_collator(void);
extern "C" BCollatorAddOn *instantiate_collator(void);
#endif /* _COLLATOR_H_ */

View File

@ -3,7 +3,6 @@
#include <SupportDefs.h>
#include <LocaleBuild.h>
#include <LocaleStrings.h>
#include <String.h>
@ -13,11 +12,11 @@ enum {
};
class _IMPEXP_LOCALE BCountry {
class BCountry {
public:
BCountry();
virtual ~BCountry();
virtual const char *Name() const;
// see definitions below

View File

@ -5,11 +5,9 @@
#include <Message.h>
#include <String.h>
#include <LocaleBuild.h>
class BLocale;
class _IMPEXP_LOCALE BCurrency : public BArchivable {
class BCurrency : public BArchivable {
public:
BCurrency(const BCurrency &other);
BCurrency(BMessage *archive);

View File

@ -7,8 +7,6 @@
# include <hash_map>
#endif
#include <LocaleBuild.h>
#include <Catalog.h>
#include <DataIO.h>
#include <String.h>
@ -45,9 +43,9 @@ namespace BPrivate {
* but it should also support being created from up to three strings,
* which as a whole specify the key to the translated string.
*/
struct _IMPEXP_LOCALE CatKey {
struct CatKey {
BString fKey;
// the key-string consists of three values separated by a special
// the key-string consists of three values separated by a special
// token:
// - the native string
// - the context of the string's usage
@ -73,7 +71,7 @@ struct _IMPEXP_LOCALE CatKey {
* but the value-type might change to add support for shortcuts and/or
* graphical data (button-images and the like).
*/
class _IMPEXP_LOCALE DefaultCatalog : public BCatalogAddOn {
class DefaultCatalog : public BCatalogAddOn {
public:
DefaultCatalog(const char *signature, const char *language,
@ -81,10 +79,10 @@ class _IMPEXP_LOCALE DefaultCatalog : public BCatalogAddOn {
// constructor for normal use
DefaultCatalog(entry_ref *appOrAddOnRef);
// constructor for embedded catalog
DefaultCatalog(const char *path, const char *signature,
DefaultCatalog(const char *path, const char *signature,
const char *language);
// constructor for editor-app
~DefaultCatalog();
// overrides of BCatalogAddOn:
@ -93,7 +91,7 @@ class _IMPEXP_LOCALE DefaultCatalog : public BCatalogAddOn {
const char *GetString(uint32 id);
const char *GetString(const CatKey& key);
//
status_t SetString(const char *string, const char *translated,
status_t SetString(const char *string, const char *translated,
const char *context = NULL, const char *comment = NULL);
status_t SetString(int32 id, const char *translated);
status_t SetString(const CatKey& key, const char *translated);
@ -145,50 +143,50 @@ class _IMPEXP_LOCALE DefaultCatalog : public BCatalogAddOn {
CatMap::iterator fPos;
CatMap::iterator fEnd;
};
status_t GetWalker(CatWalker *walker);
status_t GetWalker(CatWalker *walker);
};
inline
inline
DefaultCatalog::CatWalker::CatWalker(CatMap &catMap)
: fPos(catMap.begin()),
fEnd(catMap.end())
{
}
inline bool
inline bool
DefaultCatalog::CatWalker::AtEnd() const
{
return fPos == fEnd;
}
inline const CatKey &
inline const CatKey &
DefaultCatalog::CatWalker::GetKey() const
{
assert(fPos != fEnd);
return fPos->first;
}
inline const char *
inline const char *
DefaultCatalog::CatWalker::GetValue() const
{
assert(fPos != fEnd);
return fPos->second.String();
}
inline void
inline void
DefaultCatalog::CatWalker::Next()
{
++fPos;
}
inline status_t
inline status_t
DefaultCatalog::GetWalker(CatWalker *walker)
{
if (!walker)
return B_BAD_VALUE;
*walker = CatWalker(fCatMap);
return B_OK;
}
}
} // namespace BPrivate

View File

@ -7,7 +7,7 @@
class BString;
class BFloatFormatImpl;
class _IMPEXP_LOCALE BFloatFormat : public BNumberFormat, public BFloatFormatParameters {
class BFloatFormat : public BNumberFormat, public BFloatFormatParameters {
public:
BFloatFormat(const BFloatFormat &other);
~BFloatFormat();

View File

@ -7,7 +7,7 @@ struct format_field_position;
class BFloatFormatParameters;
class BString;
class _IMPEXP_LOCALE BFloatFormatImpl : public BNumberFormatImpl {
class BFloatFormatImpl : public BNumberFormatImpl {
public:
BFloatFormatImpl();
virtual ~BFloatFormatImpl();

View File

@ -10,7 +10,7 @@ enum float_format_type {
// number to be formatted
};
class _IMPEXP_LOCALE BFloatFormatParameters : public BNumberFormatParameters {
class BFloatFormatParameters : public BNumberFormatParameters {
public:
BFloatFormatParameters(const BFloatFormatParameters *parent = NULL);
BFloatFormatParameters(const BFloatFormatParameters &other);

View File

@ -24,7 +24,7 @@ enum {
};
// structure filled in while formatting
struct _IMPEXP_LOCALE format_field_position {
struct format_field_position {
uint32 field_type;
int32 start;
int32 length;
@ -32,7 +32,7 @@ struct _IMPEXP_LOCALE format_field_position {
class BFormatImpl;
class _IMPEXP_LOCALE BFormat {
class BFormat {
protected:
BFormat(const BFormat &other);
~BFormat();

View File

@ -3,11 +3,9 @@
#include <SupportDefs.h>
#include <LocaleBuild.h>
class BFormatParameters;
class _IMPEXP_LOCALE BFormatImpl {
class BFormatImpl {
public:
BFormatImpl();
virtual ~BFormatImpl();

View File

@ -3,14 +3,12 @@
#include <SupportDefs.h>
#include <LocaleBuild.h>
enum format_alignment {
B_ALIGN_FORMAT_LEFT, // reuse B_ALIGN_LEFT/B_ALIGN_RIGHT?
B_ALIGN_FORMAT_RIGHT,
};
class _IMPEXP_LOCALE BFormatParameters {
class BFormatParameters {
public:
BFormatParameters(const BFormatParameters *parent = NULL);
BFormatParameters(const BFormatParameters &other);

View File

@ -7,7 +7,7 @@
class BString;
struct format_field_position;
class _IMPEXP_LOCALE BGenericNumberFormat {
class BGenericNumberFormat {
public:
BGenericNumberFormat();
~BGenericNumberFormat();

View File

@ -12,7 +12,7 @@ class BString;
// and this class (and its base classes) should mirror the parameters
// classes' accessor methods.
//
class _IMPEXP_LOCALE BIntegerFormat : public BNumberFormat, public BIntegerFormatParameters {
class BIntegerFormat : public BNumberFormat, public BIntegerFormatParameters {
public:
BIntegerFormat(const BIntegerFormat &other);
~BIntegerFormat();

View File

@ -7,7 +7,7 @@ struct format_field_position;
class BIntegerFormatParameters;
class BString;
class _IMPEXP_LOCALE BIntegerFormatImpl : public BNumberFormatImpl {
class BIntegerFormatImpl : public BNumberFormatImpl {
public:
BIntegerFormatImpl();
virtual ~BIntegerFormatImpl();

View File

@ -3,7 +3,7 @@
#include <NumberFormatParameters.h>
class _IMPEXP_LOCALE BIntegerFormatParameters : public BNumberFormatParameters {
class BIntegerFormatParameters : public BNumberFormatParameters {
public:
BIntegerFormatParameters(const BIntegerFormatParameters *parent = NULL);
BIntegerFormatParameters(const BIntegerFormatParameters &other);

View File

@ -3,7 +3,6 @@
#include <SupportDefs.h>
#include <LocaleBuild.h>
#include <LocaleStrings.h>
@ -14,7 +13,7 @@ enum script_direction {
};
class _IMPEXP_LOCALE BLanguage {
class BLanguage {
public:
~BLanguage();

View File

@ -2,8 +2,6 @@
#define _B_LOCALE_H_
#include <LocaleBuild.h>
#include <Collator.h>
#include <Language.h>
#include <Country.h>
@ -13,7 +11,7 @@ class BCatalog;
class BString;
class _IMPEXP_LOCALE BLocale {
class BLocale {
public:
BLocale();
~BLocale();
@ -43,7 +41,7 @@ class _IMPEXP_LOCALE BLocale {
int StringCompare(const BString *, const BString *, int32 len = -1, int8 strength = B_COLLATE_DEFAULT) const;
void GetSortKey(const char *string, BString *key);
status_t GetAppCatalog(BCatalog *);
protected:
@ -53,34 +51,34 @@ class _IMPEXP_LOCALE BLocale {
};
// global objects
extern _IMPEXP_LOCALE BLocale *be_locale;
extern _IMPEXP_LOCALE BLocaleRoster *be_locale_roster;
extern BLocale *be_locale;
extern BLocaleRoster *be_locale_roster;
//----------------------------------------------------------------------
//--- country short-hands inlines ---
inline void
inline void
BLocale::FormatDate(char *target, size_t maxSize, time_t timer, bool longFormat)
{
fCountry->FormatDate(target, maxSize, timer, longFormat);
}
inline void
inline void
BLocale::FormatDate(BString *target, time_t timer, bool longFormat)
{
fCountry->FormatDate(target, timer, longFormat);
}
inline void
inline void
BLocale::FormatTime(char *target, size_t maxSize, time_t timer, bool longFormat)
{
fCountry->FormatTime(target, maxSize, timer, longFormat);
}
inline void
inline void
BLocale::FormatTime(BString *target, time_t timer, bool longFormat)
{
fCountry->FormatTime(target, timer, longFormat);
@ -90,14 +88,14 @@ BLocale::FormatTime(BString *target, time_t timer, bool longFormat)
//--- locale short-hands inlines ---
// #pragma mark -
inline int
inline int
BLocale::StringCompare(const char *string1, const char *string2, int32 length, int8 strength) const
{
return fCollator->Compare(string1, string2, length, strength);
}
inline int
inline int
BLocale::StringCompare(const BString *string1, const BString *string2, int32 length, int8 strength) const
{
return fCollator->Compare(string1->String(), string2->String(), length, strength);

View File

@ -1,12 +0,0 @@
#ifndef _B_LOCALE_BUILD_H_
#define _B_LOCALE_BUILD_H_
#if _BUILDING_locale
#define _IMPEXP_LOCALE __declspec(dllexport)
#else
#define _IMPEXP_LOCALE __declspec(dllimport)
#endif
#endif /* _B_LOCALE_BUILD_H_ */

View File

@ -1,8 +1,6 @@
#ifndef _LOCALE_ROSTER_H_
#define _LOCALE_ROSTER_H_
#include <LocaleBuild.h>
#include <String.h>
class BLanguage;
@ -20,7 +18,7 @@ enum {
B_LOCALE_CHANGED = '_LCC',
};
class _IMPEXP_LOCALE BLocaleRoster {
class BLocaleRoster {
public:
BLocaleRoster();
@ -35,14 +33,14 @@ class _IMPEXP_LOCALE BLocaleRoster {
status_t GetDefaultCollator(BCollator **) const;
status_t GetDefaultLanguage(BLanguage **) const;
status_t GetDefaultCountry(BCountry **) const;
status_t GetPreferredLanguages(BMessage *) const;
status_t SetPreferredLanguages(BMessage *);
// the message contains one or more 'language'-string-fields
// the message contains one or more 'language'-string-fields
// which contain the language-name(s)
status_t GetInstalledLanguages(BMessage *) const;
// the message contains one or more 'language'-string-fields
// the message contains one or more 'language'-string-fields
// which contain the language-name(s)
status_t GetInstalledCatalogs(BMessage *,
@ -66,14 +64,14 @@ class _IMPEXP_LOCALE BLocaleRoster {
private:
BCatalogAddOn* LoadCatalog(const char *signature,
BCatalogAddOn* LoadCatalog(const char *signature,
const char *language = NULL,
int32 fingerprint = 0);
BCatalogAddOn* LoadEmbeddedCatalog(entry_ref *appOrAddOnRef);
status_t UnloadCatalog(BCatalogAddOn *addOn);
//
BCatalogAddOn* CreateCatalog(const char *type,
const char *signature,
const char *signature,
const char *language);
friend class BCatalog;

View File

@ -6,7 +6,7 @@
class BNumberFormatImpl;
class _IMPEXP_LOCALE BNumberFormat : public BFormat {
class BNumberFormat : public BFormat {
protected:
BNumberFormat(const BNumberFormat &other);
~BNumberFormat();

View File

@ -6,7 +6,7 @@
struct format_field_position;
class BNumberFormatParameters;
class _IMPEXP_LOCALE BNumberFormatImpl : public BFormatImpl {
class BNumberFormatImpl : public BFormatImpl {
public:
BNumberFormatImpl();
virtual ~BNumberFormatImpl();

View File

@ -20,7 +20,7 @@ enum number_format_base {
B_HEXADECIMAL_BASE = 16,
};
class _IMPEXP_LOCALE BNumberFormatParameters : public BFormatParameters {
class BNumberFormatParameters : public BFormatParameters {
public:
BNumberFormatParameters(const BNumberFormatParameters *parent = NULL);
BNumberFormatParameters(const BNumberFormatParameters &other);

View File

@ -3,8 +3,6 @@
#include <SupportDefs.h>
#include <LocaleBuild.h>
enum unicode_char_category
{
// Non-category for unassigned and non-character code points.
@ -49,9 +47,9 @@ enum unicode_char_category
* This specifies the language directional property of a character set.
*/
enum unicode_char_direction {
B_UNICODE_LEFT_TO_RIGHT = 0,
B_UNICODE_RIGHT_TO_LEFT = 1,
enum unicode_char_direction {
B_UNICODE_LEFT_TO_RIGHT = 0,
B_UNICODE_RIGHT_TO_LEFT = 1,
B_UNICODE_EUROPEAN_NUMBER = 2,
B_UNICODE_EUROPEAN_NUMBER_SEPARATOR = 3,
B_UNICODE_EUROPEAN_NUMBER_TERMINATOR = 4,
@ -59,8 +57,8 @@ enum unicode_char_direction {
B_UNICODE_COMMON_NUMBER_SEPARATOR = 6,
B_UNICODE_BLOCK_SEPARATOR = 7,
B_UNICODE_SEGMENT_SEPARATOR = 8,
B_UNICODE_WHITE_SPACE_NEUTRAL = 9,
B_UNICODE_OTHER_NEUTRAL = 10,
B_UNICODE_WHITE_SPACE_NEUTRAL = 9,
B_UNICODE_OTHER_NEUTRAL = 10,
B_UNICODE_LEFT_TO_RIGHT_EMBEDDING = 11,
B_UNICODE_LEFT_TO_RIGHT_OVERRIDE = 12,
B_UNICODE_RIGHT_TO_LEFT_ARABIC = 13,
@ -69,7 +67,7 @@ enum unicode_char_direction {
B_UNICODE_POP_DIRECTIONAL_FORMAT = 16,
B_UNICODE_DIR_NON_SPACING_MARK = 17,
B_UNICODE_BOUNDARY_NEUTRAL = 18,
B_UNICODE_DIRECTION_COUNT
};
@ -188,7 +186,7 @@ enum unicode_cell_width
};
class _IMPEXP_LOCALE BUnicodeChar {
class BUnicodeChar {
public:
static bool IsAlpha(uint32 c);
static bool IsAlNum(uint32 c);
@ -224,7 +222,7 @@ class _IMPEXP_LOCALE BUnicodeChar {
};
inline uint32
inline uint32
BUnicodeChar::FromUTF8(const char *in)
{
const char *string = in;

View File

@ -1,8 +1,6 @@
#ifndef _LANGINFO_H_
#define _LANGINFO_H_
#include <LocaleBuild.h>
#include <LocaleStrings.h>
#include <nl_types.h>
@ -81,6 +79,6 @@
#ifdef __cplusplus
extern "C"
#endif
_IMPEXP_LOCALE char *nl_langinfo(nl_item);
char *nl_langinfo(nl_item);
#endif /* _LANGINFO_H_ */

View File

@ -3,14 +3,12 @@
#include <stdarg.h>
#include <LocaleBuild.h>
#ifdef __cplusplus
extern "C" {
#endif
_IMPEXP_LOCALE ssize_t strfmon(char *string, size_t maxSize, const char *format, ...);
_IMPEXP_LOCALE ssize_t vstrfmon(char *string, size_t maxSize, const char *format, va_list args);
ssize_t strfmon(char *string, size_t maxSize, const char *format, ...);
ssize_t vstrfmon(char *string, size_t maxSize, const char *format, va_list args);
#ifdef __cplusplus
}

View File

@ -5,6 +5,7 @@ SubInclude HAIKU_TOP src add-ons decorators ;
SubInclude HAIKU_TOP src add-ons disk_systems ;
SubInclude HAIKU_TOP src add-ons input_server ;
SubInclude HAIKU_TOP src add-ons kernel ;
SubInclude HAIKU_TOP src add-ons locale ;
SubInclude HAIKU_TOP src add-ons mail_daemon ;
SubInclude HAIKU_TOP src add-ons media ;
SubInclude HAIKU_TOP src add-ons opengl ;

View File

@ -1,4 +1,4 @@
SubDir LOCALE_TOP add-ons ;
SubDir HAIKU_TOP src add-ons locale ;
SubInclude LOCALE_TOP add-ons catalogs ;
SubInclude LOCALE_TOP add-ons collators ;
SubInclude HAIKU_TOP src add-ons locale catalogs ;
SubInclude HAIKU_TOP src add-ons locale collators ;

View File

@ -1,3 +1,10 @@
SubDir LOCALE_TOP add-ons catalogs ;
SubDir HAIKU_TOP src add-ons locale catalogs ;
SubInclude LOCALE_TOP add-ons catalogs zeta ;
# Pseudo target to build all collator addons
NotFile LocaleKitCatalogAddons ;
Depends LocaleKitCatalogAddons
:
<catalog-addon>zeta
;
SubInclude HAIKU_TOP src add-ons locale catalogs zeta ;

View File

@ -1,3 +1,8 @@
SubDir LOCALE_TOP add-ons catalogs zeta ;
SubDir HAIKU_TOP src add-ons locale catalogs zeta ;
AddOn zeta : Catalog.cpp : be liblocale.so ;
UsePublicHeaders locale ;
Addon <catalog-addon>zeta
: Catalog.cpp
: be liblocale.so
;

View File

@ -1,15 +1,22 @@
SubDir LOCALE_TOP add-ons collators ;
SubDir HAIKU_TOP src add-ons locale collators ;
rule Collator
{
# Collator <sources> ;
local sources = $(1) ;
local name = $(sources[1]:B) ;
local rsrc = $(name:S=.rsrc) ;
AddResources $(name) : $(rsrc) ;
AddOn $(name) : $(sources) : be liblocale.so ;
}
UsePublicHeaders locale ;
Collator GermanDIN-2.cpp ;
Collator French.cpp ;
# Pseudo target to build all collator addons
NotFile LocaleKitCollatorAddons ;
Depends LocaleKitCollatorAddons
:
<collator-addon>GermanDIN-2
<collator-addon>French
;
Addon <collator-addon>GermanDIN-2
: GermanDIN-2.cpp
: be liblocale.so
;
Addon <collator-addon>French
: French.cpp
: be liblocale.so
;

View File

@ -193,6 +193,7 @@ SubInclude HAIKU_TOP src bin ideinfo ;
SubInclude HAIKU_TOP src bin keymap ;
SubInclude HAIKU_TOP src bin less ;
SubInclude HAIKU_TOP src bin listdev ;
SubInclude HAIKU_TOP src bin locale ;
SubInclude HAIKU_TOP src bin make ;
SubInclude HAIKU_TOP src bin makebootable ;
#SubInclude HAIKU_TOP src bin makeudfimage ;

View File

@ -1,10 +1,11 @@
SubDir LOCALE_TOP apps ;
SubDir HAIKU_TOP src bin locale ;
AddResources collectcatkeys : collectcatkeys.rsrc ;
Application collectcatkeys : collectcatkeys.cpp RegExp.cpp : be liblocale.so ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits tracker ] ;
AddResources linkcatkeys : linkcatkeys.rsrc ;
Application linkcatkeys : linkcatkeys.cpp : be liblocale.so ;
UsePublicHeaders locale ;
AddResources dumpcatalog ;
Application dumpcatalog : dumpcatalog.cpp : be liblocale.so ;
BinCommand collectcatkeys : collectcatkeys.cpp RegExp.cpp : be liblocale.so ;
BinCommand linkcatkeys : linkcatkeys.cpp : be liblocale.so ;
BinCommand dumpcatalog : dumpcatalog.cpp : be liblocale.so ;

View File

@ -1,13 +1 @@
SubDir LOCALE_TOP languages ;
LANGUAGE_DIR = /etc/locale/languages ;
{
local languages = [ Glob $(SUBDIR) : *.language ] ;
local language ;
for language in [ FGristFiles $(languages:D=) ] {
local installedLanguage = $(language:G=installed) ;
MakeLocate $(installedLanguage) : $(LANGUAGE_DIR) ;
File $(installedLanguage) : $(language) ;
}
}
SubDir HAIKU_TOP src data etc locale languages ;

View File

@ -92,6 +92,7 @@ SubInclude HAIKU_TOP src kits debug ;
SubInclude HAIKU_TOP src kits device ;
SubInclude HAIKU_TOP src kits game ;
SubInclude HAIKU_TOP src kits interface ;
SubInclude HAIKU_TOP src kits locale ;
SubInclude HAIKU_TOP src kits mail ;
SubInclude HAIKU_TOP src kits media ;
SubInclude HAIKU_TOP src kits midi ;

View File

@ -1,6 +1,8 @@
SubDir LOCALE_TOP lib ;
SubDir HAIKU_TOP src kits locale ;
DEFINES += _BUILDING_locale=1 ;
UsePrivateHeaders locale ;
UsePublicHeaders locale storage ;
SharedLibrary liblocale.so
: adler32.c

View File

@ -1,12 +1,12 @@
/*
* This file contains library initialization code.
* This file contains library initialization code.
* The required mimetypes and attribute-indices are created here.
*/
*/
#include <syslog.h>
#include <fs_attr.h>
#include <fs_index.h>
#include <fs_index.h>
#include <Volume.h>
#include <VolumeRoster.h>
@ -14,7 +14,7 @@
#include <DefaultCatalog.h>
// helper function that makes sure an attribute-index exists:
static void EnsureIndexExists(const char *attrName)
static void EnsureIndexExists(const char *attrName)
{
BVolume bootVol;
BVolumeRoster volRoster;
@ -22,14 +22,14 @@ static void EnsureIndexExists(const char *attrName)
return;
struct index_info idxInfo;
if (fs_stat_index(bootVol.Device(), attrName, &idxInfo) != 0) {
status_t res = fs_create_index(bootVol.Device(), attrName,
status_t res = fs_create_index(bootVol.Device(), attrName,
B_STRING_TYPE, 0);
if (res == 0) {
log_team(LOG_INFO,
log_team(LOG_INFO,
"successfully created the required index for attribute %s",
attrName);
} else {
log_team(LOG_ERR,
log_team(LOG_ERR,
"failed to create the required index for attribute %s (%s)",
attrName, strerror(res));
}
@ -47,7 +47,7 @@ SetupCatalogBasics()
// make sure the indices required for catalog-traversal are there:
EnsureIndexExists(BLocaleRoster::kCatLangAttr);
EnsureIndexExists(BLocaleRoster::kCatSigAttr);
// install mimetype for default-catalog:
BMimeType mt;
status_t res = mt.SetTo(DefaultCatalog::kCatMimeType);
@ -58,7 +58,7 @@ SetupCatalogBasics()
if (res == B_OK && !supertype.IsInstalled()) {
res = supertype.Install();
}
if (res == B_OK) {
// info about the attributes of a catalog...
BMessage attrMsg;
@ -109,7 +109,7 @@ SetupCatalogBasics()
// preferred app is catalog manager:
res = mt.SetPreferredApp(BLocaleRoster::kCatManagerMimeType, B_OPEN);
}
if (res == B_OK)
res = mt.Install();
}
@ -120,37 +120,9 @@ SetupCatalogBasics()
}
#if defined(__HAIKU__)
extern "C"
_IMPEXP_LOCALE
void
initialize_after()
{
SetupCatalogBasics();
}
#else
// [zooey]:
// hack suggested by Ingo Weinhold to make the be_roster work
// properly such that we can install mimetypes:
class BRoster {
public:
void InitMessengers();
};
extern const BRoster *be_roster;
extern "C"
_IMPEXP_LOCALE
void
initialize_after()
{
// now force be_roster to initialized state.
const_cast<BRoster*>(be_roster)->InitMessengers();
SetupCatalogBasics();
}
#endif

View File

@ -4,16 +4,14 @@
*/
/*
* [zooey]:
* [zooey]:
* This file has been adjusted from the original found in zlib
* for better conformance to our style-guide.
*/
#include <SupportDefs.h>
#include <LocaleBuild.h>
uint32 _IMPEXP_LOCALE adler32(uint32 adler, const uint8 *buf, uint32 len);
uint32 adler32(uint32 adler, const uint8 *buf, uint32 len);
// prototype required by mwcc
#define BASE 65521L /* largest prime smaller than 65536 */
@ -27,7 +25,7 @@ uint32 _IMPEXP_LOCALE adler32(uint32 adler, const uint8 *buf, uint32 len);
#define DO16(buf) DO8(buf,0); DO8(buf,8);
/* ========================================================================= */
uint32 adler32(uint32 adler, const uint8 *buf, uint32 len)
uint32 adler32(uint32 adler, const uint8 *buf, uint32 len)
{
uint32 s1 = adler & 0xffff;
uint32 s2 = (adler >> 16) & 0xffff;

View File

@ -12,6 +12,7 @@ SubInclude HAIKU_TOP src preferences fonts ;
SubInclude HAIKU_TOP src preferences joysticks ;
SubInclude HAIKU_TOP src preferences keyboard ;
SubInclude HAIKU_TOP src preferences keymap ;
SubInclude HAIKU_TOP src preferences locale ;
SubInclude HAIKU_TOP src preferences mail ;
SubInclude HAIKU_TOP src preferences media ;
SubInclude HAIKU_TOP src preferences menu ;

View File

@ -1,8 +1,8 @@
SubDir LOCALE_TOP preferences ;
SubDir HAIKU_TOP src preferences locale ;
AddResources Locale : Locale.rsrc ;
Application Locale :
Preference Locale :
Locale.cpp
LocaleWindow.cpp
: be liblocale.so ;
: be liblocale.so
# : Locale.rdef
;

View File

@ -3,6 +3,7 @@ SubDir HAIKU_TOP src tests kits ;
SubInclude HAIKU_TOP src tests kits app ;
SubInclude HAIKU_TOP src tests kits game ;
SubInclude HAIKU_TOP src tests kits interface ;
SubInclude HAIKU_TOP src tests kits locale ;
SubInclude HAIKU_TOP src tests kits media ;
SubInclude HAIKU_TOP src tests kits midi ;
SubInclude HAIKU_TOP src tests kits net ;

View File

@ -1,28 +1,47 @@
SubDir LOCALE_TOP test ;
SubDir HAIKU_TOP src tests kits locale ;
rule SimpleTest
UsePublicHeaders locale ;
# Pseudo target to build all locale kit tests
NotFile LocaleKitTests ;
Depends LocaleKitTests
:
catalogSpeed
catalogTest
collatorSpeed
collatorTest
localeTest
# NumberFormatTests
;
rule LocaleTest
{
# SimpleTest <sources> ;
# LocaleTest <sources> ;
local sources = $(1) ;
local name = $(sources[1]:B) ;
Application $(name) : $(sources) : be liblocale.so ;
}
SimpleTest localeTest.cpp ;
SimpleTest collatorTest.cpp ;
SimpleTest collatorSpeed.cpp ;
SimpleTest catalogTest.cpp ;
AddOn catalogTestAddOn : catalogTestAddOn.cpp : be liblocale.so ;
SimpleTest catalogSpeed.cpp ;
SimpleTest genericNumberFormatTest.cpp ;
LocaleTest catalogSpeed.cpp ;
LocaleTest catalogTest.cpp ;
LocaleTest collatorSpeed.cpp ;
LocaleTest collatorTest.cpp ;
LocaleTest genericNumberFormatTest.cpp ;
LocaleTest localeTest.cpp ;
Addon catalogTestAddOn
: catalogTestAddOn.cpp
: be liblocale.so
;
# For the unit tests we need liblocale.so to live in the `lib' subdirectory
# of the UnitTester application. We simply create a symlink that can be
# referred to by `<unittests>liblocale.so'.
{
local symlink = <unittests>liblocale.so ;
MakeLocate $(symlink) : [ FDirName $(LOCALE_UNITTESTS_DIR) lib ] ;
RelSymLink $(symlink) : liblocale.so ;
}
#{
# local symlink = <unittests>liblocale.so ;
# MakeLocate $(symlink) : [ FDirName $(LOCALE_UNITTESTS_DIR) lib ] ;
# RelSymLink $(symlink) : liblocale.so ;
#}
SubInclude LOCALE_TOP test number_format ;
# TODO: activate this again, once it's working!
# SubInclude HAIKU_TOP src tests kits locale number_format ;

View File

@ -1,4 +1,6 @@
SubDir LOCALE_TOP test number_format ;
SubDir HAIKU_TOP src tests kits locale number_format ;
UsePublicHeaders locale ;
SEARCH_SOURCE += [ FDirName $(SUBDIR) generic_number_format ] ;
@ -9,5 +11,5 @@ UnitTest NumberFormatTests
GenericNumberFormatTests.cpp
GenericNumberFormatConstructorTest.cpp
: be <unittests>liblocale.so
: be liblocale.so
;

View File

@ -113,6 +113,7 @@ SubInclude HAIKU_TOP src tools fs_shell ;
SubInclude HAIKU_TOP src tools gensyscalls ;
SubInclude HAIKU_TOP src tools hack_coff ;
SubInclude HAIKU_TOP src tools keymap ;
SubInclude HAIKU_TOP src tools locale ;
SubInclude HAIKU_TOP src tools makebootable ;
SubInclude HAIKU_TOP src tools rc ;
SubInclude HAIKU_TOP src tools remote_disk_server ;

View File

@ -1,3 +1,3 @@
SubDir LOCALE_TOP tools ;
SubDir HAIKU_TOP src tools locale ;
SubInclude LOCALE_TOP tools genprops ;
SubInclude HAIKU_TOP src tools locale genprops ;

View File

@ -1,5 +1,9 @@
SubDir LOCALE_TOP tools genprops ;
SubDir HAIKU_TOP src tools locale genprops ;
SubDirSysHdrs [ FDirName $(LOCALE_TOP) lib ] ;
UsePrivateHeaders locale ;
UsePublicHeaders locale ;
Application genprops : genprops.cpp store.cpp utf8.cpp PropertyFile.cpp : be ;
Application genprops
: genprops.cpp store.cpp utf8.cpp PropertyFile.cpp
: be
;