diff --git a/build/jam/BeOSRules b/build/jam/BeOSRules index 1a4baeb167..759e2016c5 100644 --- a/build/jam/BeOSRules +++ b/build/jam/BeOSRules @@ -276,7 +276,7 @@ actions ResAttr1 # linkcatkeys. rule ExtractCatalogEntries target : source : signature { -# get compiler and defines for the platform + # get compiler and defines for the platform local headers ; local sysHeaders ; local cc ; @@ -381,6 +381,6 @@ rule DoCatalogs appName # Application name : $(signature) : $(catalog:B) ; } - AddFilesToHaikuImage system etc locale catalogs $(signature) : + AddFilesToHaikuImage system data locale catalogs $(signature) : $(genCat) $(trans:S=.catalog) ; } diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index 7649de73f7..c26387f249 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -384,7 +384,7 @@ SEARCH on $(spellFiles) AddFilesToHaikuImage system etc word_dictionary : $(spellFiles) ; # Locale kit language files -local languageDir = [ FDirName $(HAIKU_TOP) src data etc locale languages ] ; +local languageDir = [ FDirName $(HAIKU_TOP) src data locale languages ] ; local languages = [ Glob $(languageDir) : *.language ] ; AddFilesToHaikuImage system data locale languages : $(languages) ; @@ -491,17 +491,21 @@ AddFilesToHaikuImage system add-ons opengl : Mesa\ Software\ Renderer ; AddFilesToHaikuHybridImage system add-ons Translators : $(SYSTEM_ADD_ONS_TRANSLATORS) : : true ; -AddFilesToHaikuImage system add-ons locale catalogs : $(SYSTEM_ADD_ONS_LOCALE_CATALOGS) ; +AddFilesToHaikuImage system add-ons locale catalogs + : $(SYSTEM_ADD_ONS_LOCALE_CATALOGS) ; AddFilesToHaikuImage system add-ons mail_daemon inbound_protocols : POP3 IMAP ; AddFilesToHaikuImage system add-ons mail_daemon outbound_protocols : SMTP ; -AddFilesToHaikuImage system add-ons mail_daemon inbound_filters : Match\ Header Spam\ Filter R5\ Daemon\ Filter ; +AddFilesToHaikuImage system add-ons mail_daemon inbound_filters + : Match\ Header Spam\ Filter R5\ Daemon\ Filter ; AddFilesToHaikuImage system add-ons mail_daemon outbound_filters : Fortune ; -AddFilesToHaikuImage system add-ons mail_daemon system_filters : Inbox New\ Mail\ Notification Outbox Message\ Parser ; +AddFilesToHaikuImage system add-ons mail_daemon system_filters + : Inbox New\ Mail\ Notification Outbox Message\ Parser ; AddFilesToHaikuImage system add-ons media : $(SYSTEM_ADD_ONS_MEDIA) ; AddFilesToHaikuImage system add-ons media plugins : $(SYSTEM_ADD_ONS_MEDIA_PLUGINS) ; AddFilesToHaikuImage system add-ons Tracker - : FileType-F Mark\ as… Mark\ as\ Read-R Open\ Target\ Folder-O OpenTerminal-T ZipOMatic-Z ; + : FileType-F Mark\ as… Mark\ as\ Read-R Open\ Target\ Folder-O OpenTerminal-T + ZipOMatic-Z ; AddSymlinkToHaikuImage system add-ons Tracker : /boot/system/preferences/Backgrounds : Background-B ; AddSymlinkToHaikuImage system add-ons Tracker diff --git a/headers/os/locale/LocaleRoster.h b/headers/os/locale/LocaleRoster.h index afd8a1dc4b..8b96f5b9fb 100644 --- a/headers/os/locale/LocaleRoster.h +++ b/headers/os/locale/LocaleRoster.h @@ -11,6 +11,7 @@ class BCollator; class BCountry; class BCatalog; class BCatalogAddOn; +class BMessage; struct entry_ref; diff --git a/src/data/etc/locale/languages/Jamfile b/src/data/locale/languages/Jamfile similarity index 100% rename from src/data/etc/locale/languages/Jamfile rename to src/data/locale/languages/Jamfile diff --git a/src/data/etc/locale/languages/deutsch.language b/src/data/locale/languages/deutsch.language similarity index 100% rename from src/data/etc/locale/languages/deutsch.language rename to src/data/locale/languages/deutsch.language diff --git a/src/data/etc/locale/languages/francais.language b/src/data/locale/languages/francais.language similarity index 100% rename from src/data/etc/locale/languages/francais.language rename to src/data/locale/languages/francais.language diff --git a/src/kits/locale/DefaultCatalog.cpp b/src/kits/locale/DefaultCatalog.cpp index 22fb8d8bfb..953164da34 100644 --- a/src/kits/locale/DefaultCatalog.cpp +++ b/src/kits/locale/DefaultCatalog.cpp @@ -36,11 +36,10 @@ using std::max; using std::pair; -/* - * This file implements the default catalog-type for the opentracker locale - * kit. Alternatively, this could be used as a full add-on, but currently this - * is provided as part of liblocale.so. - */ +/*! This file implements the default catalog-type for the opentracker locale + kit. Alternatively, this could be used as a full add-on, but currently this + is provided as part of liblocale.so. +*/ static const char *kCatFolder = "catalogs"; @@ -52,13 +51,15 @@ const char *DefaultCatalog::kCatMimeType static int16 kCatArchiveVersion = 1; // version of the catalog archive structure, bump this if you change it! +const uint8 DefaultCatalog::kDefaultCatalogAddOnPriority = 1; + // give highest priority to our embedded catalog-add-on -/* - * constructs a DefaultCatalog with given signature and language and reads - * the catalog from disk. - * InitCheck() will be B_OK if catalog could be loaded successfully, it will - * give an appropriate error-code otherwise. - */ + +/*! Constructs a DefaultCatalog with given signature and language and reads + the catalog from disk. + InitCheck() will be B_OK if catalog could be loaded successfully, it will + give an appropriate error-code otherwise. +*/ DefaultCatalog::DefaultCatalog(const char *signature, const char *language, uint32 fingerprint) : @@ -80,30 +81,26 @@ DefaultCatalog::DefaultCatalog(const char *signature, const char *language, status_t status = ReadFromFile(catalogPath.Path()); if (status != B_OK) { - // look in common-etc folder (/boot/home/config/etc): - BPath commonEtcPath; - find_directory(B_COMMON_ETC_DIRECTORY, &commonEtcPath); - if (commonEtcPath.InitCheck() == B_OK) { - catalogName = BString(commonEtcPath.Path()) - << "/locale/" << kCatFolder - << "/" << fSignature - << "/" << fLanguageName - << kCatExtension; - status = ReadFromFile(catalogName.String()); - } - } + // search in data folders - if (status != B_OK) { - // look in system-etc folder (/boot/beos/etc): - BPath systemEtcPath; - find_directory(B_BEOS_ETC_DIRECTORY, &systemEtcPath); - if (systemEtcPath.InitCheck() == B_OK) { - catalogName = BString(systemEtcPath.Path()) - << "/locale/" << kCatFolder - << "/" << fSignature - << "/" << fLanguageName - << kCatExtension; - status = ReadFromFile(catalogName.String()); + directory_which which[] = { + B_USER_DATA_DIRECTORY, + B_COMMON_DATA_DIRECTORY, + B_SYSTEM_DATA_DIRECTORY + }; + + for (size_t i = 0; i < sizeof(which) / sizeof(which[0]); i++) { + BPath path; + if (find_directory(which[i], &path) == B_OK) { + catalogName = BString(path.Path()) + << "/locale/" << kCatFolder + << "/" << fSignature + << "/" << fLanguageName + << kCatExtension; + status = ReadFromFile(catalogName.String()); + if (status == B_OK) + break; + } } } @@ -114,12 +111,11 @@ DefaultCatalog::DefaultCatalog(const char *signature, const char *language, } -/* - * constructs a DefaultCatalog and reads it from the resources of the - * given entry-ref (which usually is an app- or add-on-file). - * InitCheck() will be B_OK if catalog could be loaded successfully, it will - * give an appropriate error-code otherwise. - */ +/*! Constructs a DefaultCatalog and reads it from the resources of the + given entry-ref (which usually is an app- or add-on-file). + InitCheck() will be B_OK if catalog could be loaded successfully, it will + give an appropriate error-code otherwise. +*/ DefaultCatalog::DefaultCatalog(entry_ref *appOrAddOnRef) : BHashMapCatalog("", "", 0) @@ -131,11 +127,10 @@ DefaultCatalog::DefaultCatalog(entry_ref *appOrAddOnRef) } -/* - * constructs an empty DefaultCatalog with given sig and language. - * This is used for editing/testing purposes. - * InitCheck() will always be B_OK. - */ +/*! Constructs an empty DefaultCatalog with given sig and language. + This is used for editing/testing purposes. + InitCheck() will always be B_OK. +*/ DefaultCatalog::DefaultCatalog(const char *path, const char *signature, const char *language) : @@ -387,10 +382,9 @@ DefaultCatalog::WriteToResource(entry_ref *appOrAddOnRef) } -/* - * writes mimetype, language-name and signature of catalog into the - * catalog-file. - */ +/*! Writes mimetype, language-name and signature of catalog into the + catalog-file. +*/ void DefaultCatalog::UpdateAttributes(BFile& catalogFile) { @@ -581,7 +575,3 @@ DefaultCatalog::Create(const char *signature, const char *language) } return catalog; } - - -const uint8 DefaultCatalog::kDefaultCatalogAddOnPriority = 1; - // give highest priority to our embedded catalog-add-on diff --git a/src/kits/locale/Language.cpp b/src/kits/locale/Language.cpp index f55caeb4bd..e113d91a86 100644 --- a/src/kits/locale/Language.cpp +++ b/src/kits/locale/Language.cpp @@ -1,7 +1,7 @@ /* -** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the MIT License. -*/ + * Copyright 2003-2009, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ #include diff --git a/src/kits/locale/LocaleRoster.cpp b/src/kits/locale/LocaleRoster.cpp index 9252454c84..badb8f518c 100644 --- a/src/kits/locale/LocaleRoster.cpp +++ b/src/kits/locale/LocaleRoster.cpp @@ -1,10 +1,14 @@ /* -** Distributed under the terms of the OpenBeOS License. -** Copyright 2003-2004. All rights reserved. -** -** Authors: Axel Dörfler, axeld@pinc-software.de -** Oliver Tappe, zooey@hirschkaefer.de -*/ + * Copyright 2003-2004, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Axel Dörfler, axeld@pinc-software.de + * Oliver Tappe, zooey@hirschkaefer.de + */ + + +#include #include @@ -23,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -177,7 +180,7 @@ RosterData::RosterData() InitializeCatalogAddOns(); - // Load preferences to get the preffered languages + // Load preferences to get the preferred languages BPath path; BFile file; if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) { diff --git a/src/kits/locale/PropertyFile.cpp b/src/kits/locale/PropertyFile.cpp index eabf2aa757..aac95e1048 100644 --- a/src/kits/locale/PropertyFile.cpp +++ b/src/kits/locale/PropertyFile.cpp @@ -1,7 +1,7 @@ -/* -** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ +/* + * Copyright 2003-2009, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ #include "PropertyFile.h" @@ -10,18 +10,13 @@ #include #include -#if B_BEOS_VERSION <= B_BEOS_VERSION_5 && !defined(__HAIKU__) -// B_BAD_DATA was introduced with DANO, so we define it for R5: -# define B_BAD_DATA -2147483632L -#endif - status_t PropertyFile::SetTo(const char *directory, const char *name) { BPath path; - status_t status = find_directory(B_BEOS_ETC_DIRECTORY, &path); - if (status < B_OK) + status_t status = find_directory(B_BEOS_DATA_DIRECTORY, &path); + if (status != B_OK) return status; path.Append(directory);