IOM: Localization/String improvements

* Switching mis-used B_TRANSLATE_CONTEXT to B_TRANSLATE_COMMENT
* Use B_TRANSLATE_SYSTEM_NAME for "Icon-O-Matic"
* Remove remnants of old localization system
* Rename "Control Points" to vertex/vertices
* Add a ":" after Undo/Redo
* Sentence casing
* Avoid Yes/No buttons in BAlert

Change-Id: Ibb299925bce1f6ca1cf03216a36df7c44f10bdc6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6704
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This commit is contained in:
Humdinger 2023-07-18 15:36:10 +02:00 committed by waddlesplash
parent 18d6122240
commit a4e4beafe5
44 changed files with 90 additions and 109 deletions

View File

@ -194,7 +194,7 @@ MainWindow::MessageReceived(BMessage* message)
continue;
char name[30];
sprintf(name,
B_TRANSLATE_CONTEXT("Color (#%02x%02x%02x)",
B_TRANSLATE_COMMENT("Color (#%02x%02x%02x)",
"Style name after dropping a color"),
color->red, color->green, color->blue);
Style* style = new (nothrow) Style(*color);
@ -395,18 +395,22 @@ MainWindow::MessageReceived(BMessage* message)
case MSG_UNDO_STACK_CHANGED:
{
// relable Undo item and update enabled status
BString label(B_TRANSLATE("Undo"));
fUndoMI->SetEnabled(fDocument->CommandStack()->GetUndoName(label));
BString label(B_TRANSLATE("Undo: %action%"));
BString temp;
fUndoMI->SetEnabled(fDocument->CommandStack()->GetUndoName(temp));
label.ReplaceFirst("%action%", temp);
if (fUndoMI->IsEnabled())
fUndoMI->SetLabel(label.String());
else {
fUndoMI->SetLabel(B_TRANSLATE_CONTEXT("<nothing to undo>",
"Icon-O-Matic-Menu-Edit"));
}
// relable Redo item and update enabled status
label.SetTo(B_TRANSLATE("Redo"));
fRedoMI->SetEnabled(fDocument->CommandStack()->GetRedoName(label));
label.SetTo(B_TRANSLATE("Redo: %action%"));
temp.SetTo("");
fRedoMI->SetEnabled(fDocument->CommandStack()->GetRedoName(temp));
label.ReplaceFirst("%action%", temp);
if (fRedoMI->IsEnabled())
fRedoMI->SetLabel(label.String());
else {
@ -743,10 +747,10 @@ MainWindow::Open(const entry_ref& ref, bool append)
BString helper(B_TRANSLATE("Opening the document failed!"));
helper << "\n\n" << B_TRANSLATE("Error: ") << strerror(ret);
BAlert* alert = new BAlert(
B_TRANSLATE_CONTEXT("bad news", "Title of error alert"),
helper.String(),
B_TRANSLATE_CONTEXT("Bummer",
"Cancel button - error alert"),
B_TRANSLATE_CONTEXT("Bad news", "Title of error alert"),
helper.String(),
B_TRANSLATE_COMMENT("Bummer",
"Cancel button - error alert"),
NULL, NULL);
// launch alert asynchronously
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
@ -822,10 +826,10 @@ MainWindow::Open(const BMessenger& externalObserver, const uint8* data,
BString helper(B_TRANSLATE("Opening the icon failed!"));
helper << "\n\n" << B_TRANSLATE("Error: ") << strerror(ret);
BAlert* alert = new BAlert(
B_TRANSLATE_CONTEXT("bad news", "Title of error alert"),
helper.String(),
B_TRANSLATE_CONTEXT("Bummer",
"Cancel button - error alert"),
B_TRANSLATE_CONTEXT("Bad news", "Title of error alert"),
helper.String(),
B_TRANSLATE_COMMENT("Bummer",
"Cancel button - error alert"),
NULL, NULL);
// launch alert asynchronously
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);

View File

@ -83,17 +83,19 @@ SetPropertiesCommand::GetName(BString& name)
{
if (fOldProperties->CountProperties() > 1) {
if (fObjectCount > 1)
name << B_TRANSLATE("Multi Paste Properties");
name << B_TRANSLATE("Multi-paste properties");
else
name << B_TRANSLATE("Paste Properties");
name << B_TRANSLATE("Paste properties");
} else {
BString property = name_for_id(
fOldProperties->PropertyAt(0)->Identifier());
if (fObjectCount > 1)
name << B_TRANSLATE_CONTEXT("Multi Set ",
"Multi Set (property name)") << property;
else
name << B_TRANSLATE_CONTEXT("Set ", "Set (property name)")
<< property;
if (fObjectCount > 1) {
name << B_TRANSLATE_COMMENT("Multi-set %property%",
"Don't translate %property%");
} else {
name << B_TRANSLATE_COMMENT("Set %property%",
"Don't translate %property%");
}
name.ReplaceFirst("%property%", property);
}
}

View File

@ -154,7 +154,7 @@ void
AddCommand<Type>::GetName(BString& name)
{
static BStringFormat format(B_TRANSLATE("Add {0, plural, "
"one{Item} other{Items}}"));
"one{item} other{items}}"));
format.Format(name, fCount);
}
#endif // ADD_COMMAND_H

View File

@ -194,7 +194,7 @@ void
MoveCommand<Type>::GetName(BString& name)
{
static BStringFormat format(B_TRANSLATE("Move {0, plural, "
"one{Item} other{Items}}"));
"one{item} other{items}}"));
format.Format(name, fCount);
}
#endif // MOVE_COMMAND_H

