From 09bb8269ac18ccf92315ff2a8b785fd06f021499 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 25 Sep 2016 15:10:12 +0200 Subject: [PATCH] Tracker: localize RegExp errors. These were left out because the same RegExp.cpp file is also used by collectcatkeys. This needed some jam file changes to get collectcatkeys to build on both the host and target. Fixes the last remaining part of #6374. --- src/bin/locale/Jamfile | 2 +- src/kits/tracker/RegExp.cpp | 38 +++++++++++++++++++++---------------- src/tools/locale/Jamfile | 3 +++ 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/bin/locale/Jamfile b/src/bin/locale/Jamfile index 0a5ce382b9..2b3dc95bd9 100644 --- a/src/bin/locale/Jamfile +++ b/src/bin/locale/Jamfile @@ -6,7 +6,7 @@ UsePublicHeaders locale ; UsePrivateHeaders locale shared ; BinCommand collectcatkeys : collectcatkeys.cpp RegExp.cpp - : be [ TargetLibsupc++ ] ; + : be localestub [ TargetLibsupc++ ] ; BinCommand linkcatkeys : linkcatkeys.cpp : be [ TargetLibstdc++ ] ; diff --git a/src/kits/tracker/RegExp.cpp b/src/kits/tracker/RegExp.cpp index 7e98f40729..fcf980bc8f 100644 --- a/src/kits/tracker/RegExp.cpp +++ b/src/kits/tracker/RegExp.cpp @@ -66,11 +66,16 @@ All rights reserved. #include #include +#include #include #include "RegExp.h" +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "libtracker" + + // The first byte of the regexp internal "program" is actually this magic // number; the start node begins in the second byte. @@ -179,21 +184,21 @@ enum { const char* kRegExpErrorStringArray[] = { - "Unmatched parenthesis.", - "Expression too long.", - "Too many parenthesis.", - "Junk on end.", - "*+? operand may be empty.", - "Nested *?+.", - "Invalid bracket range.", - "Unmatched brackets.", - "Internal error.", - "?+* follows nothing.", - "Trailing \\.", - "Corrupted expression.", - "Memory corruption.", - "Corrupted pointers.", - "Corrupted opcode." + B_TRANSLATE_MARK("Unmatched parenthesis."), + B_TRANSLATE_MARK("Expression too long."), + B_TRANSLATE_MARK("Too many parenthesis."), + B_TRANSLATE_MARK("Junk on end."), + B_TRANSLATE_MARK("*+? operand may be empty."), + B_TRANSLATE_MARK("Nested *?+."), + B_TRANSLATE_MARK("Invalid bracket range."), + B_TRANSLATE_MARK("Unmatched brackets."), + B_TRANSLATE_MARK("Internal error."), + B_TRANSLATE_MARK("?+* follows nothing."), + B_TRANSLATE_MARK("Trailing \\."), + B_TRANSLATE_MARK("Corrupted expression."), + B_TRANSLATE_MARK("Memory corruption."), + B_TRANSLATE_MARK("Corrupted pointers."), + B_TRANSLATE_MARK("Corrupted opcode.") }; @@ -409,7 +414,8 @@ RegExp::ErrorString() const { if (fError >= REGEXP_UNMATCHED_PARENTHESIS && fError <= REGEXP_CORRUPTED_OPCODE) { - return kRegExpErrorStringArray[fError - B_ERRORS_END]; + return B_TRANSLATE_NOCOLLECT( + kRegExpErrorStringArray[fError - B_ERRORS_END]); } return strerror(fError); diff --git a/src/tools/locale/Jamfile b/src/tools/locale/Jamfile index f1564b27a4..a06d60d36a 100644 --- a/src/tools/locale/Jamfile +++ b/src/tools/locale/Jamfile @@ -15,6 +15,9 @@ local localetools = # Due to the use of STL fstream open() mapping the function names via macro # name doesn't work. DEFINES += _HAIKU_BUILD_DONT_REMAP_FD_FUNCTIONS ; +# Use empty translation macros to avoid a dependency on the locale kit +DEFINES += B_AVOID_TRANSLATION_MACROS 'B_TRANSLATE_NOCOLLECT(x)=x' + 'B_TRANSLATE_MARK(x)=x' ; # We link against the host libbe.so which could also contain this class, so # rename it for locale tools DEFINES += DefaultCatalog=ToolsDefaultCatalog ;