hrev44546 adds 2 changesets to branch 'master' old head: 468f826656ee77d64ab966e6077db259ee0db619 new head: e19d7089a71bf8a977e7751cdfc2340af22ff2a3 ---------------------------------------------------------------------------- 2bcc7f4: Simplify use of translated strings in BAboutWindow. * avoid duplicate initialization of variables by joining the expressions. e19d708: Fix #8841 (broken localization support for 3rd-party apps). * made private Catalog.h header public by moving it to os/locale/tools/CollectingCatalog.h * reintroduce B_COLLECTING_CATKEYS define (which is expected to be set during a collectcatkeys session) in order to decide whether or not to automatically include the CollecingCatalog.h header from Catalog.h * adjust jam rule for collecting catalog keys accordingly [ Oliver Tappe <zooey@xxxxxxxxxxxxxxx> ] ---------------------------------------------------------------------------- 4 files changed, 24 insertions(+), 23 deletions(-) build/jam/LocaleRules | 9 +++----- headers/os/locale/Catalog.h | 11 +++++++++- .../locale/tools/CollectingCatalog.h} | 9 ++------ src/kits/shared/AboutWindow.cpp | 18 ++++++++-------- ############################################################################ Commit: 2bcc7f40c3c5bb7128139bd73c2efe3ce1a177dc URL: http://cgit.haiku-os.org/haiku/commit/?id=2bcc7f4 Author: Oliver Tappe <zooey@xxxxxxxxxxxxxxx> Date: Thu Aug 16 19:04:57 2012 UTC Simplify use of translated strings in BAboutWindow. * avoid duplicate initialization of variables by joining the expressions. ---------------------------------------------------------------------------- diff --git a/src/kits/shared/AboutWindow.cpp b/src/kits/shared/AboutWindow.cpp index 07930ec..e8fbe72 100644 --- a/src/kits/shared/AboutWindow.cpp +++ b/src/kits/shared/AboutWindow.cpp @@ -29,11 +29,11 @@ BAboutWindow::BAboutWindow(const char *appName, int32 firstCopyrightYear, { fAppName = new BString(appName); - const char* copyright = B_TRANSLATE_MARK("Copyright " B_UTF8_COPYRIGHT - " %years% Haiku, Inc."); - const char* writtenBy = B_TRANSLATE_MARK("Written by:"); - copyright = gSystemCatalog.GetString(copyright, "AboutWindow"); - writtenBy = gSystemCatalog.GetString(writtenBy, "AboutWindow"); + const char* copyright = gSystemCatalog.GetString( + B_TRANSLATE_MARK("Copyright " B_UTF8_COPYRIGHT " %years% Haiku, Inc."), + "AboutWindow"); + const char* writtenBy = gSystemCatalog.GetString( + B_TRANSLATE_MARK("Written by:"), "AboutWindow"); // Get current year time_t tp; @@ -75,10 +75,10 @@ BAboutWindow::~BAboutWindow() void BAboutWindow::Show() { - const char* aboutTitle = B_TRANSLATE_MARK("About" B_UTF8_ELLIPSIS); - const char* closeLabel = B_TRANSLATE_MARK("Close"); - aboutTitle = gSystemCatalog.GetString(aboutTitle, "AboutWindow"); - closeLabel = gSystemCatalog.GetString(closeLabel, "AboutWindow"); + const char* aboutTitle = gSystemCatalog.GetString( + B_TRANSLATE_MARK("About" B_UTF8_ELLIPSIS), "AboutWindow"); + const char* closeLabel = gSystemCatalog.GetString( + B_TRANSLATE_MARK("Close"), "AboutWindow"); BAlert *alert = new BAlert(aboutTitle, fText->String(), closeLabel); BTextView *view = alert->TextView(); ############################################################################ Revision: hrev44546 Commit: e19d7089a71bf8a977e7751cdfc2340af22ff2a3 URL: http://cgit.haiku-os.org/haiku/commit/?id=e19d708 Author: Oliver Tappe <zooey@xxxxxxxxxxxxxxx> Date: Thu Aug 16 19:10:53 2012 UTC Ticket: https://dev.haiku-os.org/ticket/8841 Fix #8841 (broken localization support for 3rd-party apps). * made private Catalog.h header public by moving it to os/locale/tools/CollectingCatalog.h * reintroduce B_COLLECTING_CATKEYS define (which is expected to be set during a collectcatkeys session) in order to decide whether or not to automatically include the CollecingCatalog.h header from Catalog.h * adjust jam rule for collecting catalog keys accordingly ---------------------------------------------------------------------------- diff --git a/build/jam/LocaleRules b/build/jam/LocaleRules index 55b661f..7fcfd69 100644 --- a/build/jam/LocaleRules +++ b/build/jam/LocaleRules @@ -17,11 +17,7 @@ rule ExtractCatalogEntries target : sources : signature : regexp defines = $(DEFINES) ; headers = $(HAIKU_CONFIG_HEADERS) $(SEARCH_SOURCE) $(SUBDIRHDRS) $(HDRS) ; - - # insert specific header folder containing the Catalog.h that should be - # used when collecting the catalog keys: - sysHeaders = [ FDirName $(HAIKU_TOP) headers private locale collecting ] - $(SUBDIRSYSHDRS) $(SYSHDRS) ; + sysHeaders = $(SUBDIRSYSHDRS) $(SYSHDRS) ; if $(PLATFORM) = host { sysHeaders += $(HOST_HDRS) ; @@ -71,7 +67,8 @@ rule ExtractCatalogEntries target : sources : signature : regexp actions ExtractCatalogEntries1 { $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) - cat "$(2[2-])" | $(CC) -E $(CCDEFS) $(HDRS) - > "$(1)".pre + cat "$(2[2-])" \ + | $(CC) -E $(CCDEFS) -DB_COLLECTING_CATKEYS $(HDRS) - > "$(1)".pre $(2[1]) $(HAIKU_CATALOG_REGEXP) -s $(HAIKU_CATALOG_SIGNATURE) \ -w -o "$(1)" "$(1)".pre } diff --git a/headers/os/locale/Catalog.h b/headers/os/locale/Catalog.h index 17f6653..2d0664f 100644 --- a/headers/os/locale/Catalog.h +++ b/headers/os/locale/Catalog.h @@ -86,6 +86,13 @@ private: // Tip: Use a descriptive name of the class implemented in that // source-file. +#ifdef B_COLLECTING_CATKEYS + +// pull in all the macros used when collecting catalog keys. +#include <tools/CollectingCatalog.h> + +#else + // Translation macros which may be used to shorten translation requests: #undef B_TRANSLATE #define B_TRANSLATE(string) \ @@ -172,7 +179,7 @@ private: #undef B_TRANSLATE_MARK_SYSTEM_NAME_VOID #define B_TRANSLATE_MARK_SYSTEM_NAME_VOID(string) -// Translation macros which do not let collectcatkeys try to collect the key +// Translation macros which cause collectcatkeys to ignore this key // (useful in combination with the marking macros above): #undef B_TRANSLATE_NOCOLLECT #define B_TRANSLATE_NOCOLLECT(string) \ @@ -194,6 +201,8 @@ private: #define B_TRANSLATE_NOCOLLECT_SYSTEM_NAME(string) \ B_TRANSLATE_SYSTEM_NAME(string) +#endif /* B_COLLECTING_CATKEYS */ + #endif /* B_AVOID_TRANSLATION_MACROS */ diff --git a/headers/private/locale/collecting/Catalog.h b/headers/os/locale/tools/CollectingCatalog.h similarity index 95% rename from headers/private/locale/collecting/Catalog.h rename to headers/os/locale/tools/CollectingCatalog.h index 53db39c..49e32bc 100644 --- a/headers/private/locale/collecting/Catalog.h +++ b/headers/os/locale/tools/CollectingCatalog.h @@ -2,16 +2,11 @@ * Copyright 2012, Haiku, Inc. * Distributed under the terms of the MIT License. */ -#ifndef _COLLECTING_CATALOG_H_ -#define _COLLECTING_CATALOG_H_ - - -#include_next <Catalog.h> +#ifndef _TOOLS_COLLECTING_CATALOG_H_ +#define _TOOLS_COLLECTING_CATALOG_H_ // Translation macros used when executing collectcatkeys -#undef B_TRANSLATION_CONTEXT - #undef B_TRANSLATE #define B_TRANSLATE(string) \ B_CATKEY((string), B_TRANSLATION_CONTEXT)