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 ;
BinCommand collectcatkeys : collectcatkeys.cpp RegExp.cpp
: be [ TargetLibsupc++ ] ;
: be localestub [ TargetLibsupc++ ] ;
BinCommand linkcatkeys : linkcatkeys.cpp : be [ TargetLibstdc++ ] ;
+22 -16
View File
@@ -66,11 +66,16 @@ All rights reserved.
#include <stdio.h>
#include <string.h>
#include <Catalog.h>
#include <Errors.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
// 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);
+3
View File
@@ -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 ;