View File

@ -142,7 +142,7 @@ void
RemoveCommand<Type>::GetName(BString& name)
{
static BStringFormat format(B_TRANSLATE("Remove {0, plural, "
"one{Item} other{Items}}"));
"one{item} other{items}}"));
format.Format(name, fCount);
}
#endif // REMOVE_COMMAND_H

View File

@ -54,7 +54,7 @@ name_for_id(int32 id)
name = B_TRANSLATE("Joins");
break;
case PROPERTY_MITER_LIMIT:
name = B_TRANSLATE("Miter Limit");
name = B_TRANSLATE("Miter limit");
break;
case PROPERTY_STROKE_SHORTEN:
name = B_TRANSLATE("Shorten");
@ -94,7 +94,7 @@ name_for_id(int32 id)
break;
case PROPERTY_DETECT_ORIENTATION:
name = B_TRANSLATE("Detect Orient.");
name = B_TRANSLATE("Detect orient.");
break;
default:

View File

@ -351,26 +351,6 @@ PropertyListView::SetMenu(BMenu* menu)
_CheckMenuStatus();
}
// UpdateStrings
void
PropertyListView::UpdateStrings()
{
// if (fSelectM) {
// LanguageManager* m = LanguageManager::Default();
//
// fSelectM->Superitem()->SetLabel(m->GetString(PROPERTY_SELECTION, "Select"));
// fSelectAllMI->SetLabel(m->GetString(SELECT_ALL_PROPERTIES, "All"));
// fSelectNoneMI->SetLabel(m->GetString(SELECT_NO_PROPERTIES, "None"));
// fInvertSelectionMI->SetLabel(m->GetString(INVERT_SELECTION, "Invert Selection"));
//
// fPropertyM->Superitem()->SetLabel(m->GetString(PROPERTY, "Property"));
// fCopyMI->SetLabel(m->GetString(COPY, "Copy"));
// if (IsEditingMultipleObjects())
// fPasteMI->SetLabel(m->GetString(MULTI_PASTE, "Multi Paste"));
// else
// fPasteMI->SetLabel(m->GetString(PASTE, "Paste"));
// }
}
// ScrollView
::ScrollView*
@ -737,12 +717,9 @@ PropertyListView::_CheckMenuStatus()
}
fPasteMI->SetEnabled(clipboardHasData);
// LanguageManager* m = LanguageManager::Default();
if (IsEditingMultipleObjects())
// fPasteMI->SetLabel(m->GetString(MULTI_PASTE, "Multi paste"));
fPasteMI->SetLabel(B_TRANSLATE("Multi paste"));
fPasteMI->SetLabel(B_TRANSLATE("Multi-paste"));
else
// fPasteMI->SetLabel(m->GetString(PASTE, "Paste"));
fPasteMI->SetLabel(B_TRANSLATE("Paste"));
bool enableMenu = fPropertyObject;

