Patch by mt: Translate various yet untranslated strings in libtracker,

closes ticket #6374. Thanks a bunch!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38675 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2010-09-16 14:30:20 +00:00
parent 6936b3ba4f
commit 108f794c97
10 changed files with 86 additions and 67 deletions
+3 -2
View File
@@ -1988,8 +1988,9 @@ FileStatToString(StatStruct *stat, char *buffer, int32 length)
tm timeData;
localtime_r(&stat->st_mtime, &timeData);
sprintf(buffer, "\n\t(%Ld bytes, ", stat->st_size);
uint32 pos = strlen(buffer);
uint32 pos = sprintf(buffer,
B_TRANSLATE("\n\t(%Ld bytes, "), stat->st_size);
strftime(buffer + pos, length - pos,"%b %d %Y, %I:%M:%S %p)", &timeData);
}
+3 -3
View File
@@ -62,7 +62,7 @@ FilePermissionsView::FilePermissionsView(BRect rect, Model *model)
strView = new BStringView(BRect(kColumnLabelMiddle - kColumnLabelWidth / 2,
kColumnLabelTop, kColumnLabelMiddle + kColumnLabelWidth / 2, kColumnLabelBottom),
"", "Owner");
"", B_TRANSLATE("Owner"));
AddChild(strView);
strView->SetAlignment(B_ALIGN_CENTER);
strView->SetFontSize(kAttribFontHeight);
@@ -221,7 +221,7 @@ FilePermissionsView::ModelChanged(Model *model)
user << nodeOwner;
fOwnerTextControl->SetText(user.String());
} else
fOwnerTextControl->SetText("Unknown");
fOwnerTextControl->SetText(B_TRANSLATE("Unknown"));
if (node.GetGroup(&nodeGroup) == B_OK) {
BString group;
@@ -234,7 +234,7 @@ FilePermissionsView::ModelChanged(Model *model)
group << nodeGroup;
fGroupTextControl->SetText(group.String());
} else
fGroupTextControl->SetText("Unknown");
fGroupTextControl->SetText(B_TRANSLATE("Unknown"));
// Unless we're root, only allow the owner to transfer the ownership,
// i.e. disable text controls if uid:s doesn't match:
+1 -1
View File
@@ -2803,7 +2803,7 @@ TAttrView::GetDefaultName(BString &result) const
if (item != NULL)
result << item->Label();
else
result << "Name";
result << B_TRANSLATE("Name");
if (item->Submenu() != NULL)
item = item->Submenu()->FindMarked();
+4 -2
View File
@@ -431,7 +431,8 @@ BInfoWindow::MessageReceived(BMessage *message)
case kEditItem:
{
BEntry entry(fModel->EntryRef());
if (ConfirmChangeIfWellKnownDirectory(&entry, "rename"))
if (ConfirmChangeIfWellKnownDirectory(&entry,
B_TRANSLATE("rename")))
fAttributeView->BeginEditingTitle();
break;
}
@@ -1220,7 +1221,8 @@ AttributeView::MouseDown(BPoint point)
} else if (fTitleRect.Contains(point)) {
// You can't change the name of the trash
if (!fModel->IsTrash()
&& ConfirmChangeIfWellKnownDirectory(&entry, "rename", true)
&& ConfirmChangeIfWellKnownDirectory(&entry,
B_TRANSLATE("rename"), true)
&& fTitleEditView == 0)
BeginEditingTitle();
} else if (fTitleEditView) {
+2
View File
@@ -117,11 +117,13 @@ DoCatalogs libtracker.so :
PoseView.cpp
QueryContainerWindow.cpp
QueryPoseView.cpp
RegExp.cpp
SelectionWindow.cpp
SettingsViews.cpp
SlowContextPopup.cpp
StatusWindow.cpp
TemplatesMenu.cpp
TextWidget.cpp
Tracker.cpp
TrackerInitialState.cpp
TrackerSettingsWindow.cpp
+19 -18
View File
@@ -148,8 +148,9 @@ OpenWithContainerWindow::OpenWithContainerWindow(BMessage *entriesToOpen,
// if opening just one file, use it in the title
entry_ref ref;
fEntriesToOpen->FindRef("refs", &ref);
BString buffer;
buffer << "Open " << ref.name << " with:";
BString buffer(B_TRANSLATE("Open %name with:"));
buffer.ReplaceFirst("%name", ref.name);
SetTitle(buffer.String());
} else
// use generic title
@@ -664,9 +665,9 @@ OpenWithPoseView::OpenSelection(BPose *pose, int32 *)
BEntry entry(pose->TargetModel()->EntryRef());
if (entry.InitCheck() != B_OK) {
BString errorString;
errorString << "Could not find application \""
<< pose->TargetModel()->Name() << "\"";
BString errorString(
B_TRANSLATE("Could not find application \"%appname\""));
errorString.ReplaceFirst("%appname", pose->TargetModel()->Name());
(new BAlert("", errorString.String(), B_TRANSLATE("OK"), 0, 0,
B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
@@ -675,13 +676,13 @@ OpenWithPoseView::OpenSelection(BPose *pose, int32 *)
if (OpenWithRelation(pose->TargetModel()) == kNoRelation) {
if (!fIterator->GenericFilesOnly()) {
BString warning;
warning << "The application \"" << pose->TargetModel()->Name()
<< "\" does not support the type of document you are "
BString warning(B_TRANSLATE(
"The application \"%appname\" does not support the type of document you are "
"about to open. Are you sure you want to proceed? If you know that "
"the application supports the document type, you should contact the "
"publisher of the application and ask them to update their application "
"to list the type of your document as supported.";
"to list the type of your document as supported."));
warning.ReplaceFirst("%appname", pose->TargetModel()->Name());
BAlert* alert = new BAlert("", warning.String(),
B_TRANSLATE("Cancel"), B_TRANSLATE("Open"), 0, B_WIDTH_AS_USUAL,
@@ -1437,7 +1438,7 @@ SearchForSignatureEntryList::RelationDescription(const BMessage *entriesToOpen,
break;
if (preferredAppForFile && ref == *preferredAppForFile) {
*description = "Preferred for file";
description->SetTo(B_TRANSLATE("Preferred for file"));
return;
}
@@ -1452,7 +1453,7 @@ SearchForSignatureEntryList::RelationDescription(const BMessage *entriesToOpen,
continue;
case kSuperhandler:
*description = "Handles any file";
description->SetTo(B_TRANSLATE("Handles any file"));
return;
case kSupportsSupertype:
@@ -1467,9 +1468,9 @@ SearchForSignatureEntryList::RelationDescription(const BMessage *entriesToOpen,
//PRINT(("getting supertype for %s, result %s, got %s\n",
// model.MimeType(), strerror(result), mimeType.Type()));
*description = "Handles any ";
description->SetTo(B_TRANSLATE("Handles any %type"));
// *description += mimeType.Type();
*description += type;
description->ReplaceFirst("%type", type);
return;
}
@@ -1479,21 +1480,21 @@ SearchForSignatureEntryList::RelationDescription(const BMessage *entriesToOpen,
if (preferredApp && *applicationModel->EntryRef() == *preferredApp)
// application matches cached preferred app, we are done
*description = "Preferred for ";
description->SetTo(B_TRANSLATE("Preferred for %type"));
else
*description = "Handles ";
description->SetTo(B_TRANSLATE("Handles %type"));
char shortDescription[256];
if (mimeType.GetShortDescription(shortDescription) == B_OK)
*description += shortDescription;
description->ReplaceFirst("%type", shortDescription);
else
*description += mimeType.Type();
description->ReplaceFirst("%type", mimeType.Type());
return;
}
}
}
*description = "Does not handle file";
description->SetTo(B_TRANSLATE("Does not handle file"));
}
+9 -7
View File
@@ -4263,7 +4263,8 @@ BPoseView::HandleDropCommon(BMessage *message, Model *targetModel, BPose *target
char name[B_FILE_NAME_LENGTH];
BFile file;
if (CreateClippingFile(poseView, file, name, &targetDirectory, message,
"Untitled clipping", !targetPose, dropPt) != B_OK)
B_TRANSLATE("Untitled clipping"),
!targetPose, dropPt) != B_OK)
return false;
// here is a file for the drag initiator, it is up to it now to stuff it
@@ -4415,7 +4416,8 @@ BPoseView::HandleDropCommon(BMessage *message, Model *targetModel, BPose *target
BFile file;
if (CreateClippingFile(poseView, file, name, &targetDirectory, message,
"Untitled clipping", !targetPose, dropPt) != B_OK)
B_TRANSLATE("Untitled clipping"),
!targetPose, dropPt) != B_OK)
return false;
// write out the file
@@ -4468,7 +4470,7 @@ BPoseView::HandleDropCommon(BMessage *message, Model *targetModel, BPose *target
BFile file;
if (CreateClippingFile(poseView, file, name, &targetDirectory, message,
"Untitled bitmap", !targetPose, dropPt) != B_OK)
B_TRANSLATE("Untitled bitmap"), !targetPose, dropPt) != B_OK)
return false;
int32 size = embeddedBitmap.FlattenedSize();
@@ -4753,7 +4755,7 @@ BPoseView::MoveSelectionInto(Model *destFolder, BContainerWindow *srcWindow,
if (srcWindow->TargetModel()->IsQuery()
&& !forceCopy && !destIsTrash && !createLink) {
srcWindow->UpdateIfNeeded();
BAlert *alert = new BAlert("",
BAlert *alert = new BAlert("",
B_TRANSLATE("Are you sure you want to move or copy the selected "
"item(s) to this folder?"), B_TRANSLATE("Cancel"),
B_TRANSLATE("Move"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
@@ -5957,9 +5959,9 @@ BPoseView::SelectMatchingEntries(const BMessage *message)
regExpression.SetTo(expression);
if (regExpression.InitCheck() != B_OK) {
BString message;
message << B_TRANSLATE("Error in regular expression:\n\n'");
message << regExpression.ErrorString() << "'";
BString message(
B_TRANSLATE("Error in regular expression:\n\n'%errstring'"));
message.ReplaceFirst("%errstring", regExpression.ErrorString());
(new BAlert("", message.String(), B_TRANSLATE("OK"), NULL, NULL,
B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
return 0;
+22 -17
View File
@@ -65,10 +65,14 @@ All rights reserved.
#include <stdio.h>
#include <string.h>
#include <Catalog.h>
#include <Errors.h>
#include "RegExp.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
// The first byte of the regexp internal "program" is actually this magic
// number; the start node begins in the second byte.
@@ -172,22 +176,22 @@ enum {
kWorst = 0 // Worst case.
};
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."
static const char *kRegExpErrorStringArray[] = {
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.")
};
#ifdef DEBUG
@@ -376,7 +380,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);
}
+17 -15
View File
@@ -661,8 +661,8 @@ BStatusView::Draw(BRect updateRect)
if (IsPaused())
DrawString(B_TRANSLATE("Paused: click to resume or stop"), tp);
else if (fDestDir.Length()) {
BString buffer;
buffer << "To: " << fDestDir;
BString buffer(B_TRANSLATE("To: %dir"));
buffer.ReplaceFirst("%dir", fDestDir);
SetHighColor(0, 0, 0);
DrawString(buffer.String(), tp);
@@ -681,24 +681,26 @@ BStatusView::Draw(BRect updateRect)
// Draw speed info
if (fBytesPerSecond != 0.0) {
char sizeBuffer[128];
buffer = "(";
buffer << string_for_size((double)fSizeProcessed, sizeBuffer,
sizeof(sizeBuffer));
buffer << " of ";
buffer << string_for_size((double)fTotalSize, sizeBuffer,
sizeof(sizeBuffer));
buffer << ", ";
buffer << string_for_size(fBytesPerSecond, sizeBuffer,
sizeof(sizeBuffer));
buffer << "/s)";
buffer.SetTo(B_TRANSLATE(
"(%SizeProcessed of %TotalSize, %BytesPerSecond/s)"));
buffer.ReplaceFirst("%SizeProcessed",
string_for_size((double)fSizeProcessed, sizeBuffer,
sizeof(sizeBuffer)));
buffer.ReplaceFirst("%TotalSize",
string_for_size((double)fTotalSize, sizeBuffer,
sizeof(sizeBuffer)));
buffer.ReplaceFirst("%BytesPerSecond",
string_for_size(fBytesPerSecond, sizeBuffer,
sizeof(sizeBuffer)));
tp.x = fStatusBar->Frame().right - StringWidth(buffer.String());
if (tp.x > rightDivider)
DrawString(buffer.String(), tp);
else {
// complete string too wide, try with shorter version
buffer << string_for_size(fBytesPerSecond, sizeBuffer,
sizeof(sizeBuffer));
buffer << "/s";
buffer << B_TRANSLATE("%BytesPerSecond/s");
buffer.ReplaceFirst("%BytesPerSecond",
string_for_size(fBytesPerSecond, sizeBuffer,
sizeof(sizeBuffer)));
tp.x = fStatusBar->Frame().right
- StringWidth(buffer.String());
if (tp.x > rightDivider)
+6 -2
View File
@@ -36,6 +36,7 @@ All rights reserved.
#include <stdlib.h>
#include <Alert.h>
#include <Catalog.h>
#include <Debug.h>
#include <Directory.h>
#include <MessageFilter.h>
@@ -54,6 +55,9 @@ All rights reserved.
#include "WidgetAttributeText.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
const float kWidthMargin = 20;
@@ -326,8 +330,8 @@ BTextWidget::StartEdit(BRect bounds, BPoseView *view, BPose *pose)
return;
BEntry entry(pose->TargetModel()->EntryRef());
if (entry.InitCheck() == B_OK
&& !ConfirmChangeIfWellKnownDirectory(&entry, "rename"))
if (entry.InitCheck() == B_OK
&& !ConfirmChangeIfWellKnownDirectory(&entry, B_TRANSLATE("rename")))
return;
// get bounds with full text length