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; tm timeData;
localtime_r(&stat->st_mtime, &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); 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, strView = new BStringView(BRect(kColumnLabelMiddle - kColumnLabelWidth / 2,
kColumnLabelTop, kColumnLabelMiddle + kColumnLabelWidth / 2, kColumnLabelBottom), kColumnLabelTop, kColumnLabelMiddle + kColumnLabelWidth / 2, kColumnLabelBottom),
"", "Owner"); "", B_TRANSLATE("Owner"));
AddChild(strView); AddChild(strView);
strView->SetAlignment(B_ALIGN_CENTER); strView->SetAlignment(B_ALIGN_CENTER);
strView->SetFontSize(kAttribFontHeight); strView->SetFontSize(kAttribFontHeight);
@@ -221,7 +221,7 @@ FilePermissionsView::ModelChanged(Model *model)
user << nodeOwner; user << nodeOwner;
fOwnerTextControl->SetText(user.String()); fOwnerTextControl->SetText(user.String());
} else } else
fOwnerTextControl->SetText("Unknown"); fOwnerTextControl->SetText(B_TRANSLATE("Unknown"));
if (node.GetGroup(&nodeGroup) == B_OK) { if (node.GetGroup(&nodeGroup) == B_OK) {
BString group; BString group;
@@ -234,7 +234,7 @@ FilePermissionsView::ModelChanged(Model *model)
group << nodeGroup; group << nodeGroup;
fGroupTextControl->SetText(group.String()); fGroupTextControl->SetText(group.String());
} else } else
fGroupTextControl->SetText("Unknown"); fGroupTextControl->SetText(B_TRANSLATE("Unknown"));
// Unless we're root, only allow the owner to transfer the ownership, // Unless we're root, only allow the owner to transfer the ownership,
// i.e. disable text controls if uid:s doesn't match: // 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) if (item != NULL)
result << item->Label(); result << item->Label();
else else
result << "Name"; result << B_TRANSLATE("Name");
if (item->Submenu() != NULL) if (item->Submenu() != NULL)
item = item->Submenu()->FindMarked(); item = item->Submenu()->FindMarked();
+4 -2
View File
@@ -431,7 +431,8 @@ BInfoWindow::MessageReceived(BMessage *message)
case kEditItem: case kEditItem:
{ {
BEntry entry(fModel->EntryRef()); BEntry entry(fModel->EntryRef());
if (ConfirmChangeIfWellKnownDirectory(&entry, "rename")) if (ConfirmChangeIfWellKnownDirectory(&entry,
B_TRANSLATE("rename")))
fAttributeView->BeginEditingTitle(); fAttributeView->BeginEditingTitle();
break; break;
} }
@@ -1220,7 +1221,8 @@ AttributeView::MouseDown(BPoint point)
} else if (fTitleRect.Contains(point)) { } else if (fTitleRect.Contains(point)) {
// You can't change the name of the trash // You can't change the name of the trash
if (!fModel->IsTrash() if (!fModel->IsTrash()
&& ConfirmChangeIfWellKnownDirectory(&entry, "rename", true) && ConfirmChangeIfWellKnownDirectory(&entry,
B_TRANSLATE("rename"), true)
&& fTitleEditView == 0) && fTitleEditView == 0)
BeginEditingTitle(); BeginEditingTitle();
} else if (fTitleEditView) { } else if (fTitleEditView) {
+2
View File
@@ -117,11 +117,13 @@ DoCatalogs libtracker.so :
PoseView.cpp PoseView.cpp
QueryContainerWindow.cpp QueryContainerWindow.cpp
QueryPoseView.cpp QueryPoseView.cpp
RegExp.cpp
SelectionWindow.cpp SelectionWindow.cpp
SettingsViews.cpp SettingsViews.cpp
SlowContextPopup.cpp SlowContextPopup.cpp
StatusWindow.cpp StatusWindow.cpp
TemplatesMenu.cpp TemplatesMenu.cpp
TextWidget.cpp
Tracker.cpp Tracker.cpp
TrackerInitialState.cpp TrackerInitialState.cpp
TrackerSettingsWindow.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 // if opening just one file, use it in the title
entry_ref ref; entry_ref ref;
fEntriesToOpen->FindRef("refs", &ref); fEntriesToOpen->FindRef("refs", &ref);
BString buffer; BString buffer(B_TRANSLATE("Open %name with:"));
buffer << "Open " << ref.name << " with:"; buffer.ReplaceFirst("%name", ref.name);
SetTitle(buffer.String()); SetTitle(buffer.String());
} else } else
// use generic title // use generic title
@@ -664,9 +665,9 @@ OpenWithPoseView::OpenSelection(BPose *pose, int32 *)
BEntry entry(pose->TargetModel()->EntryRef()); BEntry entry(pose->TargetModel()->EntryRef());
if (entry.InitCheck() != B_OK) { if (entry.InitCheck() != B_OK) {
BString errorString; BString errorString(
errorString << "Could not find application \"" B_TRANSLATE("Could not find application \"%appname\""));
<< pose->TargetModel()->Name() << "\""; errorString.ReplaceFirst("%appname", pose->TargetModel()->Name());
(new BAlert("", errorString.String(), B_TRANSLATE("OK"), 0, 0, (new BAlert("", errorString.String(), B_TRANSLATE("OK"), 0, 0,
B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
@@ -675,13 +676,13 @@ OpenWithPoseView::OpenSelection(BPose *pose, int32 *)
if (OpenWithRelation(pose->TargetModel()) == kNoRelation) { if (OpenWithRelation(pose->TargetModel()) == kNoRelation) {
if (!fIterator->GenericFilesOnly()) { if (!fIterator->GenericFilesOnly()) {
BString warning; BString warning(B_TRANSLATE(
warning << "The application \"" << pose->TargetModel()->Name() "The application \"%appname\" does not support the type of document you are "
<< "\" does not support the type of document you are "
"about to open. Are you sure you want to proceed? If you know that " "about to open. Are you sure you want to proceed? If you know that "
"the application supports the document type, you should contact the " "the application supports the document type, you should contact the "
"publisher of the application and ask them to update their application " "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(), BAlert* alert = new BAlert("", warning.String(),
B_TRANSLATE("Cancel"), B_TRANSLATE("Open"), 0, B_WIDTH_AS_USUAL, B_TRANSLATE("Cancel"), B_TRANSLATE("Open"), 0, B_WIDTH_AS_USUAL,
@@ -1437,7 +1438,7 @@ SearchForSignatureEntryList::RelationDescription(const BMessage *entriesToOpen,
break; break;
if (preferredAppForFile && ref == *preferredAppForFile) { if (preferredAppForFile && ref == *preferredAppForFile) {
*description = "Preferred for file"; description->SetTo(B_TRANSLATE("Preferred for file"));
return; return;
} }
@@ -1452,7 +1453,7 @@ SearchForSignatureEntryList::RelationDescription(const BMessage *entriesToOpen,
continue; continue;
case kSuperhandler: case kSuperhandler:
*description = "Handles any file"; description->SetTo(B_TRANSLATE("Handles any file"));
return; return;
case kSupportsSupertype: case kSupportsSupertype:
@@ -1467,9 +1468,9 @@ SearchForSignatureEntryList::RelationDescription(const BMessage *entriesToOpen,
//PRINT(("getting supertype for %s, result %s, got %s\n", //PRINT(("getting supertype for %s, result %s, got %s\n",
// model.MimeType(), strerror(result), mimeType.Type())); // model.MimeType(), strerror(result), mimeType.Type()));
*description = "Handles any "; description->SetTo(B_TRANSLATE("Handles any %type"));
// *description += mimeType.Type(); // *description += mimeType.Type();
*description += type; description->ReplaceFirst("%type", type);
return; return;
} }
@@ -1479,21 +1480,21 @@ SearchForSignatureEntryList::RelationDescription(const BMessage *entriesToOpen,
if (preferredApp && *applicationModel->EntryRef() == *preferredApp) if (preferredApp && *applicationModel->EntryRef() == *preferredApp)
// application matches cached preferred app, we are done // application matches cached preferred app, we are done
*description = "Preferred for "; description->SetTo(B_TRANSLATE("Preferred for %type"));
else else
*description = "Handles "; description->SetTo(B_TRANSLATE("Handles %type"));
char shortDescription[256]; char shortDescription[256];
if (mimeType.GetShortDescription(shortDescription) == B_OK) if (mimeType.GetShortDescription(shortDescription) == B_OK)
*description += shortDescription; description->ReplaceFirst("%type", shortDescription);
else else
*description += mimeType.Type(); description->ReplaceFirst("%type", mimeType.Type());
return; return;
} }
} }
} }
*description = "Does not handle file"; description->SetTo(B_TRANSLATE("Does not handle file"));
} }
+8 -6
View File
@@ -4263,7 +4263,8 @@ BPoseView::HandleDropCommon(BMessage *message, Model *targetModel, BPose *target
char name[B_FILE_NAME_LENGTH]; char name[B_FILE_NAME_LENGTH];
BFile file; BFile file;
if (CreateClippingFile(poseView, file, name, &targetDirectory, message, if (CreateClippingFile(poseView, file, name, &targetDirectory, message,
"Untitled clipping", !targetPose, dropPt) != B_OK) B_TRANSLATE("Untitled clipping"),
!targetPose, dropPt) != B_OK)
return false; return false;
// here is a file for the drag initiator, it is up to it now to stuff it // 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; BFile file;
if (CreateClippingFile(poseView, file, name, &targetDirectory, message, if (CreateClippingFile(poseView, file, name, &targetDirectory, message,
"Untitled clipping", !targetPose, dropPt) != B_OK) B_TRANSLATE("Untitled clipping"),
!targetPose, dropPt) != B_OK)
return false; return false;
// write out the file // write out the file
@@ -4468,7 +4470,7 @@ BPoseView::HandleDropCommon(BMessage *message, Model *targetModel, BPose *target
BFile file; BFile file;
if (CreateClippingFile(poseView, file, name, &targetDirectory, message, if (CreateClippingFile(poseView, file, name, &targetDirectory, message,
"Untitled bitmap", !targetPose, dropPt) != B_OK) B_TRANSLATE("Untitled bitmap"), !targetPose, dropPt) != B_OK)
return false; return false;
int32 size = embeddedBitmap.FlattenedSize(); int32 size = embeddedBitmap.FlattenedSize();
@@ -5957,9 +5959,9 @@ BPoseView::SelectMatchingEntries(const BMessage *message)
regExpression.SetTo(expression); regExpression.SetTo(expression);
if (regExpression.InitCheck() != B_OK) { if (regExpression.InitCheck() != B_OK) {
BString message; BString message(
message << B_TRANSLATE("Error in regular expression:\n\n'"); B_TRANSLATE("Error in regular expression:\n\n'%errstring'"));
message << regExpression.ErrorString() << "'"; message.ReplaceFirst("%errstring", regExpression.ErrorString());
(new BAlert("", message.String(), B_TRANSLATE("OK"), NULL, NULL, (new BAlert("", message.String(), B_TRANSLATE("OK"), NULL, NULL,
B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
return 0; return 0;
+22 -17
View File
@@ -65,10 +65,14 @@ 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_TRANSLATE_CONTEXT
#define B_TRANSLATE_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.
@@ -172,22 +176,22 @@ enum {
kWorst = 0 // Worst case. kWorst = 0 // Worst case.
}; };
const char *kRegExpErrorStringArray[] = { static 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.")
}; };
#ifdef DEBUG #ifdef DEBUG
@@ -376,7 +380,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);
} }
+17 -15
View File
@@ -661,8 +661,8 @@ BStatusView::Draw(BRect updateRect)
if (IsPaused()) if (IsPaused())
DrawString(B_TRANSLATE("Paused: click to resume or stop"), tp); DrawString(B_TRANSLATE("Paused: click to resume or stop"), tp);
else if (fDestDir.Length()) { else if (fDestDir.Length()) {
BString buffer; BString buffer(B_TRANSLATE("To: %dir"));
buffer << "To: " << fDestDir; buffer.ReplaceFirst("%dir", fDestDir);
SetHighColor(0, 0, 0); SetHighColor(0, 0, 0);
DrawString(buffer.String(), tp); DrawString(buffer.String(), tp);
@@ -681,24 +681,26 @@ BStatusView::Draw(BRect updateRect)
// Draw speed info // Draw speed info
if (fBytesPerSecond != 0.0) { if (fBytesPerSecond != 0.0) {
char sizeBuffer[128]; char sizeBuffer[128];
buffer = "("; buffer.SetTo(B_TRANSLATE(
buffer << string_for_size((double)fSizeProcessed, sizeBuffer, "(%SizeProcessed of %TotalSize, %BytesPerSecond/s)"));
sizeof(sizeBuffer)); buffer.ReplaceFirst("%SizeProcessed",
buffer << " of "; string_for_size((double)fSizeProcessed, sizeBuffer,
buffer << string_for_size((double)fTotalSize, sizeBuffer, sizeof(sizeBuffer)));
sizeof(sizeBuffer)); buffer.ReplaceFirst("%TotalSize",
buffer << ", "; string_for_size((double)fTotalSize, sizeBuffer,
buffer << string_for_size(fBytesPerSecond, sizeBuffer, sizeof(sizeBuffer)));
sizeof(sizeBuffer)); buffer.ReplaceFirst("%BytesPerSecond",
buffer << "/s)"; string_for_size(fBytesPerSecond, sizeBuffer,
sizeof(sizeBuffer)));
tp.x = fStatusBar->Frame().right - StringWidth(buffer.String()); tp.x = fStatusBar->Frame().right - StringWidth(buffer.String());
if (tp.x > rightDivider) if (tp.x > rightDivider)
DrawString(buffer.String(), tp); DrawString(buffer.String(), tp);
else { else {
// complete string too wide, try with shorter version // complete string too wide, try with shorter version
buffer << string_for_size(fBytesPerSecond, sizeBuffer, buffer << B_TRANSLATE("%BytesPerSecond/s");
sizeof(sizeBuffer)); buffer.ReplaceFirst("%BytesPerSecond",
buffer << "/s"; string_for_size(fBytesPerSecond, sizeBuffer,
sizeof(sizeBuffer)));
tp.x = fStatusBar->Frame().right tp.x = fStatusBar->Frame().right
- StringWidth(buffer.String()); - StringWidth(buffer.String());
if (tp.x > rightDivider) if (tp.x > rightDivider)
+5 -1
View File
@@ -36,6 +36,7 @@ All rights reserved.
#include <stdlib.h> #include <stdlib.h>
#include <Alert.h> #include <Alert.h>
#include <Catalog.h>
#include <Debug.h> #include <Debug.h>
#include <Directory.h> #include <Directory.h>
#include <MessageFilter.h> #include <MessageFilter.h>
@@ -54,6 +55,9 @@ All rights reserved.
#include "WidgetAttributeText.h" #include "WidgetAttributeText.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "libtracker"
const float kWidthMargin = 20; const float kWidthMargin = 20;
@@ -327,7 +331,7 @@ BTextWidget::StartEdit(BRect bounds, BPoseView *view, BPose *pose)
BEntry entry(pose->TargetModel()->EntryRef()); BEntry entry(pose->TargetModel()->EntryRef());
if (entry.InitCheck() == B_OK if (entry.InitCheck() == B_OK
&& !ConfirmChangeIfWellKnownDirectory(&entry, "rename")) && !ConfirmChangeIfWellKnownDirectory(&entry, B_TRANSLATE("rename")))
return; return;
// get bounds with full text length // get bounds with full text length