From 420557d0ce8aa1b24644c172457c2ac3f10292b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Thu, 6 May 2010 11:39:09 +0000 Subject: [PATCH] Patch by Jorma Karvonen with a fix by myself to remove string composition. Add four missing localizations. Closes ticket #5484. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36643 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/pairs/PairsView.cpp | 16 ++++++++++------ src/apps/pairs/PairsWindow.cpp | 6 +++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/apps/pairs/PairsView.cpp b/src/apps/pairs/PairsView.cpp index fd183f6865..f1bf2d5410 100644 --- a/src/apps/pairs/PairsView.cpp +++ b/src/apps/pairs/PairsView.cpp @@ -14,10 +14,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -91,6 +93,8 @@ PairsView::_HasBitmap(BList& bitmaps, BBitmap* bitmap) return false; } +#undef TR_CONTEXT +#define TR_CONTEXT "PairsView" void PairsView::_ReadRandomIcons() @@ -163,12 +167,12 @@ PairsView::_ReadRandomIcons() int32 index = rand() % bitmaps.CountItems(); BBitmap* bitmap = ((BBitmap*)bitmaps.RemoveItem(index)); if (bitmap == NULL) { - BString strErr; - strErr - << "Pairs did not find enough vector icons in the system; it " - << "needs at least " << fNumOfCards / 2; - BAlert* alert = new BAlert("fatal", strErr, - "OK", NULL, NULL, B_WIDTH_FROM_WIDEST, B_STOP_ALERT); + char buffer[512]; + snprintf(buffer, sizeof(buffer), TR("Pairs did not find enough " + "vector icons in the system; it needs at least %d."), + fNumOfCards / 2); + BAlert* alert = new BAlert("fatal", buffer, TR("OK"), NULL, NULL, + B_WIDTH_FROM_WIDEST, B_STOP_ALERT); alert->Go(); exit(1); } diff --git a/src/apps/pairs/PairsWindow.cpp b/src/apps/pairs/PairsWindow.cpp index 3be23cc78f..03b9518542 100644 --- a/src/apps/pairs/PairsWindow.cpp +++ b/src/apps/pairs/PairsWindow.cpp @@ -39,7 +39,7 @@ const uint32 MENU_QUIT = 'MGqu'; PairsWindow::PairsWindow() : - BWindow(BRect(100, 100, 405, 423), "Pairs", B_TITLED_WINDOW, + BWindow(BRect(100, 100, 405, 423), TR("Pairs"), B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE | B_NOT_RESIZABLE | B_NOT_ZOOMABLE), fPairComparing(NULL), @@ -223,11 +223,11 @@ PairsWindow::MessageReceived(BMessage* message) BString score; score << fButtonClicks; strAbout - << "Pairs\n" + << TR("Pairs\n" "\twritten by Ralf Schülke\n" "\tCopyright 2008-2010, Haiku Inc.\n" "\n" - "You completed the game in %s clicks.\n"; + "You completed the game in %s clicks.\n"); strAbout.Replace("%s", score.String(), 1);