View File

@ -67,7 +67,6 @@ class PropertyListView : public BView,
void SetMenu(BMenu* menu);
::ScrollView* ScrollView() const;
void UpdateStrings();
// interface for Property framework
void UpdateObject(uint32 propertyID);

View File

@ -59,12 +59,12 @@ IconObjectListView::Draw(BRect updateRect)
return;
// display helpful messages
const char* message1 = B_TRANSLATE_CONTEXT(
"Click on an object in", "Empty property list - 1st line");
const char* message2 = B_TRANSLATE_CONTEXT(
"any of the other lists to", "Empty property list - 2nd line");
const char* message3 = B_TRANSLATE_CONTEXT(
"edit it's properties here.", "Empty property list - 3rd line");
const char* message1 = B_TRANSLATE_COMMENT(
"Click on an object in", "Empty property list - 1st line");
const char* message2 = B_TRANSLATE_COMMENT(
"any of the other lists to", "Empty property list - 2nd line");
const char* message3 = B_TRANSLATE_COMMENT(
"edit its properties here.", "Empty property list - 3rd line");
// Dark Themes
rgb_color lowColor = LowColor();

View File

@ -205,12 +205,13 @@ SavePanel::SetExportMode(bool exportMode)
return;
// adjust window title and enable format menu
BString title("Icon-O-Matic: ");
BString title(B_TRANSLATE_SYSTEM_NAME("Icon-O-Matic"));
title << ": ";
if (exportMode) {
fFormatMF->SetEnabled(true);
SetExportMode(fExportMode);
_EnableSettings();
title << B_TRANSLATE_CONTEXT("Export icon", "Dialog title");
title << B_TRANSLATE_COMMENT("Export icon", "Dialog title");
} else {
fExportMode = ExportMode();
// does not overwrite fExportMode in case we already were
@ -219,7 +220,7 @@ SavePanel::SetExportMode(bool exportMode)
fFormatMF->SetEnabled(false);
fSettingsB->SetEnabled(false);
title << B_TRANSLATE_CONTEXT("Save icon", "Dialog title");
title << B_TRANSLATE_COMMENT("Save icon", "Dialog title");
}
window->SetTitle(title);
@ -412,7 +413,7 @@ SavePanel::_BuildMenu()
new BMessage(MSG_FORMAT), EXPORT_MODE_ICON_RDEF);
fFormatM->AddItem(fRDefMI);
fSourceMI = new SaveItem(B_TRANSLATE("HVIF Source Code"),
fSourceMI = new SaveItem(B_TRANSLATE("HVIF source code"),
new BMessage(MSG_FORMAT), EXPORT_MODE_ICON_SOURCE);
fFormatM->AddItem(fSourceMI);
@ -437,17 +438,17 @@ SavePanel::_BuildMenu()
new BMessage(MSG_FORMAT), EXPORT_MODE_BITMAP_64);
fFormatM->AddItem(fBitmap64MI);
fBitmapSetMI = new SaveItem(B_TRANSLATE("PNG Set"),
fBitmapSetMI = new SaveItem(B_TRANSLATE("PNG set"),
new BMessage(MSG_FORMAT), EXPORT_MODE_BITMAP_SET);
fFormatM->AddItem(fBitmapSetMI);
fFormatM->AddSeparatorItem();
fIconAttrMI = new SaveItem(B_TRANSLATE("BEOS:ICON Attribute"),
fIconAttrMI = new SaveItem(B_TRANSLATE("BEOS:ICON attribute"),
new BMessage(MSG_FORMAT), EXPORT_MODE_ICON_ATTR);
fFormatM->AddItem(fIconAttrMI);
fIconMimeAttrMI = new SaveItem(B_TRANSLATE("META:ICON Attribute"),
fIconMimeAttrMI = new SaveItem(B_TRANSLATE("META:ICON attribute"),
new BMessage(MSG_FORMAT), EXPORT_MODE_ICON_MIME_ATTR);
fFormatM->AddItem(fIconMimeAttrMI);

View File

@ -139,10 +139,10 @@ TransformerListView::Draw(BRect updateRect)
return;
// display helpful messages
const char* message1 = B_TRANSLATE_CONTEXT("Click on a shape above",
"Empty transformers list - 1st line");
const char* message2 = B_TRANSLATE_CONTEXT("to attach transformers.",
"Empty transformers list - 2nd line");
const char* message1 = B_TRANSLATE_COMMENT("Click on a shape above",
"Empty transformers list - 1st line");
const char* message2 = B_TRANSLATE_COMMENT("to attach transformers.",
"Empty transformers list - 2nd line");
// Dark Themes
rgb_color lowColor = LowColor();

View File

@ -111,9 +111,9 @@ Exporter::_ExportThread()
// inform user of failure at this point
BString helper(B_TRANSLATE("Saving your document failed!"));
helper << "\n\n" << B_TRANSLATE("Error: ") << strerror(ret);
BAlert* alert = new BAlert(B_TRANSLATE("bad news"), helper.String(),
B_TRANSLATE_CONTEXT("Bleep!",
"Exporter - Continue in error dialog"),
BAlert* alert = new BAlert(B_TRANSLATE_CONTEXT("Bad news", "Title of error alert"),
helper.String(),
B_TRANSLATE_COMMENT("Bleep!", "Exporter - Continue in error dialog"),
NULL, NULL);
// launch alert asynchronously
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);

View File

@ -255,7 +255,7 @@ StyledTextImporter::_Import(Icon* icon, const char *text, text_run_array *runs)
BAlert* alert = new BAlert(B_TRANSLATE("Text too long"),
B_TRANSLATE("The text you are trying to import is quite long, "
"are you sure?"),
B_TRANSLATE("Yes"), B_TRANSLATE("No"), NULL,
B_TRANSLATE("Import text"), B_TRANSLATE("Cancel"), NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
if (alert->Go())
return B_CANCELED;
@ -370,7 +370,8 @@ StyledTextImporter::_AddStyle(Icon *icon, text_run *run)
if (style == NULL)
return B_NO_MEMORY;
char name[30];
sprintf(name, B_TRANSLATE("Color (#%02x%02x%02x)"),
sprintf(name, B_TRANSLATE_COMMENT("Color (#%02x%02x%02x)",
"Style name after dropping a color"),
color.red, color.green, color.blue);
style->SetName(name);

View File

@ -65,7 +65,7 @@ SVGImporter::Import(Icon* icon, const entry_ref* ref)
char error[1024];
sprintf(error, B_TRANSLATE("Failed to open the file '%s' as "
"an SVG document.\n\n"), ref->name);
BAlert* alert = new BAlert(B_TRANSLATE("load error"),
BAlert* alert = new BAlert(B_TRANSLATE("Load error"),
error, B_TRANSLATE("OK"), NULL, NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);

View File

@ -775,7 +775,7 @@ PathManipulator::ShowContextMenu(BPoint where)
if (fCurrentPathPoint < 0) {
message = new BMessage(B_SELECT_ALL);
item = new BMenuItem(B_TRANSLATE("Select All"), message, 'A');
item = new BMenuItem(B_TRANSLATE("Select all"), message, 'A');
menu->AddItem(item);
menu->AddSeparatorItem();

View File

@ -36,9 +36,9 @@ void
AddPathsCommand::GetName(BString& name)
{
static BStringFormat addFormat(B_TRANSLATE("Add {0, plural, "
"one{Path} other{Paths}}"));
"one{path} other{paths}}"));
static BStringFormat assignFormat(B_TRANSLATE("Assign {0, plural, "
"one{Path} other{Paths}}"));
"one{path} other{paths}}"));
if (fOwnsItems)
addFormat.Format(name, fCount);
else

View File

@ -103,6 +103,5 @@ AddPointCommand::Redo()
void
AddPointCommand::GetName(BString& name)
{
// name << _GetString(ADD_CONTROL_POINT, "Add Control Point");
name << B_TRANSLATE("Add Control Point");
name << B_TRANSLATE("Add vertex");
}

View File

@ -36,6 +36,6 @@ void
AddShapesCommand::GetName(BString& name)
{
static BStringFormat format(B_TRANSLATE("Add {0, plural, "
"one{Shape} other{Shapes}}"));
"one{shape} other{shapes}}"));
format.Format(name, fCount);
}

View File

@ -36,6 +36,6 @@ void
AddTransformersCommand::GetName(BString& name)
{
static BStringFormat format(B_TRANSLATE("Add {0, plural, "
"one{Transformer} other{Transformers}}"));
"one{transformer} other{transformers}}"));
format.Format(name, fCount);
}

