From c273dc9f6479cac3972d748b2626d98136256c57 Mon Sep 17 00:00:00 2001 From: Humdinger Date: Sat, 17 Jan 2026 14:51:33 +0100 Subject: [PATCH] Apps & Prefs: Use B_TRANSLATE_SYSTEM_NAME() where appropriate The application name should never appear in a translatable string. Otherwise it will always show translated in the app, even if the user configured the Locale prefs to not "Translate app and folder names". Always concatenate the B_TRANSLATE_SYSTEM_NAME'ed string. Use a regular BAboutWindow in the Sounds prefs. Change-Id: I85f02a3aa6c76b22266d495cf7514cc499bc31e8 Reviewed-on: https://review.haiku-os.org/c/haiku/+/10234 Reviewed-by: Adrien Destugues --- .../bootmanager/BootManagerController.cpp | 9 +++---- src/apps/codycam/CodyCam.cpp | 6 +++-- src/apps/deskbar/DeskbarMenu.cpp | 5 ++-- src/apps/deskbar/PreferencesWindow.cpp | 6 ++++- src/apps/expander/DirectoryFilePanel.cpp | 5 +++- src/apps/expander/ExpanderPreferences.cpp | 6 ++++- src/apps/expander/ExpanderWindow.cpp | 5 ++-- src/apps/haikudepot/ui/App.cpp | 11 +++++---- src/apps/haikudepot/ui/MainWindow.cpp | 7 +++--- src/apps/haikudepot/ui/ShuttingDownWindow.cpp | 4 +++- .../ui/UserUsageConditionsWindow.cpp | 11 ++++++--- .../import_export/svg/SVGExporter.cpp | 7 +++--- src/apps/installer/InstallerWindow.cpp | 10 ++++---- src/apps/installer/WorkerThread.cpp | 8 ++++--- src/apps/login/LoginApp.cpp | 9 +++---- src/apps/mail/MailWindow.cpp | 5 ++-- src/apps/mail/Prefs.cpp | 7 ++++-- src/apps/mandelbrot/Mandelbrot.cpp | 2 +- src/apps/mediaplayer/MainApp.cpp | 5 ++-- .../mediaplayer/settings/SettingsWindow.cpp | 7 ++++-- src/apps/midiplayer/MidiPlayerApp.cpp | 2 +- src/apps/networkstatus/NetworkStatus.cpp | 5 ++-- src/apps/pairs/Pairs.cpp | 6 ++--- src/apps/poorman/PoorManPreferencesWindow.cpp | 13 ++++++---- src/apps/poorman/PoorManPreferencesWindow.h | 2 +- src/apps/poorman/PoorManWindow.cpp | 20 +++++++++------- src/apps/poorman/constants.cpp | 11 --------- src/apps/poorman/constants.h | 5 +--- src/apps/powerstatus/PowerStatus.cpp | 14 ++++++----- src/apps/processcontroller/PCWorld.cpp | 12 ++++++---- .../processcontroller/ProcessController.cpp | 7 +++--- src/apps/pulse/CPUButton.cpp | 5 ++-- src/apps/pulse/NormalPulseView.cpp | 2 +- src/apps/pulse/PulseApp.cpp | 3 +-- src/apps/pulse/PulseView.cpp | 5 ++-- src/apps/softwareupdater/CheckManager.cpp | 3 ++- src/apps/terminal/TermApp.cpp | 5 ++-- src/apps/terminal/TermWindow.cpp | 17 +++++++------ src/apps/webpositive/BrowserApp.cpp | 16 +++++++------ src/apps/webpositive/DownloadProgressView.cpp | 4 ++-- src/preferences/bluetooth/BluetoothMain.cpp | 3 ++- src/preferences/filetypes/FileTypes.cpp | 2 +- src/preferences/locale/LocalePreflet.cpp | 2 +- src/preferences/locale/LocaleWindow.cpp | 2 +- src/preferences/media/MediaWindow.cpp | 3 ++- src/preferences/notifications/PrefletWin.cpp | 7 ++++-- .../repositories/RepositoriesView.cpp | 7 +++--- src/preferences/shortcuts/ShortcutsWindow.cpp | 21 ++++++++-------- src/preferences/sounds/HApp.cpp | 24 +++++++++++-------- 49 files changed, 210 insertions(+), 153 deletions(-) diff --git a/src/apps/bootmanager/BootManagerController.cpp b/src/apps/bootmanager/BootManagerController.cpp index ab1c92acae..68d7ca242e 100644 --- a/src/apps/bootmanager/BootManagerController.cpp +++ b/src/apps/bootmanager/BootManagerController.cpp @@ -301,21 +301,22 @@ BootManagerController::_CreateErrorEntryPage() description << B_TRANSLATE_COMMENT("Partition table not compatible", "Title") << "\n\n" << B_TRANSLATE("The partition table of the first hard disk is not " - "compatible with Boot Manager.\n" - "Boot Manager only works with IBM PC MBR partitions."); + "compatible.\n" + "%appname% only works with IBM PC MBR partitions."); } else if (fCollectPartitionsStatus == B_PARTITION_TOO_SMALL) { description << B_TRANSLATE_COMMENT("First partition starts too early", "Title") << "\n\n" << B_TRANSLATE("The first partition on the disk starts too early " "and does not leave enough space free for a boot menu.\n" - "Boot Manager needs 2 KiB available space before the first " + "%appname% needs 2 KiB available space before the first " "partition."); } else { description << B_TRANSLATE_COMMENT("Error reading partition table", "Title") << "\n\n" - << B_TRANSLATE("Boot Manager is unable to read the partition " + << B_TRANSLATE("%appname% is unable to read the partition " "table!"); } + description.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("BootManager")); return new DescriptionPage("errorEntry", description.String(), true); } diff --git a/src/apps/codycam/CodyCam.cpp b/src/apps/codycam/CodyCam.cpp index 0abc976d07..81dcc33adb 100644 --- a/src/apps/codycam/CodyCam.cpp +++ b/src/apps/codycam/CodyCam.cpp @@ -233,8 +233,10 @@ CodyCam::_SetUpNodes() INFO("CodyCam acquiring VideoInput node\n"); status = fMediaRoster->GetVideoInput(&fProducerNode); if (status != B_OK) { - fWindow->ErrorAlert(B_TRANSLATE("Cannot find a video source.\n" - "You need a webcam to use CodyCam."), status); + BString text(B_TRANSLATE("Cannot find a video source.\n" + "You need a webcam to use %appname%.")); + text.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("CodyCam")); + fWindow->ErrorAlert(text, status); return status; } diff --git a/src/apps/deskbar/DeskbarMenu.cpp b/src/apps/deskbar/DeskbarMenu.cpp index 3e0085189f..ff6160a228 100644 --- a/src/apps/deskbar/DeskbarMenu.cpp +++ b/src/apps/deskbar/DeskbarMenu.cpp @@ -285,8 +285,9 @@ B_TRANSLATE_MARK_VOID("About this system") AddItem(mountMenu); #endif - item = new BMenuItem(B_TRANSLATE("Deskbar preferences" B_UTF8_ELLIPSIS), - new BMessage(kConfigShow)); + BString menuLabel(B_TRANSLATE("%appname% preferences" B_UTF8_ELLIPSIS)); + menuLabel.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("Deskbar")); + item = new BMenuItem(menuLabel, new BMessage(kConfigShow)); item->SetTarget(be_app); AddItem(item); diff --git a/src/apps/deskbar/PreferencesWindow.cpp b/src/apps/deskbar/PreferencesWindow.cpp index 34ba367640..9ebbf0f4ea 100644 --- a/src/apps/deskbar/PreferencesWindow.cpp +++ b/src/apps/deskbar/PreferencesWindow.cpp @@ -46,9 +46,13 @@ static const char* kSettingsFileName = "prefs_window_settings"; PreferencesWindow::PreferencesWindow(BRect frame) : - BWindow(frame, B_TRANSLATE("Deskbar preferences"), B_TITLED_WINDOW, + BWindow(frame, "", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS | B_NOT_ZOOMABLE) { + BString title(B_TRANSLATE("%appname% preferences")); + title.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("Deskbar")); + SetTitle(title); + // Initial settings (used by revert button) fSettings = *static_cast(be_app)->Settings(); diff --git a/src/apps/expander/DirectoryFilePanel.cpp b/src/apps/expander/DirectoryFilePanel.cpp index 5c07404f07..3735acee90 100644 --- a/src/apps/expander/DirectoryFilePanel.cpp +++ b/src/apps/expander/DirectoryFilePanel.cpp @@ -90,7 +90,10 @@ DirectoryFilePanel::Show() fCurrentButton->SetTarget(Messenger()); SetButtonLabel(B_DEFAULT_BUTTON, B_TRANSLATE("Select")); - Window()->SetTitle(B_TRANSLATE("Expander: Choose destination")); + + BString title(B_TRANSLATE("%appname%: Choose destination")); + title.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("Expander")); + Window()->SetTitle(title); Window()->Unlock(); diff --git a/src/apps/expander/ExpanderPreferences.cpp b/src/apps/expander/ExpanderPreferences.cpp index b03bbb78fa..19025bea26 100644 --- a/src/apps/expander/ExpanderPreferences.cpp +++ b/src/apps/expander/ExpanderPreferences.cpp @@ -43,13 +43,17 @@ static const uint32 MSG_DESTSELECT = 'mDes'; ExpanderPreferences::ExpanderPreferences(BMessage* settings) : - BWindow(BRect(0, 0, 325, 305), B_TRANSLATE("Expander settings"), + BWindow(BRect(0, 0, 325, 305), "", B_FLOATING_WINDOW_LOOK, B_FLOATING_APP_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS), fSettings(settings), fUsePanel(NULL) { + BString title(B_TRANSLATE("%appname% settings")); + title.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("Expander")); + SetTitle(title); + const float kSpacing = be_control_look->DefaultItemSpacing(); BStringView* expansionLabel = new BStringView("stringViewExpansion", diff --git a/src/apps/expander/ExpanderWindow.cpp b/src/apps/expander/ExpanderWindow.cpp index dd85f53cb8..8505b1996e 100644 --- a/src/apps/expander/ExpanderWindow.cpp +++ b/src/apps/expander/ExpanderWindow.cpp @@ -256,8 +256,9 @@ ExpanderWindow::MessageReceived(BMessage* message) BMessenger messenger(this); fSourcePanel = new BFilePanel(B_OPEN_PANEL, &messenger, &srcRef, B_FILE_NODE, false, NULL, new RuleRefFilter(fRules), true); - (fSourcePanel->Window())->SetTitle( - B_TRANSLATE("Expander: Open")); + BString title(B_TRANSLATE("%appname%: Open")); + title.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("Expander")); + (fSourcePanel->Window())->SetTitle(title); } else fSourcePanel->SetPanelDirectory(&srcRef); fSourcePanel->Show(); diff --git a/src/apps/haikudepot/ui/App.cpp b/src/apps/haikudepot/ui/App.cpp index 81b03d8bb1..fcb5258b08 100644 --- a/src/apps/haikudepot/ui/App.cpp +++ b/src/apps/haikudepot/ui/App.cpp @@ -456,11 +456,12 @@ void App::_CheckPackageDaemonRuns() { while (!be_roster->IsRunning(kPackageDaemonSignature)) { - BAlert* alert = new BAlert(B_TRANSLATE("Start package daemon"), - B_TRANSLATE("HaikuDepot needs the package daemon to function, " + BString text(B_TRANSLATE("%appname% needs the package daemon to function, " "and it appears to be not running.\n" - "Would you like to start it now?"), - B_TRANSLATE("No, quit HaikuDepot"), B_TRANSLATE("Start package daemon"), NULL, + "Would you like to start it now?")); + text.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("HaikuDepot")); + BAlert* alert = new BAlert(B_TRANSLATE("Start package daemon"), text, + B_TRANSLATE("No, quit"), B_TRANSLATE("Start package daemon"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); alert->SetShortcut(0, B_ESCAPE); @@ -482,7 +483,7 @@ App::_LaunchPackageDaemon() errorMessage.ReplaceAll("%Error%", strerror(ret)); BAlert* alert = new BAlert(B_TRANSLATE("Package daemon problem"), errorMessage, - B_TRANSLATE("Quit HaikuDepot"), B_TRANSLATE("Try again"), NULL, B_WIDTH_AS_USUAL, + B_TRANSLATE("Quit"), B_TRANSLATE("Try again"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); alert->SetShortcut(0, B_ESCAPE); diff --git a/src/apps/haikudepot/ui/MainWindow.cpp b/src/apps/haikudepot/ui/MainWindow.cpp index 14686ce19d..a9c6fcd4f7 100644 --- a/src/apps/haikudepot/ui/MainWindow.cpp +++ b/src/apps/haikudepot/ui/MainWindow.cpp @@ -2004,9 +2004,10 @@ MainWindow::_WindowTitleForPackage(const PackageInfoRef& pkg) if (version.IsSet()) versionString = version->ToString(); - BString title = B_TRANSLATE("HaikuDepot - %PackageName% %PackageVersion%"); - title.ReplaceAll("%PackageName%", pkg->Name()); - title.ReplaceAll("%PackageVersion%", versionString); + BString title("%AppName% - %PackageName% %PackageVersion%"); + title.ReplaceFirst("%AppName%", B_TRANSLATE_SYSTEM_NAME("HaikuDepot")); + title.ReplaceFirst("%PackageName%", pkg->Name()); + title.ReplaceFirst("%PackageVersion%", versionString); return title; } diff --git a/src/apps/haikudepot/ui/ShuttingDownWindow.cpp b/src/apps/haikudepot/ui/ShuttingDownWindow.cpp index f83639dd0d..d2adb7e656 100644 --- a/src/apps/haikudepot/ui/ShuttingDownWindow.cpp +++ b/src/apps/haikudepot/ui/ShuttingDownWindow.cpp @@ -28,8 +28,10 @@ ShuttingDownWindow::ShuttingDownWindow(BWindow* parent) textView->AdoptSystemColors(); textView->MakeEditable(false); textView->MakeSelectable(false); - textView->SetText(B_TRANSLATE("HaikuDepot is stopping or completing " + BString text(B_TRANSLATE("%appname% is stopping or completing " "running operations before quitting.")); + text.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("HaikuDepot")); + textView->SetText(text); BLayoutBuilder::Group<>(this, B_VERTICAL, 0) .SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING, diff --git a/src/apps/haikudepot/ui/UserUsageConditionsWindow.cpp b/src/apps/haikudepot/ui/UserUsageConditionsWindow.cpp index 4f36b74f41..ec49505d40 100644 --- a/src/apps/haikudepot/ui/UserUsageConditionsWindow.cpp +++ b/src/apps/haikudepot/ui/UserUsageConditionsWindow.cpp @@ -33,12 +33,12 @@ #define PLACEHOLDER_TEXT "..." #define INTRODUCTION_TEXT_LATEST \ - "HaikuDepot communicates with a " \ + "%Appname% communicates with a " \ "server component called HaikuDepotServer. These are the latest " \ "usage conditions for use of the HaikuDepotServer service." #define INTRODUCTION_TEXT_USER \ - "HaikuDepot communicates with a " \ + "%Appname% communicates with a " \ "server component called HaikuDepotServer. These are the usage " \ "conditions that the user '%Nickname%' agreed to at %AgreedToTimestamp% "\ "in relation to the use of the HaikuDepotServer service." @@ -436,7 +436,11 @@ UserUsageConditionsWindow::_IntroductionTextForMode(UserUsageConditionsSelection { switch (mode) { case LATEST: - return B_TRANSLATE(INTRODUCTION_TEXT_LATEST); + { + BString text(B_TRANSLATE(INTRODUCTION_TEXT_LATEST)); + text.ReplaceFirst("%Appname%", B_TRANSLATE_SYSTEM_NAME("HaikuDepot")); + return text; + } case USER: { BString nicknamePresentation = PLACEHOLDER_TEXT; @@ -453,6 +457,7 @@ UserUsageConditionsWindow::_IntroductionTextForMode(UserUsageConditionsSelection } BString text = B_TRANSLATE(INTRODUCTION_TEXT_USER); + text.ReplaceFirst("%Appname%", B_TRANSLATE_SYSTEM_NAME("HaikuDepot")); text.ReplaceAll("%Nickname%", nicknamePresentation); text.ReplaceAll("%AgreedToTimestamp%", agreedToTimestampPresentation); return text; diff --git a/src/apps/icon-o-matic/import_export/svg/SVGExporter.cpp b/src/apps/icon-o-matic/import_export/svg/SVGExporter.cpp index 31ae15ac07..d4dad393db 100644 --- a/src/apps/icon-o-matic/import_export/svg/SVGExporter.cpp +++ b/src/apps/icon-o-matic/import_export/svg/SVGExporter.cpp @@ -144,13 +144,14 @@ SVGExporter::SetOriginalEntry(const entry_ref* ref) bool SVGExporter::_DisplayWarning() const { - BAlert* alert = new BAlert(B_TRANSLATE("warning"), - B_TRANSLATE("Icon-O-Matic might not have " + BString text(B_TRANSLATE("%appname% might not have " "interpreted all data from the SVG " "when it was loaded. " "By overwriting the original " "file, this information would now " - "be lost."), + "be lost.")); + text.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("Icon-O-Matic")); + BAlert* alert = new BAlert(B_TRANSLATE("warning"), text, B_TRANSLATE("Cancel"), B_TRANSLATE("Overwrite")); alert->SetShortcut(0, B_ESCAPE); diff --git a/src/apps/installer/InstallerWindow.cpp b/src/apps/installer/InstallerWindow.cpp index 818952e1a0..6059c910a5 100644 --- a/src/apps/installer/InstallerWindow.cpp +++ b/src/apps/installer/InstallerWindow.cpp @@ -509,11 +509,13 @@ InstallerWindow::MessageReceived(BMessage *msg) BString status; if (be_roster->IsRunning(kDeskbarSignature)) { fBeginButton->SetLabel(B_TRANSLATE("Quit")); - status.SetToFormat(B_TRANSLATE("Installation " + + BString text(B_TRANSLATE("Installation " "completed. Boot sector has been written to '%s'. Press " - "'Quit' to leave the Installer or choose a new target " - "volume to perform another installation."), - dstItem ? dstItem->Name() : B_TRANSLATE_COMMENT("???", + "'Quit' to leave the %appname% or choose a new target " + "volume to perform another installation.")); + text.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("Installer")); + status.SetToFormat(text, dstItem ? dstItem->Name() : B_TRANSLATE_COMMENT("???", "Unknown partition name")); } else { fBeginButton->SetLabel(B_TRANSLATE("Restart")); diff --git a/src/apps/installer/WorkerThread.cpp b/src/apps/installer/WorkerThread.cpp index 2013f8f31f..9a02a6ef7b 100644 --- a/src/apps/installer/WorkerThread.cpp +++ b/src/apps/installer/WorkerThread.cpp @@ -527,9 +527,11 @@ WorkerThread::_PerformInstall(partition_id sourcePartitionID, // check not installing on boot volume if (strncmp(BOOT_PATH, targetDirectory.Path(), strlen(BOOT_PATH)) == 0) { - BAlert* alert = new BAlert("", B_TRANSLATE("Are you sure you want to " - "install onto the current boot disk? The Installer will have to " - "reboot your machine if you proceed."), B_TRANSLATE("OK"), + BString text(B_TRANSLATE("Are you sure you want to " + "install onto the current boot disk? The %appname% will have to " + "reboot your machine if you proceed.")); + text.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("Installer")); + BAlert* alert = new BAlert("", text, B_TRANSLATE("OK"), B_TRANSLATE("Cancel"), 0, B_WIDTH_AS_USUAL, B_STOP_ALERT); alert->SetShortcut(1, B_ESCAPE); if (alert->Go() != 0) { diff --git a/src/apps/login/LoginApp.cpp b/src/apps/login/LoginApp.cpp index f53bcf3f67..8c5e6943a1 100644 --- a/src/apps/login/LoginApp.cpp +++ b/src/apps/login/LoginApp.cpp @@ -53,11 +53,12 @@ LoginApp::ReadyToRun() BScreen screen; if (fEditShelfMode) { - BAlert* alert = new BAlert(B_TRANSLATE("Info"), B_TRANSLATE("You can " - "customize the desktop shown behind the Login application by " + BString text(B_TRANSLATE("You can " + "customize the desktop shown behind the %appname% application by " "dropping replicants onto it.\n\n" - "When you are finished just quit the application (Cmd-Q)."), - B_TRANSLATE("OK")); + "When you are finished just quit the application (Cmd-Q).")); + text.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("Login")); + BAlert* alert = new BAlert(B_TRANSLATE("Info"), text, B_TRANSLATE("OK")); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } else { diff --git a/src/apps/mail/MailWindow.cpp b/src/apps/mail/MailWindow.cpp index bd871b49bc..c4c254db96 100644 --- a/src/apps/mail/MailWindow.cpp +++ b/src/apps/mail/MailWindow.cpp @@ -1702,8 +1702,9 @@ TMailWindow::MessageReceived(BMessage* msg) snooze (1500000); if (!gDictCount) { beep(); - BAlert* alert = new BAlert("", - B_TRANSLATE("Mail couldn't find its dictionary."), + BString text(B_TRANSLATE("%appname% couldn't find its dictionary.")); + text.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("Mail")); + BAlert* alert = new BAlert("", text, B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_STOP_ALERT); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); diff --git a/src/apps/mail/Prefs.cpp b/src/apps/mail/Prefs.cpp index d5f156550e..1d02059df7 100644 --- a/src/apps/mail/Prefs.cpp +++ b/src/apps/mail/Prefs.cpp @@ -93,8 +93,7 @@ TPrefsWindow::TPrefsWindow(BPoint leftTop, BFont* font, int32* level, bool* warnUnencodable, bool* spellCheckStartOn, bool* autoMarkRead, uint8* buttonBar) : - BWindow(BRect(leftTop.x, leftTop.y, leftTop.x + 100, leftTop.y + 100), - B_TRANSLATE("Mail settings"), + BWindow(BRect(leftTop.x, leftTop.y, leftTop.x + 100, leftTop.y + 100), "", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS), @@ -136,6 +135,10 @@ TPrefsWindow::TPrefsWindow(BPoint leftTop, BFont* font, int32* level, fNewAutoMarkRead(autoMarkRead), fAutoMarkRead(*autoMarkRead) { + BString title(B_TRANSLATE("%appname% settings")); + title.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("Mail")); + SetTitle(title); + strcpy(fSignature, *fNewSignature); BMenuField* menu; diff --git a/src/apps/mandelbrot/Mandelbrot.cpp b/src/apps/mandelbrot/Mandelbrot.cpp index ede3da1832..3ef68fabee 100644 --- a/src/apps/mandelbrot/Mandelbrot.cpp +++ b/src/apps/mandelbrot/Mandelbrot.cpp @@ -701,7 +701,7 @@ MandelbrotWindow::MessageReceived(BMessage* msg) break; case B_ABOUT_REQUESTED: { - BAboutWindow* wind = new BAboutWindow("Mandelbrot", + BAboutWindow* wind = new BAboutWindow(B_TRANSLATE_SYSTEM_NAME("Mandelbrot"), "application/x-vnd.Haiku-Mandelbrot"); const char* authors[] = { diff --git a/src/apps/mediaplayer/MainApp.cpp b/src/apps/mediaplayer/MainApp.cpp index e0a45e4d72..0ac318cb20 100644 --- a/src/apps/mediaplayer/MainApp.cpp +++ b/src/apps/mediaplayer/MainApp.cpp @@ -419,8 +419,9 @@ MainApp::_ShowFilePanel(BFilePanel* panel, uint32 command, if (message->FindString("title", &panelTitle) != B_OK) panelTitle = defaultTitle; { - BString finalPanelTitle = "MediaPlayer: "; - finalPanelTitle << panelTitle; + BString finalPanelTitle(B_TRANSLATE("%appname%: %title%")); + finalPanelTitle.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("MediaPlayer")); + finalPanelTitle.ReplaceFirst("%title%", panelTitle); BAutolock lock(panel->Window()); panel->Window()->SetTitle(finalPanelTitle.String()); } diff --git a/src/apps/mediaplayer/settings/SettingsWindow.cpp b/src/apps/mediaplayer/settings/SettingsWindow.cpp index 7dc47c888a..14c6fe943c 100644 --- a/src/apps/mediaplayer/settings/SettingsWindow.cpp +++ b/src/apps/mediaplayer/settings/SettingsWindow.cpp @@ -42,11 +42,14 @@ enum { SettingsWindow::SettingsWindow(BRect frame) : - BWindow(frame, B_TRANSLATE("MediaPlayer settings"), B_FLOATING_WINDOW_LOOK, - B_FLOATING_ALL_WINDOW_FEEL, + BWindow(frame, "", B_FLOATING_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS) { + BString title(B_TRANSLATE("%appname% settings")); + title.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("MediaPlayer")); + SetTitle(title); + const float kSpacing = be_control_look->DefaultItemSpacing(); BBox* settingsBox = new BBox(B_PLAIN_BORDER, NULL); diff --git a/src/apps/midiplayer/MidiPlayerApp.cpp b/src/apps/midiplayer/MidiPlayerApp.cpp index 74dda5ccc3..e1d31e100a 100644 --- a/src/apps/midiplayer/MidiPlayerApp.cpp +++ b/src/apps/midiplayer/MidiPlayerApp.cpp @@ -58,7 +58,7 @@ MidiPlayerApp::ReadyToRun() void MidiPlayerApp::AboutRequested() { - BAboutWindow* window = new BAboutWindow("MidiPlayer", + BAboutWindow* window = new BAboutWindow(B_TRANSLATE_SYSTEM_NAME("MidiPlayer"), MIDI_PLAYER_SIGNATURE); const char* extraCopyrights[] = { diff --git a/src/apps/networkstatus/NetworkStatus.cpp b/src/apps/networkstatus/NetworkStatus.cpp index d2ff173515..381324a00b 100644 --- a/src/apps/networkstatus/NetworkStatus.cpp +++ b/src/apps/networkstatus/NetworkStatus.cpp @@ -87,10 +87,11 @@ NetworkStatus::ArgvReceived(int32 argc, char** argv) if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0) { - const char* str = B_TRANSLATE("NetworkStatus options:\n" + BString str = B_TRANSLATE("%appname% options:\n" "\t--deskbar\tautomatically add replicant to Deskbar\n" "\t--help\t\tprint this info and exit"); - puts(str); + str.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("NetworkStatus")); + puts(str.String()); fQuitImmediately = true; return; } diff --git a/src/apps/pairs/Pairs.cpp b/src/apps/pairs/Pairs.cpp index d88f967129..f2d093d953 100644 --- a/src/apps/pairs/Pairs.cpp +++ b/src/apps/pairs/Pairs.cpp @@ -145,10 +145,10 @@ Pairs::_GetVectorIcons() if (fIconMap.size() < kMinIconCount) { char buffer[512]; snprintf(buffer, sizeof(buffer), - B_TRANSLATE_COMMENT("Pairs did not find enough vector icons " + B_TRANSLATE_COMMENT("%s did not find enough vector icons " "to start; it needs at least %zu, found %zu.\n", - "Don't translate \"%zu\", but make sure to keep them."), - kMinIconCount, fIconMap.size()); + "Don't translate \"%s\" and \"%zu\", but make sure to keep them."), + B_TRANSLATE_SYSTEM_NAME("Pairs"), kMinIconCount, fIconMap.size()); BString messageString(buffer); BAlert* alert = new BAlert("Fatal", messageString.String(), B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_FROM_WIDEST, diff --git a/src/apps/poorman/PoorManPreferencesWindow.cpp b/src/apps/poorman/PoorManPreferencesWindow.cpp index 629e6a6b4c..2dcfd52271 100644 --- a/src/apps/poorman/PoorManPreferencesWindow.cpp +++ b/src/apps/poorman/PoorManPreferencesWindow.cpp @@ -24,12 +24,16 @@ #define B_TRANSLATION_CONTEXT "PoorMan" -PoorManPreferencesWindow::PoorManPreferencesWindow(BRect frame, char * name) - : BWindow(frame, name, B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE +PoorManPreferencesWindow::PoorManPreferencesWindow(BRect frame) + : BWindow(frame, "", B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_CLOSE_ON_ESCAPE | B_AUTO_UPDATE_SIZE_LIMITS), fWebDirFilePanel(NULL), fLogFilePanel(NULL) { + BString title(B_TRANSLATE("%appname% settings")); + title.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("PoorMan")); + SetTitle(title); + fCancelButton = new BButton("Cancel Button", B_TRANSLATE("Cancel"), new BMessage(MSG_PREF_BTN_CANCEL)); fDoneButton = new BButton("Done Button", B_TRANSLATE("Done"), @@ -75,8 +79,9 @@ PoorManPreferencesWindow::PoorManPreferencesWindow(BRect frame, char * name) B_FILE_NODE, false, &message); fLogFilePanel->SetButtonLabel(B_DEFAULT_BUTTON, B_TRANSLATE("Create")); change_title = fLogFilePanel->Window(); - change_title->SetTitle(STR_FILEPANEL_CREATE_LOG_FILE); - + title = B_TRANSLATE("Create %appname% log"); + title.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("PoorMan")); + change_title->SetTitle(title); BLayoutBuilder::Group<>(this, B_VERTICAL, 0) .SetInsets(0, B_USE_DEFAULT_SPACING, 0, B_USE_WINDOW_SPACING) diff --git a/src/apps/poorman/PoorManPreferencesWindow.h b/src/apps/poorman/PoorManPreferencesWindow.h index 7758799dda..83d9508ef0 100644 --- a/src/apps/poorman/PoorManPreferencesWindow.h +++ b/src/apps/poorman/PoorManPreferencesWindow.h @@ -24,7 +24,7 @@ class PoorManPreferencesWindow: public BWindow { public: - PoorManPreferencesWindow(BRect frame, char* name); + PoorManPreferencesWindow(BRect frame); ~PoorManPreferencesWindow(); virtual void MessageReceived(BMessage* message); diff --git a/src/apps/poorman/PoorManWindow.cpp b/src/apps/poorman/PoorManWindow.cpp index 4584856414..6c7d6f49bb 100644 --- a/src/apps/poorman/PoorManWindow.cpp +++ b/src/apps/poorman/PoorManWindow.cpp @@ -186,8 +186,7 @@ PoorManWindow::MessageReceived(BMessage* message) fPrefWindow->MessageReceived(message); break; case MSG_MENU_EDIT_PREF: - fPrefWindow = new PoorManPreferencesWindow(fSetwindowFrame, - STR_WIN_NAME_PREF); + fPrefWindow = new PoorManPreferencesWindow(fSetwindowFrame); fPrefWindow->Show(); break; case MSG_MENU_CTRL_RUN: @@ -535,11 +534,18 @@ PoorManWindow::SaveConsole(BMessage* message, bool selection) void PoorManWindow::DefaultSettings() { - BAlert* serverAlert = new BAlert(B_TRANSLATE("Error Server"), + BAlert* serverAlert = new BAlert(B_TRANSLATE("Error server"), STR_ERR_CANT_START, B_TRANSLATE("OK")); serverAlert->SetFlags(serverAlert->Flags() | B_CLOSE_ON_ESCAPE); - BAlert* dirAlert = new BAlert(B_TRANSLATE("Error Dir"), - STR_ERR_WEB_DIR, B_TRANSLATE("Cancel"), B_TRANSLATE("Select"), + + BString text(B_TRANSLATE( + "Please choose the folder to publish on the web.\n\n" + "You can have %appname% create a default \"public_html\" " + "in your home folder.\n" + "Or you select one of your own folders instead.")); + text.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("PoorMan")); + BAlert* dirAlert = new BAlert(B_TRANSLATE("Error folder"), + text, B_TRANSLATE("Cancel"), B_TRANSLATE("Select"), B_TRANSLATE("Create public_html"), B_WIDTH_AS_USUAL, B_OFFSET_SPACING); dirAlert->SetShortcut(0, B_ESCAPE); int32 buttonIndex = dirAlert->Go(); @@ -552,9 +558,7 @@ PoorManWindow::DefaultSettings() break; case 1: - fPrefWindow = new PoorManPreferencesWindow( - fSetwindowFrame, - STR_WIN_NAME_PREF); + fPrefWindow = new PoorManPreferencesWindow(fSetwindowFrame); fPrefWindow->ShowWebDirFilePanel(); break; diff --git a/src/apps/poorman/constants.cpp b/src/apps/poorman/constants.cpp index f076e36065..a6276c1736 100644 --- a/src/apps/poorman/constants.cpp +++ b/src/apps/poorman/constants.cpp @@ -15,12 +15,6 @@ const char* STR_APP_SIG = "application/x-vnd.Haiku-PoorMan"; const char* STR_APP_NAME = B_TRANSLATE_SYSTEM_NAME("PoorMan"); -const char* STR_ERR_WEB_DIR - = B_TRANSLATE( - "Please choose the folder to publish on the web.\n\n" - "You can have PoorMan create a default \"public_html\" " - "in your home folder.\n" - "Or you select one of your own folders instead."); const char* STR_ERR_CANT_START = B_TRANSLATE( "Cannot start the server"); @@ -66,9 +60,6 @@ const char* STR_TXT_VIEW // ------------------------------------------------------ // Preferences Window -char* STR_WIN_NAME_PREF - = (char*)B_TRANSLATE("PoorMan settings"); - const char* STR_SETTINGS_FILE_NAME = "PoorMan settings"; const char* STR_DEFAULT_WEB_DIRECTORY @@ -106,8 +97,6 @@ const char* STR_TXT_LOG_FILE_NAME = B_TRANSLATE("Log file name:"); const char* STR_BTN_CREATE_LOG_FILE = B_TRANSLATE("Create log file"); -const char* STR_FILEPANEL_CREATE_LOG_FILE - = B_TRANSLATE("Create PoorMan log"); const char* STR_TAB_ADVANCED = B_TRANSLATE("Advanced"); diff --git a/src/apps/poorman/constants.h b/src/apps/poorman/constants.h index a9d1b3499e..1648555f31 100644 --- a/src/apps/poorman/constants.h +++ b/src/apps/poorman/constants.h @@ -44,8 +44,7 @@ const int32 MSG_LOG = 'logg'; // PoorMan Window extern const char* STR_APP_SIG; extern const char* STR_APP_NAME; -extern const char* STR_ERR_WEB_DIR; // Alert Box -extern const char* STR_ERR_CANT_START; +extern const char* STR_ERR_CANT_START; // Alert Box extern const char* STR_DIR_CREATED; extern const char* STR_MNU_FILE; @@ -68,7 +67,6 @@ extern const char* STR_TXT_VIEW; // ------------------------------------------------------ // Preferences Window -extern char* STR_WIN_NAME_PREF; extern const char* STR_SETTINGS_FILE_NAME; extern const char* STR_DEFAULT_WEB_DIRECTORY; @@ -89,7 +87,6 @@ extern const char* STR_BBX_FILE_LOGGING; extern const char* STR_CBX_LOG_FILE; extern const char* STR_TXT_LOG_FILE_NAME; extern const char* STR_BTN_CREATE_LOG_FILE; -extern const char* STR_FILEPANEL_CREATE_LOG_FILE; extern const char* STR_TAB_ADVANCED; extern const char* STR_BBX_CONNECTION; diff --git a/src/apps/powerstatus/PowerStatus.cpp b/src/apps/powerstatus/PowerStatus.cpp index ced133aa0d..22aad6e15e 100644 --- a/src/apps/powerstatus/PowerStatus.cpp +++ b/src/apps/powerstatus/PowerStatus.cpp @@ -106,9 +106,10 @@ PowerStatus::ReadyToRun() if (ACPIDriverInterface().Connect() != B_OK) { if (APMDriverInterface().Connect() != B_OK) { - BAlert* alert = new BAlert("", - B_TRANSLATE("No supported battery detected. PowerStatus " - "cannot be used on your system."), B_TRANSLATE("Too bad!"), + BString text(B_TRANSLATE("No supported battery detected. %appname% " + "cannot be used on your system.")); + text.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("PowerStatus")); + BAlert* alert = new BAlert("", text, B_TRANSLATE("Too bad!"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); if (!fAutoInstallInDeskbar) alert->Go(); @@ -131,9 +132,10 @@ PowerStatus::ReadyToRun() } if (isDeskbarRunning && !isInstalled) { - BAlert* alert = new BAlert("", - B_TRANSLATE("You can run PowerStatus in a window " - "or install it in the Deskbar."), B_TRANSLATE("Run in window"), + BString text(B_TRANSLATE("You can run %appname% in a window " + "or install it in the Deskbar.")); + text.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("PowerStatus")); + BAlert* alert = new BAlert("", text, B_TRANSLATE("Run in window"), B_TRANSLATE("Install in Deskbar"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); diff --git a/src/apps/processcontroller/PCWorld.cpp b/src/apps/processcontroller/PCWorld.cpp index d411b21fe7..d58652e24b 100644 --- a/src/apps/processcontroller/PCWorld.cpp +++ b/src/apps/processcontroller/PCWorld.cpp @@ -72,9 +72,10 @@ PCApplication::ReadyToRun() BDeskbar deskbar; if (!deskbar.HasItem(kDeskbarItemName)) { // We're not yet installed in the Deskbar, ask if we should - BAlert* alert = new BAlert(B_TRANSLATE("Info"), - B_TRANSLATE("You can run ProcessController in a window" - " or install it in the Deskbar."), B_TRANSLATE("Run in window"), + BString text(B_TRANSLATE("You can run %appname% in a window" + " or install it in the Deskbar.")); + text.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("ProcessController")); + BAlert* alert = new BAlert(B_TRANSLATE("Info"), text, B_TRANSLATE("Run in window"), B_TRANSLATE("Install in Deskbar"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); @@ -86,8 +87,9 @@ PCApplication::ReadyToRun() return; } } else { - BAlert* alert = new BAlert(B_TRANSLATE("Info"), - B_TRANSLATE("ProcessController is already installed in Deskbar."), + BString text(B_TRANSLATE("%appname% is already installed in Deskbar.")); + text.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("ProcessController")); + BAlert* alert = new BAlert(B_TRANSLATE("Info"), text, B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); diff --git a/src/apps/processcontroller/ProcessController.cpp b/src/apps/processcontroller/ProcessController.cpp index f76f737f7d..c4c1936aca 100644 --- a/src/apps/processcontroller/ProcessController.cpp +++ b/src/apps/processcontroller/ProcessController.cpp @@ -915,10 +915,9 @@ thread_popup(void *arg) addtopbottom(new BSeparatorItem ()); } - - item = new IconMenuItem(gPCView->fProcessControllerIcon, - B_TRANSLATE("About ProcessController" B_UTF8_ELLIPSIS), - new BMessage(B_ABOUT_REQUESTED)); + BString text(B_TRANSLATE("About %appname%" B_UTF8_ELLIPSIS)); + text.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("ProcessController")); + item = new IconMenuItem(gPCView->fProcessControllerIcon, text, new BMessage(B_ABOUT_REQUESTED)); item->SetTarget(gPCView); addtopbottom(item); diff --git a/src/apps/pulse/CPUButton.cpp b/src/apps/pulse/CPUButton.cpp index 354a8c9432..97a7c2b92e 100644 --- a/src/apps/pulse/CPUButton.cpp +++ b/src/apps/pulse/CPUButton.cpp @@ -199,8 +199,9 @@ CPUButton::MouseDown(BPoint point) } else if ((B_SECONDARY_MOUSE_BUTTON & mouseButtons) != 0 && fReplicantInDeskbar) { BPopUpMenu *menu = new BPopUpMenu(B_TRANSLATE("Deskbar menu")); - menu->AddItem(new BMenuItem(B_TRANSLATE("About Pulse" B_UTF8_ELLIPSIS), - new BMessage(B_ABOUT_REQUESTED))); + BString menuLabel(B_TRANSLATE("About %appname%" B_UTF8_ELLIPSIS)); + menuLabel.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("Pulse")); + menu->AddItem(new BMenuItem(menuLabel, new BMessage(B_ABOUT_REQUESTED))); menu->AddSeparatorItem(); menu->AddItem(new BMenuItem(B_TRANSLATE("Remove replicant"), new BMessage(kDeleteReplicant))); diff --git a/src/apps/pulse/NormalPulseView.cpp b/src/apps/pulse/NormalPulseView.cpp index 18fc5cabe2..e64c36c74b 100644 --- a/src/apps/pulse/NormalPulseView.cpp +++ b/src/apps/pulse/NormalPulseView.cpp @@ -75,7 +75,7 @@ NormalPulseView::NormalPulseView(BRect rect) CPUBUTTON_MTOP + ITEM_OFFSET * x + CPUBUTTON_HEIGHT + 7); char temp[4]; snprintf(temp, sizeof(temp), "%hhd", int8(x + 1)); - fCpuButtons[x] = new CPUButton(r, B_TRANSLATE("Pulse"), temp, NULL); + fCpuButtons[x] = new CPUButton(r, B_TRANSLATE_SYSTEM_NAME("Pulse"), temp, NULL); AddChild(fCpuButtons[x]); } diff --git a/src/apps/pulse/PulseApp.cpp b/src/apps/pulse/PulseApp.cpp index 4b96a03609..172c3e8c6f 100644 --- a/src/apps/pulse/PulseApp.cpp +++ b/src/apps/pulse/PulseApp.cpp @@ -219,8 +219,7 @@ PulseApp::MessageReceived(BMessage* message) void PulseApp::AboutRequested() { - BString name = B_TRANSLATE("Pulse"); - + BString name = B_TRANSLATE_SYSTEM_NAME("Pulse"); BString message = B_TRANSLATE( "%s\n\nBy David Ramsey and Arve Hjønnevåg\n" "Revised by Daniel Switkin\n"); diff --git a/src/apps/pulse/PulseView.cpp b/src/apps/pulse/PulseView.cpp index 857c552284..46fda416f9 100644 --- a/src/apps/pulse/PulseView.cpp +++ b/src/apps/pulse/PulseView.cpp @@ -71,8 +71,9 @@ void PulseView::Init() { mode2 = new BMenuItem("", NULL, 0, 0); preferences = new BMenuItem(B_TRANSLATE("Settings" B_UTF8_ELLIPSIS), new BMessage(PV_PREFERENCES), 0, 0); - about = new BMenuItem(B_TRANSLATE("About Pulse" B_UTF8_ELLIPSIS), - new BMessage(PV_ABOUT), 0, 0); + BString menuLabel(B_TRANSLATE("About %appname%" B_UTF8_ELLIPSIS)); + menuLabel.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("Pulse")); + about = new BMenuItem(menuLabel, new BMessage(PV_ABOUT), 0, 0); popupmenu->AddItem(mode1); popupmenu->AddItem(mode2); diff --git a/src/apps/softwareupdater/CheckManager.cpp b/src/apps/softwareupdater/CheckManager.cpp index d877927c06..a202caa1f0 100644 --- a/src/apps/softwareupdater/CheckManager.cpp +++ b/src/apps/softwareupdater/CheckManager.cpp @@ -129,8 +129,9 @@ CheckManager::HandleProblems() } BString title(B_TRANSLATE("Available updates found")); - BString text(B_TRANSLATE("Click here to run SoftwareUpdater. Some updates " + BString text(B_TRANSLATE("Click here to run %appname%. Some updates " "will require a problem solution to be selected.")); + text.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("SoftwareUpdater")); _SendNotification(title, text); throw BAbortedByUserException(); diff --git a/src/apps/terminal/TermApp.cpp b/src/apps/terminal/TermApp.cpp index f8fc73767a..a71efddf1f 100644 --- a/src/apps/terminal/TermApp.cpp +++ b/src/apps/terminal/TermApp.cpp @@ -125,8 +125,9 @@ TermApp::ReadyToRun() // failed spawn, print stdout and open alert panel if (status < B_OK) { - BAlert* alert = new BAlert("alert", - B_TRANSLATE("Terminal couldn't start the shell. Sorry."), + BString text(B_TRANSLATE("%appname% couldn't start the shell. Sorry.")); + text.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("Terminal")); + BAlert* alert = new BAlert("alert", text, B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_FROM_LABEL, B_INFO_ALERT); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); diff --git a/src/apps/terminal/TermWindow.cpp b/src/apps/terminal/TermWindow.cpp index 827266b676..ccbd76854e 100644 --- a/src/apps/terminal/TermWindow.cpp +++ b/src/apps/terminal/TermWindow.cpp @@ -377,7 +377,7 @@ TermWindow::_CanClose(int32 index) // the terminal will be closed. alertMessage = index == -1 || fSessions.CountItems() == 1 ? B_TRANSLATE("The process \"%1\" is still running.\n" - "If you close the Terminal, the process will be killed.") + "If you close %appname%, the process will be killed.") : B_TRANSLATE("The process \"%1\" is still running.\n" "If you close the tab, the process will be killed."); } else { @@ -385,9 +385,9 @@ TermWindow::_CanClose(int32 index) alertMessage = B_TRANSLATE( "The following processes are still running:\n\n" "\t%1\n\n" - "If you close the Terminal, the processes will be killed."); + "If you close %appname%, the processes will be killed."); } - + alertMessage.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("Terminal")); alertMessage.ReplaceFirst("%1", busyProcessNames); BAlert* alert = new BAlert(B_TRANSLATE("Really close?"), @@ -498,13 +498,16 @@ TermWindow::_SetupMenu() if (fEncodingMenu != NULL) MakeEncodingMenu(fEncodingMenu); + BString newTerminal(B_TRANSLATE("New %appname%")); + newTerminal.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("Terminal")); + BLayoutBuilder::Menu<>(fMenuBar = new BMenuBar(Bounds(), "mbar")) // Terminal - .AddMenu(B_TRANSLATE_COMMENT("Terminal", "The title for the main window" - " menubar entry related to terminal sessions")) - .AddItem(B_TRANSLATE("Switch Terminals"), MENU_SWITCH_TERM, B_TAB) + .AddMenu(B_TRANSLATE_SYSTEM_NAME("Terminal")) + .AddItem(B_TRANSLATE_COMMENT("Switch Terminals", "'Terminals' being this application's " + "name"), MENU_SWITCH_TERM, B_TAB) .GetItem(fSwitchTerminalsMenuItem) - .AddItem(B_TRANSLATE("New Terminal"), MENU_NEW_TERM, 'N') + .AddItem(newTerminal, MENU_NEW_TERM, 'N') .AddItem(B_TRANSLATE("New tab"), kNewTab, 'T') .AddSeparator() .AddItem(B_TRANSLATE("Page setup" B_UTF8_ELLIPSIS), MENU_PAGE_SETUP) diff --git a/src/apps/webpositive/BrowserApp.cpp b/src/apps/webpositive/BrowserApp.cpp index 09aaae9bf4..cd838b2608 100644 --- a/src/apps/webpositive/BrowserApp.cpp +++ b/src/apps/webpositive/BrowserApp.cpp @@ -88,10 +88,11 @@ BrowserApp::BrowserApp() get_cpuid(&info, 1, 0); if ((info.eax_1.features & (1 << 26)) == 0) { - BAlert alert(B_TRANSLATE("No SSE2 support"), B_TRANSLATE("Your CPU is " + BString text(B_TRANSLATE("Your CPU is " "too old and does not support the SSE2 extensions, without which " - "WebPositive cannot run. We recommend installing NetSurf instead."), - B_TRANSLATE("Darn!")); + "%appname% cannot run. We recommend installing NetSurf instead.")); + text.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("WebPositive")); + BAlert alert(B_TRANSLATE("No SSE2 support"), text, B_TRANSLATE("Darn!")); alert.Go(); exit(-1); } @@ -388,10 +389,11 @@ bool BrowserApp::QuitRequested() { if (fDownloadWindow->DownloadsInProgress()) { - BAlert* alert = new BAlert(B_TRANSLATE("Downloads in progress"), - B_TRANSLATE("There are still downloads in progress, do you really " - "want to quit WebPositive now?"), B_TRANSLATE("Quit"), - B_TRANSLATE("Continue downloads")); + BString text(B_TRANSLATE("There are still downloads in progress, do you really " + "want to quit %appname% now?")); + text.ReplaceFirst("%appname%", B_TRANSLATE_SYSTEM_NAME("WebPositive")); + BAlert* alert = new BAlert(B_TRANSLATE("Downloads in progress"), text, + B_TRANSLATE("Quit"), B_TRANSLATE("Continue downloads")); int32 choice = alert->Go(); if (choice == 1) { if (fWindowCount == 0) { diff --git a/src/apps/webpositive/DownloadProgressView.cpp b/src/apps/webpositive/DownloadProgressView.cpp index b5cb1ceb53..f74b100f3a 100644 --- a/src/apps/webpositive/DownloadProgressView.cpp +++ b/src/apps/webpositive/DownloadProgressView.cpp @@ -631,7 +631,7 @@ DownloadProgressView::DownloadFinished() fStatusBar->SetBarColor(ui_color(B_SUCCESS_COLOR)); BNotification success(B_INFORMATION_NOTIFICATION); - success.SetGroup(B_TRANSLATE("WebPositive")); + success.SetGroup(B_TRANSLATE_SYSTEM_NAME("WebPositive")); success.SetTitle(B_TRANSLATE("Download finished")); success.SetContent(fPath.Leaf()); BEntry entry(fPath.Path()); @@ -654,7 +654,7 @@ DownloadProgressView::CancelDownload() // Also cancel the download fDownload->Cancel(); BNotification success(B_ERROR_NOTIFICATION); - success.SetGroup(B_TRANSLATE("WebPositive")); + success.SetGroup(B_TRANSLATE_SYSTEM_NAME("WebPositive")); success.SetTitle(B_TRANSLATE("Download aborted")); success.SetContent(fPath.Leaf()); // Don't make a click on the notification open the file: it is not diff --git a/src/preferences/bluetooth/BluetoothMain.cpp b/src/preferences/bluetooth/BluetoothMain.cpp index 23bcff981b..1c5457cbdd 100644 --- a/src/preferences/bluetooth/BluetoothMain.cpp +++ b/src/preferences/bluetooth/BluetoothMain.cpp @@ -94,7 +94,8 @@ BluetoothApplication::MessageReceived(BMessage* message) void BluetoothApplication::AboutRequested() { - BAboutWindow* about = new BAboutWindow("Bluetooth", BLUETOOTH_APP_SIGNATURE); + BAboutWindow* about = new BAboutWindow(B_TRANSLATE_SYSTEM_NAME("Bluetooth"), + BLUETOOTH_APP_SIGNATURE); about->AddCopyright(2010, "Oliver Ruiz Dorantes"); about->AddText(B_TRANSLATE( "With support of:\n" diff --git a/src/preferences/filetypes/FileTypes.cpp b/src/preferences/filetypes/FileTypes.cpp index bc3204f781..db0924b09e 100644 --- a/src/preferences/filetypes/FileTypes.cpp +++ b/src/preferences/filetypes/FileTypes.cpp @@ -393,7 +393,7 @@ FileTypes::MessageReceived(BMessage* message) if (message->FindMessenger("target", &target) != B_OK) target = be_app_messenger; - BString title = B_TRANSLATE("FileTypes"); + BString title = B_TRANSLATE_SYSTEM_NAME("FileTypes"); if (subTitle != NULL && subTitle[0]) { title.Append(": "); title.Append(subTitle); diff --git a/src/preferences/locale/LocalePreflet.cpp b/src/preferences/locale/LocalePreflet.cpp index d4440270db..c8afab6100 100644 --- a/src/preferences/locale/LocalePreflet.cpp +++ b/src/preferences/locale/LocalePreflet.cpp @@ -21,7 +21,7 @@ #define B_TRANSLATION_CONTEXT "Locale Preflet" -const char* kAppName = B_TRANSLATE("Locale"); +const char* kAppName = B_TRANSLATE_SYSTEM_NAME("Locale"); const char* kSignature = "application/x-vnd.Haiku-Locale"; diff --git a/src/preferences/locale/LocaleWindow.cpp b/src/preferences/locale/LocaleWindow.cpp index 14785fee2e..0f2de5e5ef 100644 --- a/src/preferences/locale/LocaleWindow.cpp +++ b/src/preferences/locale/LocaleWindow.cpp @@ -440,7 +440,7 @@ LocaleWindow::MessageReceived(BMessage* message) MutableLocaleRoster::Default()->SetFilesystemTranslationPreferred( value == B_CONTROL_ON); - BAlert* alert = new BAlert(B_TRANSLATE("Locale"), + BAlert* alert = new BAlert(B_TRANSLATE_SYSTEM_NAME("Locale"), B_TRANSLATE("Deskbar and Tracker need to be restarted for this " "change to take effect. Would you like to restart them now?"), B_TRANSLATE("Cancel"), B_TRANSLATE("Restart"), NULL, diff --git a/src/preferences/media/MediaWindow.cpp b/src/preferences/media/MediaWindow.cpp index 4384baf7ec..b3d0dce7c7 100644 --- a/src/preferences/media/MediaWindow.cpp +++ b/src/preferences/media/MediaWindow.cpp @@ -308,9 +308,10 @@ bool MediaWindow::QuitRequested() { if (fRestartThread > 0) { - BString text(B_TRANSLATE("Quitting Media now will stop the " + BString text(B_TRANSLATE("Quitting %prefname% now will stop the " "restarting of the media services. Flaky or unavailable media " "functionality is the likely result.")); + text.ReplaceFirst("%prefname%", B_TRANSLATE_SYSTEM_NAME("Media")); fRestartAlert = new BAlert(B_TRANSLATE("Warning!"), text, B_TRANSLATE("Quit anyway"), NULL, NULL, diff --git a/src/preferences/notifications/PrefletWin.cpp b/src/preferences/notifications/PrefletWin.cpp index 7f75b79b9d..19c1313c31 100644 --- a/src/preferences/notifications/PrefletWin.cpp +++ b/src/preferences/notifications/PrefletWin.cpp @@ -253,10 +253,13 @@ PrefletWin::_DefaultsPossible() void PrefletWin::_SendExampleNotification() { + BString title(B_TRANSLATE("%prefname% preflet sample")); + title.ReplaceFirst("%prefname%", B_TRANSLATE_SYSTEM_NAME("Notifications")); + BNotification notification(B_INFORMATION_NOTIFICATION); notification.SetMessageID(kSampleMessageID); - notification.SetGroup(B_TRANSLATE("Notifications")); - notification.SetTitle(B_TRANSLATE("Notifications preflet sample")); + notification.SetGroup(B_TRANSLATE_SYSTEM_NAME("Notifications")); + notification.SetTitle(title); notification.SetContent(B_TRANSLATE("This is a test notification message")); notification.Send(); } diff --git a/src/preferences/repositories/RepositoriesView.cpp b/src/preferences/repositories/RepositoriesView.cpp index 289394f722..ce30532d4e 100644 --- a/src/preferences/repositories/RepositoriesView.cpp +++ b/src/preferences/repositories/RepositoriesView.cpp @@ -592,9 +592,10 @@ RepositoriesView::_UpdateListFromRoster() BPackageKit::BPackageRoster pRoster; status_t result = pRoster.GetRepositoryNames(repositoryNames); if (result != B_OK) { - (new BAlert("error", - B_TRANSLATE_COMMENT("Repositories could not retrieve the names of " - "the currently enabled repositories.", "Alert error message"), + BString text(B_TRANSLATE_COMMENT("%prefname% could not retrieve the names of " + "the currently enabled repositories.", "Alert error message")); + text.ReplaceFirst("%prefname%", B_TRANSLATE_SYSTEM_NAME("Repositories")); + (new BAlert("error", text, kOKLabel, NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(NULL); return; } diff --git a/src/preferences/shortcuts/ShortcutsWindow.cpp b/src/preferences/shortcuts/ShortcutsWindow.cpp index 4a080e3c5b..7e96f51195 100644 --- a/src/preferences/shortcuts/ShortcutsWindow.cpp +++ b/src/preferences/shortcuts/ShortcutsWindow.cpp @@ -284,10 +284,10 @@ ShortcutsWindow::QuitRequested() // up the file requester if (fLastSaved.InitCheck() == B_OK) { if (_SaveKeySet(fLastSaved) == false) { - BAlert* alert = new BAlert(ERROR, - B_TRANSLATE("Shortcuts was unable to save your " - "KeySet file!"), - B_TRANSLATE("Oh no")); + BString text(B_TRANSLATE("%prefname% was unable to save your " + "KeySet file!")); + text.ReplaceFirst("%prefname%", B_TRANSLATE_SYSTEM_NAME("Shortcuts")); + BAlert* alert = new BAlert(ERROR, text,B_TRANSLATE("Oh no")); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); result = true; // quit anyway @@ -569,9 +569,10 @@ ShortcutsWindow::MessageReceived(BMessage* message) _GetSettingsFile(&eref); if (ref == eref) fKeySetModified = false; } else { - BAlert* alert = new BAlert(ERROR, - B_TRANSLATE("Shortcuts was unable to parse your " - "KeySet file!"), B_TRANSLATE("OK")); + BString text(B_TRANSLATE("%prefname% was unable to parse your " + "KeySet file!")); + text.ReplaceFirst("%prefname%", B_TRANSLATE_SYSTEM_NAME("Shortcuts")); + BAlert* alert = new BAlert(ERROR, text, B_TRANSLATE("OK")); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); break; @@ -623,9 +624,9 @@ ShortcutsWindow::MessageReceived(BMessage* message) // open the save requester... if (showSaveError) { - BAlert* alert = new BAlert(ERROR, - B_TRANSLATE("Shortcuts wasn't able to save your keyset."), - B_TRANSLATE("OK")); + BString text(B_TRANSLATE("%prefname% wasn't able to save your keyset.")); + text.ReplaceFirst("%prefname%", B_TRANSLATE_SYSTEM_NAME("Shortcuts")); + BAlert* alert = new BAlert(ERROR, text, B_TRANSLATE("OK")); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); } diff --git a/src/preferences/sounds/HApp.cpp b/src/preferences/sounds/HApp.cpp index b5330bf13b..7bb8a96f41 100644 --- a/src/preferences/sounds/HApp.cpp +++ b/src/preferences/sounds/HApp.cpp @@ -12,6 +12,7 @@ #include "HApp.h" #include "HWindow.h" +#include #include #include #include @@ -39,16 +40,19 @@ HApp::~HApp() void HApp::AboutRequested() { - BAlert* alert = new BAlert(B_TRANSLATE("About Sounds"), - B_TRANSLATE("Sounds\n" - " Brought to you by :\n" - "\tOliver Ruiz Dorantes\n" - "\tJérôme DUVAL.\n" - " Original work from Atsushi Takamatsu.\n" - "Copyright ©2003-2006 Haiku"), - B_TRANSLATE("OK")); - alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); - alert->Go(); + BAboutWindow* window = new BAboutWindow(B_TRANSLATE_SYSTEM_NAME("Sounds"), + "application/x-vnd.Haiku-Sounds"); + + const char* authors[] = { + "Atsushi Takamatsu", + "Oliver Ruiz Dorantes", + "Jérôme DUVAL", + NULL + }; + + window->AddCopyright(2003, "Haiku, Inc."); + window->AddAuthors(authors); + window->Show(); }