From 5e654f6ab87bab3407c44fbce6b6f2987e10d885 Mon Sep 17 00:00:00 2001 From: Humdinger Date: Sat, 1 Nov 2014 19:06:53 +0100 Subject: [PATCH] Localize keystore_server Signed-off-by: Adrien Destugues Fixes #11404. --- .../keystore/AppAccessRequestWindow.cpp | 40 ++++++++++++------- src/servers/keystore/Jamfile | 9 ++++- src/servers/keystore/KeyRequestWindow.cpp | 23 ++++++----- 3 files changed, 47 insertions(+), 25 deletions(-) diff --git a/src/servers/keystore/AppAccessRequestWindow.cpp b/src/servers/keystore/AppAccessRequestWindow.cpp index c87ca52c05..1a0292afc9 100644 --- a/src/servers/keystore/AppAccessRequestWindow.cpp +++ b/src/servers/keystore/AppAccessRequestWindow.cpp @@ -7,6 +7,7 @@ #include "AppAccessRequestWindow.h" #include +#include #include #include #include @@ -23,6 +24,10 @@ #include +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "AppAccessRequestWindow" + + static const uint32 kMessageDisallow = 'btda'; static const uint32 kMessageOnce = 'btao'; static const uint32 kMessageAlways = 'btaa'; @@ -53,27 +58,32 @@ public: return; BString details; - details << "The application:\n" - << signature << " (" << path << ")\n\n"; + details << B_TRANSLATE("The application:\n" + "%signature% (%path%)\n\n"); + details.ReplaceFirst("%signature%", signature); + details.ReplaceFirst("%path%", path); if (keyringName != NULL) { - details << "requests access to keyring:\n" - << keyringName << "\n\n"; + details << B_TRANSLATE("requests access to keyring:\n" + "%keyringName%\n\n"); + details.ReplaceFirst("%keyringName%", keyringName); } if (accessString != NULL) { - details << "to perform the following action:\n" - << accessString << "\n\n"; + details << B_TRANSLATE("to perform the following action:\n" + "%accessString%\n\n"); + details.ReplaceFirst("%accessString%", accessString); } if (appIsNew) - details << "This application hasn't been granted access before."; + details << B_TRANSLATE("This application hasn't been granted " + "access before."); else if (appWasUpdated) { - details << "This application has been updated since it was last" - << " granted access."; + details << B_TRANSLATE("This application has been updated since " + "it was last granted access."); } else { - details << "This application doesn't yet have the required" - " privileges."; + details << B_TRANSLATE("This application doesn't yet have the " + "required privileges."); } message->SetText(details); @@ -92,17 +102,17 @@ public: if (buttons == NULL) return; - fDisallowButton = new(std::nothrow) BButton("Disallow", + fDisallowButton = new(std::nothrow) BButton(B_TRANSLATE("Disallow"), new BMessage(kMessageDisallow)); buttons->GroupLayout()->AddView(fDisallowButton); buttons->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue()); - fOnceButton = new(std::nothrow) BButton("Allow Once", + fOnceButton = new(std::nothrow) BButton(B_TRANSLATE("Allow once"), new BMessage(kMessageOnce)); buttons->GroupLayout()->AddView(fOnceButton); - fAlwaysButton = new(std::nothrow) BButton("Allow Always", + fAlwaysButton = new(std::nothrow) BButton(B_TRANSLATE("Allow always"), new BMessage(kMessageAlways)); buttons->GroupLayout()->AddView(fAlwaysButton); @@ -132,7 +142,7 @@ AppAccessRequestWindow::AppAccessRequestWindow(const char* keyringName, const char* signature, const char* path, const char* accessString, bool appIsNew, bool appWasUpdated) : - BWindow(BRect(50, 50, 269, 302), "Application Keyring Access", + BWindow(BRect(50, 50, 269, 302), B_TRANSLATE("Application keyring access"), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_AUTO_UPDATE_SIZE_LIMITS), fRequestView(NULL), diff --git a/src/servers/keystore/Jamfile b/src/servers/keystore/Jamfile index 3237a52781..bcad91a135 100644 --- a/src/servers/keystore/Jamfile +++ b/src/servers/keystore/Jamfile @@ -8,6 +8,13 @@ Server keystore_server : Keyring.cpp KeyStoreServer.cpp - : be [ TargetLibstdc++ ] + : be localestub [ TargetLibstdc++ ] : keystore_server.rdef ; + +DoCatalogs keystore_server : + x-vnd.Haiku-keystore_server + : + AppAccessRequestWindow.cpp + KeyRequestWindow.cpp +; diff --git a/src/servers/keystore/KeyRequestWindow.cpp b/src/servers/keystore/KeyRequestWindow.cpp index bfee16f16d..76466577da 100644 --- a/src/servers/keystore/KeyRequestWindow.cpp +++ b/src/servers/keystore/KeyRequestWindow.cpp @@ -7,6 +7,7 @@ #include "KeyRequestWindow.h" #include +#include #include #include #include @@ -26,6 +27,10 @@ #include +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "KeyRequestWindow" + + static const uint32 kMessageCancel = 'btcl'; static const uint32 kMessageUnlock = 'btul'; @@ -57,7 +62,7 @@ public: layout->SetSpacing(inset, inset); BStringView* label = new(std::nothrow) BStringView("keyringLabel", - "Keyring:"); + B_TRANSLATE("Keyring:")); if (label == NULL) return; @@ -70,7 +75,7 @@ public: layout->AddView(fKeyringName, 1, row++); - fPassword = new(std::nothrow) BTextControl("Password:", "", NULL); + fPassword = new(std::nothrow) BTextControl(B_TRANSLATE("Password:"), "", NULL); if (fPassword == NULL) return; @@ -86,23 +91,23 @@ public: if (buttons == NULL) return; - fCancelButton = new(std::nothrow) BButton("Cancel", + fCancelButton = new(std::nothrow) BButton(B_TRANSLATE("Cancel"), new BMessage(kMessageCancel)); buttons->GroupLayout()->AddView(fCancelButton); buttons->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue()); - fUnlockButton = new(std::nothrow) BButton("Unlock", + fUnlockButton = new(std::nothrow) BButton(B_TRANSLATE("Unlock"), new BMessage(kMessageUnlock)); buttons->GroupLayout()->AddView(fUnlockButton); BTextView* message = new(std::nothrow) BTextView("message"); - message->SetText("An application wants to access the keyring below, " - "but it is locked with a passphrase. Please enter the passphrase " - "to unlock the keyring.\n" + message->SetText(B_TRANSLATE("An application wants to access the " + "keyring below, but it is locked with a passphrase. Please enter " + "the passphrase to unlock the keyring.\n" "If you unlock the keyring, it stays unlocked until the system is " "shut down or the keyring is manually locked again.\n" - "If you cancel this dialog the keyring will remain locked."); + "If you cancel this dialog the keyring will remain locked.")); message->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR); message->SetFontAndColor(be_plain_font, B_FONT_ALL, &textColor); @@ -147,7 +152,7 @@ private: KeyRequestWindow::KeyRequestWindow() : - BWindow(BRect(50, 50, 269, 302), "Unlock Keyring", + BWindow(BRect(50, 50, 269, 302), B_TRANSLATE("Unlock keyring"), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_AUTO_UPDATE_SIZE_LIMITS), fRequestView(NULL),