View File

@ -125,6 +125,5 @@ ChangePointCommand::Redo()
void
ChangePointCommand::GetName(BString& name)
{
// name << _GetString(MODIFY_CONTROL_POINT, "Modify Control Point");
name << B_TRANSLATE("Modify Control Point");
name << B_TRANSLATE("Modify vertex");
}

View File

@ -56,5 +56,5 @@ CleanUpPathCommand::Undo()
void
CleanUpPathCommand::GetName(BString& name)
{
name << B_TRANSLATE("Clean Up Path");
name << B_TRANSLATE("Clean up path");
}

View File

@ -113,7 +113,7 @@ void
FlipPointsCommand::GetName(BString& name)
{
static BStringFormat format(B_TRANSLATE("Flip {0, plural, "
"one{Control Point} other{Control Points}}"));
"one{vertex} other{vertices}}"));
format.Format(name, fCount);
}

View File

@ -120,7 +120,7 @@ void
FreezeTransformationCommand::GetName(BString& name)
{
static BStringFormat format(B_TRANSLATE("Freeze {0, plural, "
"one{Shape} other{Shapes}}"));
"one{shape} other{shapes}}"));
format.Format(name, fCount);
}

View File

@ -130,7 +130,6 @@ InsertPointCommand::Redo()
void
InsertPointCommand::GetName(BString& name)
{
// name << _GetString(INSERT_CONTROL_POINT, "Insert Control Point");
name << B_TRANSLATE("Insert Control Point");
name << B_TRANSLATE("Insert vertex");
}

