[haiku-commits] r33983 - in haiku/trunk: build/jam headers/os/locale src/data src/data/etc src/kits/locale

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 10 Nov 2009 14:44:22 +0100 (CET)

Author: axeld
Date: 2009-11-10 14:44:22 +0100 (Tue, 10 Nov 2009)
New Revision: 33983
Changeset: http://dev.haiku-os.org/changeset/33983/haiku

Added:
   haiku/trunk/src/data/locale/
Removed:
   haiku/trunk/src/data/etc/locale/
Modified:
   haiku/trunk/build/jam/BeOSRules
   haiku/trunk/build/jam/HaikuImage
   haiku/trunk/headers/os/locale/LocaleRoster.h
   haiku/trunk/src/kits/locale/DefaultCatalog.cpp
   haiku/trunk/src/kits/locale/Language.cpp
   haiku/trunk/src/kits/locale/LocaleRoster.cpp
   haiku/trunk/src/kits/locale/PropertyFile.cpp
Log:
* LocaleRoster.h was not self-containing.
* Moved the locale stuff to the data directory as well (some parts were in 
/etc).
* The DefaultCatalog will now also scan the user directory for catalogs.
* Minor cleanup.


Modified: haiku/trunk/build/jam/BeOSRules
===================================================================
--- haiku/trunk/build/jam/BeOSRules     2009-11-10 13:09:32 UTC (rev 33982)
+++ haiku/trunk/build/jam/BeOSRules     2009-11-10 13:44:22 UTC (rev 33983)
@@ -276,7 +276,7 @@
 # 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 @@
                        : $(signature) : $(catalog:B) ;
        }
        
-       AddFilesToHaikuImage system etc locale catalogs $(signature) :
+       AddFilesToHaikuImage system data locale catalogs $(signature) :
                $(genCat) $(trans:S=.catalog) ;
 }

Modified: haiku/trunk/build/jam/HaikuImage
===================================================================
--- haiku/trunk/build/jam/HaikuImage    2009-11-10 13:09:32 UTC (rev 33982)
+++ haiku/trunk/build/jam/HaikuImage    2009-11-10 13:44:22 UTC (rev 33983)
@@ -384,7 +384,7 @@
 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 @@
        : 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

Modified: haiku/trunk/headers/os/locale/LocaleRoster.h
===================================================================
--- haiku/trunk/headers/os/locale/LocaleRoster.h        2009-11-10 13:09:32 UTC 
(rev 33982)
+++ haiku/trunk/headers/os/locale/LocaleRoster.h        2009-11-10 13:44:22 UTC 
(rev 33983)
@@ -11,6 +11,7 @@
 class BCountry;
 class BCatalog;
 class BCatalogAddOn;
+class BMessage;
 
 struct entry_ref;
 

Modified: haiku/trunk/src/kits/locale/DefaultCatalog.cpp
===================================================================
--- haiku/trunk/src/kits/locale/DefaultCatalog.cpp      2009-11-10 13:09:32 UTC 
(rev 33982)
+++ haiku/trunk/src/kits/locale/DefaultCatalog.cpp      2009-11-10 13:44:22 UTC 
(rev 33983)
@@ -36,11 +36,10 @@
 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 @@
 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 @@
        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 @@
 }
 
 
-/*
- * 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 @@
 }
 
 
-/*
- * 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 @@
 }
 
 
-/*
- * 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 @@
        }
        return catalog;
 }
-
-
-const uint8 DefaultCatalog::kDefaultCatalogAddOnPriority = 1;
-       // give highest priority to our embedded catalog-add-on

Modified: haiku/trunk/src/kits/locale/Language.cpp
===================================================================
--- haiku/trunk/src/kits/locale/Language.cpp    2009-11-10 13:09:32 UTC (rev 
33982)
+++ haiku/trunk/src/kits/locale/Language.cpp    2009-11-10 13:44:22 UTC (rev 
33983)
@@ -1,7 +1,7 @@
 /*
-** Copyright 2003, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx All rights reserved.
-** Distributed under the terms of the MIT License.
-*/
+ * Copyright 2003-2009, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
+ * Distributed under the terms of the MIT License.
+ */
 
 
 #include <Language.h>

Modified: haiku/trunk/src/kits/locale/LocaleRoster.cpp
===================================================================
--- haiku/trunk/src/kits/locale/LocaleRoster.cpp        2009-11-10 13:09:32 UTC 
(rev 33982)
+++ haiku/trunk/src/kits/locale/LocaleRoster.cpp        2009-11-10 13:44:22 UTC 
(rev 33983)
@@ -1,11 +1,15 @@
 /*
-** Distributed under the terms of the OpenBeOS License.
-** Copyright 2003-2004. All rights reserved.
-**
-** Authors:    Axel Dörfler, axeld@xxxxxxxxxxxxxxxx
-**                     Oliver Tappe, zooey@xxxxxxxxxxxxxxx
-*/
+ * Copyright 2003-2004, Haiku. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             Axel Dörfler, axeld@xxxxxxxxxxxxxxxx
+ *             Oliver Tappe, zooey@xxxxxxxxxxxxxxx
+ */
 
+
+#include <LocaleRoster.h>
+
 #include <set>
 
 #include <assert.h>
@@ -23,7 +27,6 @@
 #include <FindDirectory.h>
 #include <Language.h>
 #include <Locale.h>
-#include <LocaleRoster.h>
 #include <Node.h>
 #include <Path.h>
 #include <String.h>
@@ -177,7 +180,7 @@
 
        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) {

Modified: haiku/trunk/src/kits/locale/PropertyFile.cpp
===================================================================
--- haiku/trunk/src/kits/locale/PropertyFile.cpp        2009-11-10 13:09:32 UTC 
(rev 33982)
+++ haiku/trunk/src/kits/locale/PropertyFile.cpp        2009-11-10 13:44:22 UTC 
(rev 33983)
@@ -1,7 +1,7 @@
-/* 
-** Copyright 2003, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx All rights reserved.
-** Distributed under the terms of the OpenBeOS License.
-*/
+/*
+ * Copyright 2003-2009, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
+ * Distributed under the terms of the MIT License.
+ */
 
 
 #include "PropertyFile.h"
@@ -10,18 +10,13 @@
 #include <Path.h>
 #include <FindDirectory.h>
 
-#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);


Other related posts:

  • » [haiku-commits] r33983 - in haiku/trunk: build/jam headers/os/locale src/data src/data/etc src/kits/locale - axeld