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.
This commit is contained in:
Adrien Destugues
2016-09-25 15:10:12 +02:00
parent ccb55f969c
commit 09bb8269ac
3 changed files with 26 additions and 17 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ UsePublicHeaders locale ;
UsePrivateHeaders locale shared ; UsePrivateHeaders locale shared ;
BinCommand collectcatkeys : collectcatkeys.cpp RegExp.cpp BinCommand collectcatkeys : collectcatkeys.cpp RegExp.cpp
: be [ TargetLibsupc++ ] ; : be localestub [ TargetLibsupc++ ] ;
BinCommand linkcatkeys : linkcatkeys.cpp : be [ TargetLibstdc++ ] ; BinCommand linkcatkeys : linkcatkeys.cpp : be [ TargetLibstdc++ ] ;
+22 -16
View File
@@ -66,11 +66,16 @@ All rights reserved.
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <Catalog.h>
#include <Errors.h> #include <Errors.h>
#include "RegExp.h" #include "RegExp.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "libtracker"
// The first byte of the regexp internal "program" is actually this magic // The first byte of the regexp internal "program" is actually this magic
// number; the start node begins in the second byte. // number; the start node begins in the second byte.
@@ -179,21 +184,21 @@ enum {
const char* kRegExpErrorStringArray[] = { const char* kRegExpErrorStringArray[] = {
"Unmatched parenthesis.", B_TRANSLATE_MARK("Unmatched parenthesis."),
"Expression too long.", B_TRANSLATE_MARK("Expression too long."),
"Too many parenthesis.", B_TRANSLATE_MARK("Too many parenthesis."),
"Junk on end.", B_TRANSLATE_MARK("Junk on end."),
"*+? operand may be empty.", B_TRANSLATE_MARK("*+? operand may be empty."),
"Nested *?+.", B_TRANSLATE_MARK("Nested *?+."),
"Invalid bracket range.", B_TRANSLATE_MARK("Invalid bracket range."),
"Unmatched brackets.", B_TRANSLATE_MARK("Unmatched brackets."),
"Internal error.", B_TRANSLATE_MARK("Internal error."),
"?+* follows nothing.", B_TRANSLATE_MARK("?+* follows nothing."),
"Trailing \\.", B_TRANSLATE_MARK("Trailing \\."),
"Corrupted expression.", B_TRANSLATE_MARK("Corrupted expression."),
"Memory corruption.", B_TRANSLATE_MARK("Memory corruption."),
"Corrupted pointers.", B_TRANSLATE_MARK("Corrupted pointers."),
"Corrupted opcode." B_TRANSLATE_MARK("Corrupted opcode.")
}; };
@@ -409,7 +414,8 @@ RegExp::ErrorString() const
{ {
if (fError >= REGEXP_UNMATCHED_PARENTHESIS if (fError >= REGEXP_UNMATCHED_PARENTHESIS
&& fError <= REGEXP_CORRUPTED_OPCODE) { && fError <= REGEXP_CORRUPTED_OPCODE) {
return kRegExpErrorStringArray[fError - B_ERRORS_END]; return B_TRANSLATE_NOCOLLECT(
kRegExpErrorStringArray[fError - B_ERRORS_END]);
} }
return strerror(fError); return strerror(fError);
+3
View File
@@ -15,6 +15,9 @@ local localetools =
# Due to the use of STL fstream open() mapping the function names via macro # Due to the use of STL fstream open() mapping the function names via macro
# name doesn't work. # name doesn't work.
DEFINES += _HAIKU_BUILD_DONT_REMAP_FD_FUNCTIONS ; 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 # We link against the host libbe.so which could also contain this class, so
# rename it for locale tools # rename it for locale tools
DEFINES += DefaultCatalog=ToolsDefaultCatalog ; DEFINES += DefaultCatalog=ToolsDefaultCatalog ;