View File

@ -36,6 +36,6 @@ void
MovePathsCommand::GetName(BString& name)
{
static BStringFormat format(B_TRANSLATE("Move {0, plural, "
"one{Path} other{Paths}}"));
"one{path} other{paths}}"));
format.Format(name, fCount);
}

View File

@ -36,6 +36,6 @@ void
MoveShapesCommand::GetName(BString& name)
{
static BStringFormat format(B_TRANSLATE("Move {0, plural, "
"one{Shape} other{Shapes}}"));
"one{shape} other{shapes}}"));
format.Format(name, fCount);
}

View File

@ -36,6 +36,6 @@ void
MoveTransformersCommand::GetName(BString& name)
{
static BStringFormat format(B_TRANSLATE("Move {0, plural, "
"one{Transformer} other{Transformers}}"));
"one{transformer} other{transformers}}"));
format.Format(name, fCount);
}

View File

@ -29,7 +29,7 @@ static BString
_GetName(int32 count)
{
static BStringFormat format(B_TRANSLATE("Nudge {0, plural, "
"one{Control Point} other{Control Points}}"));
"one{vertex} other{vertices}}"));
BString name;
format.Format(name, count);
return name;

View File

@ -120,6 +120,6 @@ void
RemovePathsCommand::GetName(BString& name)
{
static BStringFormat format(B_TRANSLATE("Remove {0, plural, "
"one{Path} other{Paths}}"));
"one{path} other{paths}}"));
format.Format(name, fCount);
}

View File

@ -163,7 +163,7 @@ void
RemovePointsCommand::GetName(BString& name)
{
static BStringFormat format(B_TRANSLATE("Remove {0, plural, "
"one{Control Point} other{Control Points}}"));
"one{vertex} other{vertices}}"));
format.Format(name, fCount);
}

