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
View File
@@ -132,6 +132,25 @@ Depends ScreenSaverKit :
Haiku 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 # Evaluate optional package dependencies and prepare the optional build
# features before parsing the Jamfile tree. # features before parsing the Jamfile tree.
include [ FDirName $(HAIKU_BUILD_RULES_DIR) OptionalPackageDependencies ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) OptionalPackageDependencies ] ;
+13 -6
View File
@@ -29,9 +29,10 @@ if $(HAIKU_ATA_STACK) = 1 {
SYSTEM_BIN = "[" addattr alert arp base64 basename bash bc beep bootman bzip2 SYSTEM_BIN = "[" addattr alert arp base64 basename bash bc beep bootman bzip2
cal cat catattr checkfs chgrp chmod chop chown chroot cksum clear 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 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 factor false fdinfo ffm filepanel find finddir fmt fold fortune frcode
ftp ftpd ftp ftpd
funzip fwcontrol 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 id ident ideinfo idestatus ifconfig <bin>install installsound iroster
isvolume isvolume
join 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 listport listres listsem listusb ln locate logger login logname ls lsindex
makebootable md5sum merge mimeset mkdos mkdir mkfifo mkfs mkindex makebootable md5sum merge mimeset mkdos mkdir mkfifo mkfs mkindex
modifiers mount mount_nfs mountvolume mv modifiers mount mount_nfs mountvolume mv
@@ -68,8 +70,8 @@ SYSTEM_APPS = AboutSystem ActivityMonitor CharacterMap CodyCam DeskCalc DiskProb
StyledEdit Terminal TextSearch TV Workspaces StyledEdit Terminal TextSearch TV Workspaces
; ;
SYSTEM_PREFERENCES = Appearance Backgrounds CPUFrequency DataTranslations E-mail SYSTEM_PREFERENCES = Appearance Backgrounds CPUFrequency DataTranslations E-mail
FileTypes Fonts Keyboard Keymap Media Menu Mouse Network Printers Screen FileTypes Fonts Keyboard Keymap Locale Media Menu Mouse Network Printers
ScreenSaver Sounds Time Touchpad <preference>Tracker VirtualMemory Screen ScreenSaver Sounds Time Touchpad <preference>Tracker VirtualMemory
; ;
SYSTEM_DEMOS = BSnow Chart Clock Cortex FontDemo SYSTEM_DEMOS = BSnow Chart Clock Cortex FontDemo
GLDirectMode GLTeapot Mandelbrot Pairs 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 libmail.so libtextencoding.so libz.so libfreetype.so libpng.so libmidi.so
libmidi2.so libdevice.so libgame.so libscreensaver.so <revisioned>libroot.so libmidi2.so libdevice.so libgame.so libscreensaver.so <revisioned>libroot.so
libGL.so libfluidsynth.so liblpsolve55.so liblinprog.so libalm.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 SYSTEM_SERVERS = registrar debug_server syslog_daemon media_server
net_server media_addon_server input_server app_server fake_app_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 ] ; = [ FDirName $(HAIKU_TOP) src apps mail ] ;
AddFilesToHaikuImage system etc word_dictionary : $(spellFiles) ; 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 ; local etcFiles = bash_completion inputrc profile teapot.data ;
etcFiles = $(etcFiles:G=etc) ; etcFiles = $(etcFiles:G=etc) ;
SEARCH on $(etcFiles) = [ FDirName $(HAIKU_TOP) data etc ] ; SEARCH on $(etcFiles) = [ FDirName $(HAIKU_TOP) data etc ] ;
+38 -40
View File
@@ -1,8 +1,6 @@
#ifndef _CATALOG_H_ #ifndef _CATALOG_H_
#define _CATALOG_H_ #define _CATALOG_H_
#include <LocaleBuild.h>
#include <SupportDefs.h> #include <SupportDefs.h>
#include <String.h> #include <String.h>
@@ -12,7 +10,7 @@ class BMessage;
struct entry_ref; struct entry_ref;
class _IMPEXP_LOCALE BCatalog { class BCatalog {
public: public:
BCatalog(); BCatalog();
@@ -51,8 +49,8 @@ class _IMPEXP_LOCALE BCatalog {
}; };
extern _IMPEXP_LOCALE BCatalog* be_catalog; extern BCatalog* be_catalog;
extern _IMPEXP_LOCALE BCatalog* be_app_catalog; extern BCatalog* be_app_catalog;
#ifndef B_AVOID_TRANSLATION_MACROS #ifndef B_AVOID_TRANSLATION_MACROS
@@ -60,22 +58,22 @@ extern _IMPEXP_LOCALE BCatalog* be_app_catalog;
// you don't want these: // you don't want these:
#undef TR_CONTEXT #undef TR_CONTEXT
// In a single application, several strings (e.g. 'Ok') will be used // In a single application, several strings (e.g. 'Ok') will be used
// more than once, in different contexts. // more than once, in different contexts.
// As the application programmer can not know if all translations of // As the application programmer can not know if all translations of
// this string will be the same for all languages, each occurrence of // this string will be the same for all languages, each occurrence of
// the string must be translated on its own. // the string must be translated on its own.
// Specifying the context explicitly with each string allows the person // Specifying the context explicitly with each string allows the person
// translating a catalog to separate these different occurrences of the // 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. // application.
// In order to give the translator a useful hint, 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. // to be associated with the strings used in this specifc source file.
// example: // example:
// #define TR_CONTEXT "Folder-Window" // #define TR_CONTEXT "Folder-Window"
// Tip: Use a descriptive name of the class implemented in that // Tip: Use a descriptive name of the class implemented in that
// source-file. // source-file.
// Translation macros which may be used to shorten translation requests: // 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++) { for (char **ch = choices; *ch; ch++) {
menu->AddItem( menu->AddItem(
new BMenuItem( new BMenuItem(
TR(*ch), TR(*ch),
new BMessage(...) new BMessage(...)
) )
) )
@@ -130,25 +128,25 @@ extern _IMPEXP_LOCALE BCatalog* be_app_catalog;
#undef TR_MARK_ALL #undef TR_MARK_ALL
#define TR_MARK_ALL(str,ctx,cmt) \ #define TR_MARK_ALL(str,ctx,cmt) \
BCatalogAddOn::MarkForTranslation((str), (ctx), (cmt)) BCatalogAddOn::MarkForTranslation((str), (ctx), (cmt))
#undef TR_MARK_ID #undef TR_MARK_ID
#define TR_MARK_ID(id) \ #define TR_MARK_ID(id) \
BCatalogAddOn::MarkForTranslation((id)) BCatalogAddOn::MarkForTranslation((id))
#endif /* B_AVOID_TRANSLATION_MACROS */ #endif /* B_AVOID_TRANSLATION_MACROS */
/************************************************************************/ /************************************************************************/
// For BCatalog add-on implementations: // For BCatalog add-on implementations:
class _IMPEXP_LOCALE BCatalogAddOn { class BCatalogAddOn {
friend class BLocaleRoster; friend class BLocaleRoster;
public: public:
BCatalogAddOn(const char *signature, const char *language, BCatalogAddOn(const char *signature, const char *language,
int32 fingerprint); int32 fingerprint);
virtual ~BCatalogAddOn(); virtual ~BCatalogAddOn();
virtual const char *GetString(const char *string, virtual const char *GetString(const char *string,
const char *context=NULL, const char *context=NULL,
const char *comment=NULL) = 0; const char *comment=NULL) = 0;
virtual const char *GetString(uint32 id) = 0; virtual const char *GetString(uint32 id) = 0;
@@ -157,14 +155,14 @@ class _IMPEXP_LOCALE BCatalogAddOn {
BCatalogAddOn *Next(); BCatalogAddOn *Next();
// the following could be used to localize non-textual data (e.g. icons), // 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: // feature:
virtual bool CanHaveData() const; virtual bool CanHaveData() const;
virtual status_t GetData(const char *name, BMessage *msg); virtual status_t GetData(const char *name, BMessage *msg);
virtual status_t GetData(uint32 id, BMessage *msg); virtual status_t GetData(uint32 id, BMessage *msg);
// interface for catalog-editor-app and testing apps: // 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 *translated,
const char *context=NULL, const char *context=NULL,
const char *comment=NULL); const char *comment=NULL);
@@ -187,7 +185,7 @@ class _IMPEXP_LOCALE BCatalogAddOn {
// magic marker functions which are used to mark a string/id // magic marker functions which are used to mark a string/id
// which will be translated elsewhere in the code (where it can // which will be translated elsewhere in the code (where it can
// not be found since it is references by a variable): // 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); const char *cmt);
static int32 MarkForTranslation(int32 id); static int32 MarkForTranslation(int32 id);
@@ -199,29 +197,29 @@ class _IMPEXP_LOCALE BCatalogAddOn {
BString fLanguageName; BString fLanguageName;
int32 fFingerprint; int32 fFingerprint;
BCatalogAddOn *fNext; BCatalogAddOn *fNext;
friend class BCatalog; friend class BCatalog;
friend status_t get_add_on_catalog(BCatalog*, const char *); friend status_t get_add_on_catalog(BCatalog*, const char *);
}; };
// every catalog-add-on should export these symbols... // every catalog-add-on should export these symbols...
// ...the function that instantiates a catalog for this add-on-type... // ...the function that instantiates a catalog for this add-on-type...
extern "C" _IMPEXP_LOCALE extern "C"
BCatalogAddOn *instantiate_catalog(const char *signature, BCatalogAddOn *instantiate_catalog(const char *signature,
const char *language, int32 fingerprint); const char *language, int32 fingerprint);
// ...the function that creates an empty catalog for this add-on-type... // ...the function that creates an empty catalog for this add-on-type...
extern "C" _IMPEXP_LOCALE extern "C"
BCatalogAddOn *create_catalog(const char *signature, BCatalogAddOn *create_catalog(const char *signature,
const char *language); const char *language);
// ...and the priority which will be used to order the catalog-add-ons: // ...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: * BCatalog - inlines for trivial accessors:
*/ */
inline status_t inline status_t
BCatalog::GetSignature(BString *sig) BCatalog::GetSignature(BString *sig)
{ {
if (!sig) if (!sig)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -232,8 +230,8 @@ BCatalog::GetSignature(BString *sig)
} }
inline status_t inline status_t
BCatalog::GetLanguage(BString *lang) BCatalog::GetLanguage(BString *lang)
{ {
if (!lang) if (!lang)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -241,11 +239,11 @@ BCatalog::GetLanguage(BString *lang)
return B_NO_INIT; return B_NO_INIT;
*lang = fCatalog->fLanguageName; *lang = fCatalog->fLanguageName;
return B_OK; return B_OK;
} }
inline status_t inline status_t
BCatalog::GetFingerprint(int32 *fp) BCatalog::GetFingerprint(int32 *fp)
{ {
if (!fp) if (!fp)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -259,13 +257,13 @@ BCatalog::GetFingerprint(int32 *fp)
inline status_t inline status_t
BCatalog::InitCheck() const BCatalog::InitCheck() const
{ {
return fCatalog return fCatalog
? fCatalog->InitCheck() ? fCatalog->InitCheck()
: B_NO_INIT; : B_NO_INIT;
} }
inline int32 inline int32
BCatalog::CountItems() const BCatalog::CountItems() const
{ {
if (!fCatalog) if (!fCatalog)
@@ -275,7 +273,7 @@ BCatalog::CountItems() const
inline BCatalogAddOn * inline BCatalogAddOn *
BCatalog::CatalogAddOn() BCatalog::CatalogAddOn()
{ {
return fCatalog; return fCatalog;
} }
@@ -285,22 +283,22 @@ BCatalog::CatalogAddOn()
* BCatalogAddOn - inlines for trivial accessors: * BCatalogAddOn - inlines for trivial accessors:
*/ */
inline BCatalogAddOn * inline BCatalogAddOn *
BCatalogAddOn::Next() BCatalogAddOn::Next()
{ {
return fNext; return fNext;
} }
inline const char * inline const char *
BCatalogAddOn::MarkForTranslation(const char *str, const char *ctx, BCatalogAddOn::MarkForTranslation(const char *str, const char *ctx,
const char *cmt) const char *cmt)
{ {
return str; return str;
} }
inline int32 inline int32
BCatalogAddOn::MarkForTranslation(int32 id) BCatalogAddOn::MarkForTranslation(int32 id)
{ {
return id; return id;
} }
@@ -311,14 +309,14 @@ namespace BPrivate {
/* /*
* EditableCatalog * EditableCatalog
*/ */
class _IMPEXP_LOCALE EditableCatalog : public BCatalog { class EditableCatalog : public BCatalog {
public: public:
EditableCatalog(const char *type, const char *signature, EditableCatalog(const char *type, const char *signature,
const char *language); const char *language);
~EditableCatalog(); ~EditableCatalog();
status_t SetString(const char *string, status_t SetString(const char *string,
const char *translated, const char *translated,
const char *context=NULL, const char *context=NULL,
const char *comment=NULL); const char *comment=NULL);
+6 -8
View File
@@ -5,8 +5,6 @@
#include <SupportDefs.h> #include <SupportDefs.h>
#include <Archivable.h> #include <Archivable.h>
#include <LocaleBuild.h>
class BString; class BString;
class BCollatorAddOn; class BCollatorAddOn;
@@ -23,7 +21,7 @@ enum collator_strengths {
}; };
class _IMPEXP_LOCALE BCollator : public BArchivable { class BCollator : public BArchivable {
public: public:
BCollator(); BCollator();
BCollator(BCollatorAddOn *collator, int8 strength, bool ignorePunctuation); 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) BCollator::Equal(const char *s1, const char *s2, int32 len, int8 strength)
{ {
return Compare(s1, s2, len, strength) == 0; return Compare(s1, s2, len, strength) == 0;
} }
inline bool inline bool
BCollator::Greater(const char *s1, const char *s2, int32 len, int8 strength) BCollator::Greater(const char *s1, const char *s2, int32 len, int8 strength)
{ {
return Compare(s1, s2, len, strength) > 0; return Compare(s1, s2, len, strength) > 0;
} }
inline bool inline bool
BCollator::GreaterOrEqual(const char *s1, const char *s2, int32 len, int8 strength) BCollator::GreaterOrEqual(const char *s1, const char *s2, int32 len, int8 strength)
{ {
return Compare(s1, s2, len, strength) >= 0; 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: // For BCollator add-on implementations:
class _IMPEXP_LOCALE BCollatorAddOn : public BArchivable { class BCollatorAddOn : public BArchivable {
public: public:
BCollatorAddOn(); BCollatorAddOn();
BCollatorAddOn(BMessage *archive); 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 // 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 // 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. // 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_ */ #endif /* _COLLATOR_H_ */
+2 -3
View File
@@ -3,7 +3,6 @@
#include <SupportDefs.h> #include <SupportDefs.h>
#include <LocaleBuild.h>
#include <LocaleStrings.h> #include <LocaleStrings.h>
#include <String.h> #include <String.h>
@@ -13,11 +12,11 @@ enum {
}; };
class _IMPEXP_LOCALE BCountry { class BCountry {
public: public:
BCountry(); BCountry();
virtual ~BCountry(); virtual ~BCountry();
virtual const char *Name() const; virtual const char *Name() const;
// see definitions below // see definitions below
+1 -3
View File
@@ -5,11 +5,9 @@
#include <Message.h> #include <Message.h>
#include <String.h> #include <String.h>
#include <LocaleBuild.h>
class BLocale; class BLocale;
class _IMPEXP_LOCALE BCurrency : public BArchivable { class BCurrency : public BArchivable {
public: public:
BCurrency(const BCurrency &other); BCurrency(const BCurrency &other);
BCurrency(BMessage *archive); BCurrency(BMessage *archive);
+14 -16
View File
@@ -7,8 +7,6 @@
# include <hash_map> # include <hash_map>
#endif #endif
#include <LocaleBuild.h>
#include <Catalog.h> #include <Catalog.h>
#include <DataIO.h> #include <DataIO.h>
#include <String.h> #include <String.h>
@@ -45,9 +43,9 @@ namespace BPrivate {
* but it should also support being created from up to three strings, * but it should also support being created from up to three strings,
* which as a whole specify the key to the translated string. * which as a whole specify the key to the translated string.
*/ */
struct _IMPEXP_LOCALE CatKey { struct CatKey {
BString fKey; 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: // token:
// - the native string // - the native string
// - the context of the string's usage // - 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 * but the value-type might change to add support for shortcuts and/or
* graphical data (button-images and the like). * graphical data (button-images and the like).
*/ */
class _IMPEXP_LOCALE DefaultCatalog : public BCatalogAddOn { class DefaultCatalog : public BCatalogAddOn {
public: public:
DefaultCatalog(const char *signature, const char *language, DefaultCatalog(const char *signature, const char *language,
@@ -81,10 +79,10 @@ class _IMPEXP_LOCALE DefaultCatalog : public BCatalogAddOn {
// constructor for normal use // constructor for normal use
DefaultCatalog(entry_ref *appOrAddOnRef); DefaultCatalog(entry_ref *appOrAddOnRef);
// constructor for embedded catalog // constructor for embedded catalog
DefaultCatalog(const char *path, const char *signature, DefaultCatalog(const char *path, const char *signature,
const char *language); const char *language);
// constructor for editor-app // constructor for editor-app
~DefaultCatalog(); ~DefaultCatalog();
// overrides of BCatalogAddOn: // overrides of BCatalogAddOn:
@@ -93,7 +91,7 @@ class _IMPEXP_LOCALE DefaultCatalog : public BCatalogAddOn {
const char *GetString(uint32 id); const char *GetString(uint32 id);
const char *GetString(const CatKey& key); 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); const char *context = NULL, const char *comment = NULL);
status_t SetString(int32 id, const char *translated); status_t SetString(int32 id, const char *translated);
status_t SetString(const CatKey& key, 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 fPos;
CatMap::iterator fEnd; CatMap::iterator fEnd;
}; };
status_t GetWalker(CatWalker *walker); status_t GetWalker(CatWalker *walker);
}; };
inline inline
DefaultCatalog::CatWalker::CatWalker(CatMap &catMap) DefaultCatalog::CatWalker::CatWalker(CatMap &catMap)
: fPos(catMap.begin()), : fPos(catMap.begin()),
fEnd(catMap.end()) fEnd(catMap.end())
{ {
} }
inline bool inline bool
DefaultCatalog::CatWalker::AtEnd() const DefaultCatalog::CatWalker::AtEnd() const
{ {
return fPos == fEnd; return fPos == fEnd;
} }
inline const CatKey & inline const CatKey &
DefaultCatalog::CatWalker::GetKey() const DefaultCatalog::CatWalker::GetKey() const
{ {
assert(fPos != fEnd); assert(fPos != fEnd);
return fPos->first; return fPos->first;
} }
inline const char * inline const char *
DefaultCatalog::CatWalker::GetValue() const DefaultCatalog::CatWalker::GetValue() const
{ {
assert(fPos != fEnd); assert(fPos != fEnd);
return fPos->second.String(); return fPos->second.String();
} }
inline void inline void
DefaultCatalog::CatWalker::Next() DefaultCatalog::CatWalker::Next()
{ {
++fPos; ++fPos;
} }
inline status_t inline status_t
DefaultCatalog::GetWalker(CatWalker *walker) DefaultCatalog::GetWalker(CatWalker *walker)
{ {
if (!walker) if (!walker)
return B_BAD_VALUE; return B_BAD_VALUE;
*walker = CatWalker(fCatMap); *walker = CatWalker(fCatMap);
return B_OK; return B_OK;
} }
} // namespace BPrivate } // namespace BPrivate
+1 -1
View File
@@ -7,7 +7,7 @@
class BString; class BString;
class BFloatFormatImpl; class BFloatFormatImpl;
class _IMPEXP_LOCALE BFloatFormat : public BNumberFormat, public BFloatFormatParameters { class BFloatFormat : public BNumberFormat, public BFloatFormatParameters {
public: public:
BFloatFormat(const BFloatFormat &other); BFloatFormat(const BFloatFormat &other);
~BFloatFormat(); ~BFloatFormat();
+1 -1
View File
@@ -7,7 +7,7 @@ struct format_field_position;
class BFloatFormatParameters; class BFloatFormatParameters;
class BString; class BString;
class _IMPEXP_LOCALE BFloatFormatImpl : public BNumberFormatImpl { class BFloatFormatImpl : public BNumberFormatImpl {
public: public:
BFloatFormatImpl(); BFloatFormatImpl();
virtual ~BFloatFormatImpl(); virtual ~BFloatFormatImpl();
+1 -1
View File
@@ -10,7 +10,7 @@ enum float_format_type {
// number to be formatted // number to be formatted
}; };
class _IMPEXP_LOCALE BFloatFormatParameters : public BNumberFormatParameters { class BFloatFormatParameters : public BNumberFormatParameters {
public: public:
BFloatFormatParameters(const BFloatFormatParameters *parent = NULL); BFloatFormatParameters(const BFloatFormatParameters *parent = NULL);
BFloatFormatParameters(const BFloatFormatParameters &other); BFloatFormatParameters(const BFloatFormatParameters &other);
+2 -2
View File
@@ -24,7 +24,7 @@ enum {
}; };
// structure filled in while formatting // structure filled in while formatting
struct _IMPEXP_LOCALE format_field_position { struct format_field_position {
uint32 field_type; uint32 field_type;
int32 start; int32 start;
int32 length; int32 length;
@@ -32,7 +32,7 @@ struct _IMPEXP_LOCALE format_field_position {
class BFormatImpl; class BFormatImpl;
class _IMPEXP_LOCALE BFormat { class BFormat {
protected: protected:
BFormat(const BFormat &other); BFormat(const BFormat &other);
~BFormat(); ~BFormat();
+1 -3
View File
@@ -3,11 +3,9 @@
#include <SupportDefs.h> #include <SupportDefs.h>
#include <LocaleBuild.h>
class BFormatParameters; class BFormatParameters;
class _IMPEXP_LOCALE BFormatImpl { class BFormatImpl {
public: public:
BFormatImpl(); BFormatImpl();
virtual ~BFormatImpl(); virtual ~BFormatImpl();
+1 -3
View File
@@ -3,14 +3,12 @@
#include <SupportDefs.h> #include <SupportDefs.h>
#include <LocaleBuild.h>
enum format_alignment { enum format_alignment {
B_ALIGN_FORMAT_LEFT, // reuse B_ALIGN_LEFT/B_ALIGN_RIGHT? B_ALIGN_FORMAT_LEFT, // reuse B_ALIGN_LEFT/B_ALIGN_RIGHT?
B_ALIGN_FORMAT_RIGHT, B_ALIGN_FORMAT_RIGHT,
}; };
class _IMPEXP_LOCALE BFormatParameters { class BFormatParameters {
public: public:
BFormatParameters(const BFormatParameters *parent = NULL); BFormatParameters(const BFormatParameters *parent = NULL);
BFormatParameters(const BFormatParameters &other); BFormatParameters(const BFormatParameters &other);
+1 -1
View File
@@ -7,7 +7,7 @@
class BString; class BString;
struct format_field_position; struct format_field_position;
class _IMPEXP_LOCALE BGenericNumberFormat { class BGenericNumberFormat {
public: public:
BGenericNumberFormat(); BGenericNumberFormat();
~BGenericNumberFormat(); ~BGenericNumberFormat();
+1 -1
View File
@@ -12,7 +12,7 @@ class BString;
// and this class (and its base classes) should mirror the parameters // and this class (and its base classes) should mirror the parameters
// classes' accessor methods. // classes' accessor methods.
// //
class _IMPEXP_LOCALE BIntegerFormat : public BNumberFormat, public BIntegerFormatParameters { class BIntegerFormat : public BNumberFormat, public BIntegerFormatParameters {
public: public:
BIntegerFormat(const BIntegerFormat &other); BIntegerFormat(const BIntegerFormat &other);
~BIntegerFormat(); ~BIntegerFormat();
+1 -1
View File
@@ -7,7 +7,7 @@ struct format_field_position;
class BIntegerFormatParameters; class BIntegerFormatParameters;
class BString; class BString;
class _IMPEXP_LOCALE BIntegerFormatImpl : public BNumberFormatImpl { class BIntegerFormatImpl : public BNumberFormatImpl {
public: public:
BIntegerFormatImpl(); BIntegerFormatImpl();
virtual ~BIntegerFormatImpl(); virtual ~BIntegerFormatImpl();
+1 -1
View File
@@ -3,7 +3,7 @@
#include <NumberFormatParameters.h> #include <NumberFormatParameters.h>
class _IMPEXP_LOCALE BIntegerFormatParameters : public BNumberFormatParameters { class BIntegerFormatParameters : public BNumberFormatParameters {
public: public:
BIntegerFormatParameters(const BIntegerFormatParameters *parent = NULL); BIntegerFormatParameters(const BIntegerFormatParameters *parent = NULL);
BIntegerFormatParameters(const BIntegerFormatParameters &other); BIntegerFormatParameters(const BIntegerFormatParameters &other);
+1 -2
View File
@@ -3,7 +3,6 @@
#include <SupportDefs.h> #include <SupportDefs.h>
#include <LocaleBuild.h>
#include <LocaleStrings.h> #include <LocaleStrings.h>
@@ -14,7 +13,7 @@ enum script_direction {
}; };
class _IMPEXP_LOCALE BLanguage { class BLanguage {
public: public:
~BLanguage(); ~BLanguage();
+10 -12
View File
@@ -2,8 +2,6 @@
#define _B_LOCALE_H_ #define _B_LOCALE_H_
#include <LocaleBuild.h>
#include <Collator.h> #include <Collator.h>
#include <Language.h> #include <Language.h>
#include <Country.h> #include <Country.h>
@@ -13,7 +11,7 @@ class BCatalog;
class BString; class BString;
class _IMPEXP_LOCALE BLocale { class BLocale {
public: public:
BLocale(); BLocale();
~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; int StringCompare(const BString *, const BString *, int32 len = -1, int8 strength = B_COLLATE_DEFAULT) const;
void GetSortKey(const char *string, BString *key); void GetSortKey(const char *string, BString *key);
status_t GetAppCatalog(BCatalog *); status_t GetAppCatalog(BCatalog *);
protected: protected:
@@ -53,34 +51,34 @@ class _IMPEXP_LOCALE BLocale {
}; };
// global objects // global objects
extern _IMPEXP_LOCALE BLocale *be_locale; extern BLocale *be_locale;
extern _IMPEXP_LOCALE BLocaleRoster *be_locale_roster; extern BLocaleRoster *be_locale_roster;
//---------------------------------------------------------------------- //----------------------------------------------------------------------
//--- country short-hands inlines --- //--- country short-hands inlines ---
inline void inline void
BLocale::FormatDate(char *target, size_t maxSize, time_t timer, bool longFormat) BLocale::FormatDate(char *target, size_t maxSize, time_t timer, bool longFormat)
{ {
fCountry->FormatDate(target, maxSize, timer, longFormat); fCountry->FormatDate(target, maxSize, timer, longFormat);
} }
inline void inline void
BLocale::FormatDate(BString *target, time_t timer, bool longFormat) BLocale::FormatDate(BString *target, time_t timer, bool longFormat)
{ {
fCountry->FormatDate(target, timer, longFormat); fCountry->FormatDate(target, timer, longFormat);
} }
inline void inline void
BLocale::FormatTime(char *target, size_t maxSize, time_t timer, bool longFormat) BLocale::FormatTime(char *target, size_t maxSize, time_t timer, bool longFormat)
{ {
fCountry->FormatTime(target, maxSize, timer, longFormat); fCountry->FormatTime(target, maxSize, timer, longFormat);
} }
inline void inline void
BLocale::FormatTime(BString *target, time_t timer, bool longFormat) BLocale::FormatTime(BString *target, time_t timer, bool longFormat)
{ {
fCountry->FormatTime(target, timer, longFormat); fCountry->FormatTime(target, timer, longFormat);
@@ -90,14 +88,14 @@ BLocale::FormatTime(BString *target, time_t timer, bool longFormat)
//--- locale short-hands inlines --- //--- locale short-hands inlines ---
// #pragma mark - // #pragma mark -
inline int inline int
BLocale::StringCompare(const char *string1, const char *string2, int32 length, int8 strength) const BLocale::StringCompare(const char *string1, const char *string2, int32 length, int8 strength) const
{ {
return fCollator->Compare(string1, string2, length, strength); return fCollator->Compare(string1, string2, length, strength);
} }
inline int inline int
BLocale::StringCompare(const BString *string1, const BString *string2, int32 length, int8 strength) const BLocale::StringCompare(const BString *string1, const BString *string2, int32 length, int8 strength) const
{ {
return fCollator->Compare(string1->String(), string2->String(), length, strength); return fCollator->Compare(string1->String(), string2->String(), length, strength);
-12
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_ */
+6 -8
View File
@@ -1,8 +1,6 @@
#ifndef _LOCALE_ROSTER_H_ #ifndef _LOCALE_ROSTER_H_
#define _LOCALE_ROSTER_H_ #define _LOCALE_ROSTER_H_
#include <LocaleBuild.h>
#include <String.h> #include <String.h>
class BLanguage; class BLanguage;
@@ -20,7 +18,7 @@ enum {
B_LOCALE_CHANGED = '_LCC', B_LOCALE_CHANGED = '_LCC',
}; };
class _IMPEXP_LOCALE BLocaleRoster { class BLocaleRoster {
public: public:
BLocaleRoster(); BLocaleRoster();
@@ -35,14 +33,14 @@ class _IMPEXP_LOCALE BLocaleRoster {
status_t GetDefaultCollator(BCollator **) const; status_t GetDefaultCollator(BCollator **) const;
status_t GetDefaultLanguage(BLanguage **) const; status_t GetDefaultLanguage(BLanguage **) const;
status_t GetDefaultCountry(BCountry **) const; status_t GetDefaultCountry(BCountry **) const;
status_t GetPreferredLanguages(BMessage *) const; status_t GetPreferredLanguages(BMessage *) const;
status_t SetPreferredLanguages(BMessage *); 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) // which contain the language-name(s)
status_t GetInstalledLanguages(BMessage *) const; 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) // which contain the language-name(s)
status_t GetInstalledCatalogs(BMessage *, status_t GetInstalledCatalogs(BMessage *,
@@ -66,14 +64,14 @@ class _IMPEXP_LOCALE BLocaleRoster {
private: private:
BCatalogAddOn* LoadCatalog(const char *signature, BCatalogAddOn* LoadCatalog(const char *signature,
const char *language = NULL, const char *language = NULL,
int32 fingerprint = 0); int32 fingerprint = 0);
BCatalogAddOn* LoadEmbeddedCatalog(entry_ref *appOrAddOnRef); BCatalogAddOn* LoadEmbeddedCatalog(entry_ref *appOrAddOnRef);
status_t UnloadCatalog(BCatalogAddOn *addOn); status_t UnloadCatalog(BCatalogAddOn *addOn);
// //
BCatalogAddOn* CreateCatalog(const char *type, BCatalogAddOn* CreateCatalog(const char *type,
const char *signature, const char *signature,
const char *language); const char *language);
friend class BCatalog; friend class BCatalog;
+1 -1
View File
@@ -6,7 +6,7 @@
class BNumberFormatImpl; class BNumberFormatImpl;
class _IMPEXP_LOCALE BNumberFormat : public BFormat { class BNumberFormat : public BFormat {
protected: protected:
BNumberFormat(const BNumberFormat &other); BNumberFormat(const BNumberFormat &other);
~BNumberFormat(); ~BNumberFormat();
+1 -1
View File
@@ -6,7 +6,7 @@
struct format_field_position; struct format_field_position;
class BNumberFormatParameters; class BNumberFormatParameters;
class _IMPEXP_LOCALE BNumberFormatImpl : public BFormatImpl { class BNumberFormatImpl : public BFormatImpl {
public: public:
BNumberFormatImpl(); BNumberFormatImpl();
virtual ~BNumberFormatImpl(); virtual ~BNumberFormatImpl();
+1 -1
View File
@@ -20,7 +20,7 @@ enum number_format_base {
B_HEXADECIMAL_BASE = 16, B_HEXADECIMAL_BASE = 16,
}; };
class _IMPEXP_LOCALE BNumberFormatParameters : public BFormatParameters { class BNumberFormatParameters : public BFormatParameters {
public: public:
BNumberFormatParameters(const BNumberFormatParameters *parent = NULL); BNumberFormatParameters(const BNumberFormatParameters *parent = NULL);
BNumberFormatParameters(const BNumberFormatParameters &other); BNumberFormatParameters(const BNumberFormatParameters &other);
+8 -10
View File
@@ -3,8 +3,6 @@
#include <SupportDefs.h> #include <SupportDefs.h>
#include <LocaleBuild.h>
enum unicode_char_category enum unicode_char_category
{ {
// Non-category for unassigned and non-character code points. // 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. * This specifies the language directional property of a character set.
*/ */
enum unicode_char_direction { enum unicode_char_direction {
B_UNICODE_LEFT_TO_RIGHT = 0, B_UNICODE_LEFT_TO_RIGHT = 0,
B_UNICODE_RIGHT_TO_LEFT = 1, B_UNICODE_RIGHT_TO_LEFT = 1,
B_UNICODE_EUROPEAN_NUMBER = 2, B_UNICODE_EUROPEAN_NUMBER = 2,
B_UNICODE_EUROPEAN_NUMBER_SEPARATOR = 3, B_UNICODE_EUROPEAN_NUMBER_SEPARATOR = 3,
B_UNICODE_EUROPEAN_NUMBER_TERMINATOR = 4, B_UNICODE_EUROPEAN_NUMBER_TERMINATOR = 4,
@@ -59,8 +57,8 @@ enum unicode_char_direction {
B_UNICODE_COMMON_NUMBER_SEPARATOR = 6, B_UNICODE_COMMON_NUMBER_SEPARATOR = 6,
B_UNICODE_BLOCK_SEPARATOR = 7, B_UNICODE_BLOCK_SEPARATOR = 7,
B_UNICODE_SEGMENT_SEPARATOR = 8, B_UNICODE_SEGMENT_SEPARATOR = 8,
B_UNICODE_WHITE_SPACE_NEUTRAL = 9, B_UNICODE_WHITE_SPACE_NEUTRAL = 9,
B_UNICODE_OTHER_NEUTRAL = 10, B_UNICODE_OTHER_NEUTRAL = 10,
B_UNICODE_LEFT_TO_RIGHT_EMBEDDING = 11, B_UNICODE_LEFT_TO_RIGHT_EMBEDDING = 11,
B_UNICODE_LEFT_TO_RIGHT_OVERRIDE = 12, B_UNICODE_LEFT_TO_RIGHT_OVERRIDE = 12,
B_UNICODE_RIGHT_TO_LEFT_ARABIC = 13, B_UNICODE_RIGHT_TO_LEFT_ARABIC = 13,
@@ -69,7 +67,7 @@ enum unicode_char_direction {
B_UNICODE_POP_DIRECTIONAL_FORMAT = 16, B_UNICODE_POP_DIRECTIONAL_FORMAT = 16,
B_UNICODE_DIR_NON_SPACING_MARK = 17, B_UNICODE_DIR_NON_SPACING_MARK = 17,
B_UNICODE_BOUNDARY_NEUTRAL = 18, B_UNICODE_BOUNDARY_NEUTRAL = 18,
B_UNICODE_DIRECTION_COUNT B_UNICODE_DIRECTION_COUNT
}; };
@@ -188,7 +186,7 @@ enum unicode_cell_width
}; };
class _IMPEXP_LOCALE BUnicodeChar { class BUnicodeChar {
public: public:
static bool IsAlpha(uint32 c); static bool IsAlpha(uint32 c);
static bool IsAlNum(uint32 c); static bool IsAlNum(uint32 c);
@@ -224,7 +222,7 @@ class _IMPEXP_LOCALE BUnicodeChar {
}; };
inline uint32 inline uint32
BUnicodeChar::FromUTF8(const char *in) BUnicodeChar::FromUTF8(const char *in)
{ {
const char *string = in; const char *string = in;
+1 -3
View File
@@ -1,8 +1,6 @@
#ifndef _LANGINFO_H_ #ifndef _LANGINFO_H_
#define _LANGINFO_H_ #define _LANGINFO_H_
#include <LocaleBuild.h>
#include <LocaleStrings.h> #include <LocaleStrings.h>
#include <nl_types.h> #include <nl_types.h>
@@ -81,6 +79,6 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
_IMPEXP_LOCALE char *nl_langinfo(nl_item); char *nl_langinfo(nl_item);
#endif /* _LANGINFO_H_ */ #endif /* _LANGINFO_H_ */
+2 -4
View File
@@ -3,14 +3,12 @@
#include <stdarg.h> #include <stdarg.h>
#include <LocaleBuild.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
_IMPEXP_LOCALE ssize_t strfmon(char *string, size_t maxSize, const char *format, ...); 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 vstrfmon(char *string, size_t maxSize, const char *format, va_list args);
#ifdef __cplusplus #ifdef __cplusplus
} }
+1
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 disk_systems ;
SubInclude HAIKU_TOP src add-ons input_server ; SubInclude HAIKU_TOP src add-ons input_server ;
SubInclude HAIKU_TOP src add-ons kernel ; 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 mail_daemon ;
SubInclude HAIKU_TOP src add-ons media ; SubInclude HAIKU_TOP src add-ons media ;
SubInclude HAIKU_TOP src add-ons opengl ; SubInclude HAIKU_TOP src add-ons opengl ;
+3 -3
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 HAIKU_TOP src add-ons locale catalogs ;
SubInclude LOCALE_TOP add-ons collators ; SubInclude HAIKU_TOP src add-ons locale collators ;
+9 -2
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 ;
+7 -2
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
;
+19 -12
View File
@@ -1,15 +1,22 @@
SubDir LOCALE_TOP add-ons collators ; SubDir HAIKU_TOP src add-ons locale collators ;
rule Collator UsePublicHeaders locale ;
{
# Collator <sources> ;
local sources = $(1) ;
local name = $(sources[1]:B) ;
local rsrc = $(name:S=.rsrc) ;
AddResources $(name) : $(rsrc) ;
AddOn $(name) : $(sources) : be liblocale.so ;
}
Collator GermanDIN-2.cpp ; # Pseudo target to build all collator addons
Collator French.cpp ; 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
;
+1
View File
@@ -193,6 +193,7 @@ SubInclude HAIKU_TOP src bin ideinfo ;
SubInclude HAIKU_TOP src bin keymap ; SubInclude HAIKU_TOP src bin keymap ;
SubInclude HAIKU_TOP src bin less ; SubInclude HAIKU_TOP src bin less ;
SubInclude HAIKU_TOP src bin listdev ; SubInclude HAIKU_TOP src bin listdev ;
SubInclude HAIKU_TOP src bin locale ;
SubInclude HAIKU_TOP src bin make ; SubInclude HAIKU_TOP src bin make ;
SubInclude HAIKU_TOP src bin makebootable ; SubInclude HAIKU_TOP src bin makebootable ;
#SubInclude HAIKU_TOP src bin makeudfimage ; #SubInclude HAIKU_TOP src bin makeudfimage ;
+8 -7
View File
@@ -1,10 +1,11 @@
SubDir LOCALE_TOP apps ; SubDir HAIKU_TOP src bin locale ;
AddResources collectcatkeys : collectcatkeys.rsrc ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits tracker ] ;
Application collectcatkeys : collectcatkeys.cpp RegExp.cpp : be liblocale.so ;
AddResources linkcatkeys : linkcatkeys.rsrc ; UsePublicHeaders locale ;
Application linkcatkeys : linkcatkeys.cpp : be liblocale.so ;
AddResources dumpcatalog ; BinCommand collectcatkeys : collectcatkeys.cpp RegExp.cpp : be liblocale.so ;
Application dumpcatalog : dumpcatalog.cpp : be liblocale.so ;
BinCommand linkcatkeys : linkcatkeys.cpp : be liblocale.so ;
BinCommand dumpcatalog : dumpcatalog.cpp : be liblocale.so ;
+1 -13
View File
@@ -1,13 +1 @@
SubDir LOCALE_TOP languages ; SubDir HAIKU_TOP src data etc locale 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) ;
}
}
+1
View File
@@ -92,6 +92,7 @@ SubInclude HAIKU_TOP src kits debug ;
SubInclude HAIKU_TOP src kits device ; SubInclude HAIKU_TOP src kits device ;
SubInclude HAIKU_TOP src kits game ; SubInclude HAIKU_TOP src kits game ;
SubInclude HAIKU_TOP src kits interface ; SubInclude HAIKU_TOP src kits interface ;
SubInclude HAIKU_TOP src kits locale ;
SubInclude HAIKU_TOP src kits mail ; SubInclude HAIKU_TOP src kits mail ;
SubInclude HAIKU_TOP src kits media ; SubInclude HAIKU_TOP src kits media ;
SubInclude HAIKU_TOP src kits midi ; SubInclude HAIKU_TOP src kits midi ;
+4 -2
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 SharedLibrary liblocale.so
: adler32.c : adler32.c
+10 -38
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. * The required mimetypes and attribute-indices are created here.
*/ */
#include <syslog.h> #include <syslog.h>
#include <fs_attr.h> #include <fs_attr.h>
#include <fs_index.h> #include <fs_index.h>
#include <Volume.h> #include <Volume.h>
#include <VolumeRoster.h> #include <VolumeRoster.h>
@@ -14,7 +14,7 @@
#include <DefaultCatalog.h> #include <DefaultCatalog.h>
// helper function that makes sure an attribute-index exists: // helper function that makes sure an attribute-index exists:
static void EnsureIndexExists(const char *attrName) static void EnsureIndexExists(const char *attrName)
{ {
BVolume bootVol; BVolume bootVol;
BVolumeRoster volRoster; BVolumeRoster volRoster;
@@ -22,14 +22,14 @@ static void EnsureIndexExists(const char *attrName)
return; return;
struct index_info idxInfo; struct index_info idxInfo;
if (fs_stat_index(bootVol.Device(), attrName, &idxInfo) != 0) { 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); B_STRING_TYPE, 0);
if (res == 0) { if (res == 0) {
log_team(LOG_INFO, log_team(LOG_INFO,
"successfully created the required index for attribute %s", "successfully created the required index for attribute %s",
attrName); attrName);
} else { } else {
log_team(LOG_ERR, log_team(LOG_ERR,
"failed to create the required index for attribute %s (%s)", "failed to create the required index for attribute %s (%s)",
attrName, strerror(res)); attrName, strerror(res));
} }
@@ -47,7 +47,7 @@ SetupCatalogBasics()
// make sure the indices required for catalog-traversal are there: // make sure the indices required for catalog-traversal are there:
EnsureIndexExists(BLocaleRoster::kCatLangAttr); EnsureIndexExists(BLocaleRoster::kCatLangAttr);
EnsureIndexExists(BLocaleRoster::kCatSigAttr); EnsureIndexExists(BLocaleRoster::kCatSigAttr);
// install mimetype for default-catalog: // install mimetype for default-catalog:
BMimeType mt; BMimeType mt;
status_t res = mt.SetTo(DefaultCatalog::kCatMimeType); status_t res = mt.SetTo(DefaultCatalog::kCatMimeType);
@@ -58,7 +58,7 @@ SetupCatalogBasics()
if (res == B_OK && !supertype.IsInstalled()) { if (res == B_OK && !supertype.IsInstalled()) {
res = supertype.Install(); res = supertype.Install();
} }
if (res == B_OK) { if (res == B_OK) {
// info about the attributes of a catalog... // info about the attributes of a catalog...
BMessage attrMsg; BMessage attrMsg;
@@ -109,7 +109,7 @@ SetupCatalogBasics()
// preferred app is catalog manager: // preferred app is catalog manager:
res = mt.SetPreferredApp(BLocaleRoster::kCatManagerMimeType, B_OPEN); res = mt.SetPreferredApp(BLocaleRoster::kCatManagerMimeType, B_OPEN);
} }
if (res == B_OK) if (res == B_OK)
res = mt.Install(); res = mt.Install();
} }
@@ -120,37 +120,9 @@ SetupCatalogBasics()
} }
#if defined(__HAIKU__)
extern "C" extern "C"
_IMPEXP_LOCALE
void void
initialize_after() initialize_after()
{ {
SetupCatalogBasics(); 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
+3 -5
View File
@@ -4,16 +4,14 @@
*/ */
/* /*
* [zooey]: * [zooey]:
* This file has been adjusted from the original found in zlib * This file has been adjusted from the original found in zlib
* for better conformance to our style-guide. * for better conformance to our style-guide.
*/ */
#include <SupportDefs.h> #include <SupportDefs.h>
#include <LocaleBuild.h> uint32 adler32(uint32 adler, const uint8 *buf, uint32 len);
uint32 _IMPEXP_LOCALE adler32(uint32 adler, const uint8 *buf, uint32 len);
// prototype required by mwcc // prototype required by mwcc
#define BASE 65521L /* largest prime smaller than 65536 */ #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); #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 s1 = adler & 0xffff;
uint32 s2 = (adler >> 16) & 0xffff; uint32 s2 = (adler >> 16) & 0xffff;
+1
View File
@@ -12,6 +12,7 @@ SubInclude HAIKU_TOP src preferences fonts ;
SubInclude HAIKU_TOP src preferences joysticks ; SubInclude HAIKU_TOP src preferences joysticks ;
SubInclude HAIKU_TOP src preferences keyboard ; SubInclude HAIKU_TOP src preferences keyboard ;
SubInclude HAIKU_TOP src preferences keymap ; SubInclude HAIKU_TOP src preferences keymap ;
SubInclude HAIKU_TOP src preferences locale ;
SubInclude HAIKU_TOP src preferences mail ; SubInclude HAIKU_TOP src preferences mail ;
SubInclude HAIKU_TOP src preferences media ; SubInclude HAIKU_TOP src preferences media ;
SubInclude HAIKU_TOP src preferences menu ; SubInclude HAIKU_TOP src preferences menu ;
+5 -5
View File
@@ -1,8 +1,8 @@
SubDir LOCALE_TOP preferences ; SubDir HAIKU_TOP src preferences locale ;
AddResources Locale : Locale.rsrc ; Preference Locale :
Application Locale :
Locale.cpp Locale.cpp
LocaleWindow.cpp LocaleWindow.cpp
: be liblocale.so ; : be liblocale.so
# : Locale.rdef
;
+1
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 app ;
SubInclude HAIKU_TOP src tests kits game ; SubInclude HAIKU_TOP src tests kits game ;
SubInclude HAIKU_TOP src tests kits interface ; 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 media ;
SubInclude HAIKU_TOP src tests kits midi ; SubInclude HAIKU_TOP src tests kits midi ;
SubInclude HAIKU_TOP src tests kits net ; SubInclude HAIKU_TOP src tests kits net ;
+35 -16
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 sources = $(1) ;
local name = $(sources[1]:B) ; local name = $(sources[1]:B) ;
Application $(name) : $(sources) : be liblocale.so ; Application $(name) : $(sources) : be liblocale.so ;
} }
SimpleTest localeTest.cpp ; LocaleTest catalogSpeed.cpp ;
SimpleTest collatorTest.cpp ; LocaleTest catalogTest.cpp ;
SimpleTest collatorSpeed.cpp ; LocaleTest collatorSpeed.cpp ;
SimpleTest catalogTest.cpp ; LocaleTest collatorTest.cpp ;
AddOn catalogTestAddOn : catalogTestAddOn.cpp : be liblocale.so ; LocaleTest genericNumberFormatTest.cpp ;
SimpleTest catalogSpeed.cpp ; LocaleTest localeTest.cpp ;
SimpleTest genericNumberFormatTest.cpp ;
Addon catalogTestAddOn
: catalogTestAddOn.cpp
: be liblocale.so
;
# For the unit tests we need liblocale.so to live in the `lib' subdirectory # 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 # of the UnitTester application. We simply create a symlink that can be
# referred to by `<unittests>liblocale.so'. # referred to by `<unittests>liblocale.so'.
{ #{
local symlink = <unittests>liblocale.so ; # local symlink = <unittests>liblocale.so ;
MakeLocate $(symlink) : [ FDirName $(LOCALE_UNITTESTS_DIR) lib ] ; # MakeLocate $(symlink) : [ FDirName $(LOCALE_UNITTESTS_DIR) lib ] ;
RelSymLink $(symlink) : liblocale.so ; # 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 ;
+4 -2
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 ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) generic_number_format ] ;
@@ -9,5 +11,5 @@ UnitTest NumberFormatTests
GenericNumberFormatTests.cpp GenericNumberFormatTests.cpp
GenericNumberFormatConstructorTest.cpp GenericNumberFormatConstructorTest.cpp
: be <unittests>liblocale.so : be liblocale.so
; ;
+1
View File
@@ -113,6 +113,7 @@ SubInclude HAIKU_TOP src tools fs_shell ;
SubInclude HAIKU_TOP src tools gensyscalls ; SubInclude HAIKU_TOP src tools gensyscalls ;
SubInclude HAIKU_TOP src tools hack_coff ; SubInclude HAIKU_TOP src tools hack_coff ;
SubInclude HAIKU_TOP src tools keymap ; SubInclude HAIKU_TOP src tools keymap ;
SubInclude HAIKU_TOP src tools locale ;
SubInclude HAIKU_TOP src tools makebootable ; SubInclude HAIKU_TOP src tools makebootable ;
SubInclude HAIKU_TOP src tools rc ; SubInclude HAIKU_TOP src tools rc ;
SubInclude HAIKU_TOP src tools remote_disk_server ; SubInclude HAIKU_TOP src tools remote_disk_server ;
+2 -2
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 ;
+7 -3
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
;