View File

@ -36,6 +36,6 @@ void
RemoveShapesCommand::GetName(BString& name)
{
static BStringFormat format(B_TRANSLATE("Remove {0, plural, "
"one{Shape} other{Shapes}}"));
"one{shape} other{shapes}}"));
format.Format(name, fCount);
}

View File

@ -37,6 +37,6 @@ void
RemoveTransformersCommand::GetName(BString& name)
{
static BStringFormat format(B_TRANSLATE("Remove {0, plural, "
"one{Transformer} other{Transformers}}"));
"one{transformer} other{transformers}}"));
format.Format(name, fCount);
}

View File

@ -51,5 +51,5 @@ ReversePathCommand::Undo()
void
ReversePathCommand::GetName(BString& name)
{
name << B_TRANSLATE("Reverse Path");
name << B_TRANSLATE("Reverse path");
}

View File

@ -58,7 +58,7 @@ RotatePathIndicesCommand::Undo()
void
RotatePathIndicesCommand::GetName(BString& name)
{
name << B_TRANSLATE("Rotate Path Indices");
name << B_TRANSLATE("Rotate path indices");
}

View File

@ -156,7 +156,7 @@ void
SplitPointsCommand::GetName(BString& name)
{
static BStringFormat format(B_TRANSLATE("Split {0, plural, "
"one{Control Point} other{Control Points}}"));
"one{vertex} other{vertices}}"));
format.Format(name, fCount);
}

View File

@ -69,5 +69,5 @@ UnassignPathCommand::Undo()
void
UnassignPathCommand::GetName(BString& name)
{
name << B_TRANSLATE("Unassign Path");
name << B_TRANSLATE("Unassign path");
}

View File

@ -35,6 +35,6 @@ void
AddStylesCommand::GetName(BString& name)
{
static BStringFormat format(B_TRANSLATE("Add {0, plural, "
"one{Style} other{Styles}}"));
"one{style} other{styles}}"));
format.Format(name, fCount);
}

View File

@ -72,7 +72,7 @@ AssignStyleCommand::Undo()
void
AssignStyleCommand::GetName(BString& name)
{
name << B_TRANSLATE("Assign Style");
name << B_TRANSLATE("Assign style");
if (fNewStyle)
name << " \"" << fNewStyle->Name() << "\"";
}

View File

@ -36,6 +36,6 @@ void
MoveStylesCommand::GetName(BString& name)
{
static BStringFormat format(B_TRANSLATE("Move {0, plural, "
"one{Style} other{Styles}}"));
"one{style} other{styles}}"));
format.Format(name, fCount);
}

View File

@ -118,6 +118,6 @@ void
RemoveStylesCommand::GetName(BString& name)
{
static BStringFormat format(B_TRANSLATE("Remove {0, plural, "
"one{Style} other{Styles}}"));
"one{style} other{styles}}"));
format.Format(name, fCount);
}

View File

@ -74,7 +74,7 @@ SetColorCommand::Undo()
void
SetColorCommand::GetName(BString& name)
{
name << B_TRANSLATE("Change Color");
name << B_TRANSLATE("Change color");
}
// CombineWithNext

View File

@ -102,7 +102,7 @@ SetGradientCommand::Undo()
void
SetGradientCommand::GetName(BString& name)
{
name << B_TRANSLATE("Edit Gradient");
name << B_TRANSLATE("Edit gradient");
}
// CombineWithNext

View File

@ -91,6 +91,6 @@ void
ResetTransformationCommand::GetName(BString& name)
{
static BStringFormat format(B_TRANSLATE("Reset {0, plural, "
"one{Transformation} other{Transformations}}"));
"one{transformation} other{transformations}}"));
format.Format(name, fCount);
}

View File

@ -580,5 +580,5 @@ OffsetCenterState::UpdateViewCursor(BView* view, BPoint current) const
const char*
OffsetCenterState::ActionName() const
{
return B_TRANSLATE("Move Pivot");
return B_TRANSLATE("Move pivot");
}