From 82c06bba2552c4665a9aa5da144b4725f0a2a9f0 Mon Sep 17 00:00:00 2001 From: Jaidyn Ann Date: Mon, 19 Jul 2021 09:54:27 -0500 Subject: [PATCH] Localization, init catkeys --- application/ChatCommand.cpp | 12 +- application/Conversation.cpp | 21 +++- application/Makefile | 4 +- application/Role.h | 8 +- application/Server.cpp | 29 +++-- application/TheApp.cpp | 31 ++--- application/Utils.cpp | 17 ++- application/preferences/AccountDialog.cpp | 32 +++-- .../preferences/PreferencesAccounts.cpp | 31 +++-- .../preferences/PreferencesBehavior.cpp | 42 ++++--- .../preferences/PreferencesChatWindow.cpp | 13 ++- .../preferences/PreferencesReplicant.cpp | 17 ++- application/views/ConversationListView.cpp | 7 +- application/views/InviteDialogue.cpp | 9 +- application/views/ReplicantStatusView.cpp | 9 +- application/views/RosterListView.cpp | 20 +++- application/views/RosterView.cpp | 13 ++- application/views/UserListView.cpp | 8 +- application/windows/AboutWindow.cpp | 18 ++- application/windows/MainWindow.cpp | 57 +++++---- application/windows/PreferencesWindow.cpp | 11 +- application/windows/RosterEditWindow.cpp | 14 ++- application/windows/TemplateWindow.cpp | 19 ++- locales/en.catkeys | 109 ++++++++++++++++++ 24 files changed, 404 insertions(+), 147 deletions(-) create mode 100644 locales/en.catkeys diff --git a/application/ChatCommand.cpp b/application/ChatCommand.cpp index 088b992..363f3e5 100644 --- a/application/ChatCommand.cpp +++ b/application/ChatCommand.cpp @@ -5,6 +5,7 @@ #include "ChatCommand.h" +#include #include #include "Conversation.h" @@ -12,6 +13,10 @@ #include "TheApp.h" +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "ChatCommand" + + ChatCommand::ChatCommand(const char* name, BMessage msg, bool toProtocol, List argTypes) : @@ -105,7 +110,8 @@ ChatCommand::_ProcessArgs(BString args, BMessage* msg, BString* errorMsg, case CMD_ROOM_PARTICIPANT: { if (chat->UserById(arg) == NULL) { - errorMsg->SetTo("%user% isn't a member of this room."); + errorMsg->SetTo(B_TRANSLATE("%user% isn't a member of this " + "room.")); errorMsg->ReplaceAll("%user%", arg); return false; } @@ -115,8 +121,8 @@ ChatCommand::_ProcessArgs(BString args, BMessage* msg, BString* errorMsg, case CMD_KNOWN_USER: { if (chat->GetProtocolLooper()->UserById(arg) == NULL) { - errorMsg->SetTo("You aren't contacts with and have no chats " - "in common with %user%. Shame."); + errorMsg->SetTo(B_TRANSLATE("You aren't contacts with and " + "have no chats in common with %user%. Shame.")); errorMsg->ReplaceAll("%user%", arg); return false; } diff --git a/application/Conversation.cpp b/application/Conversation.cpp index 14a9cd6..2edae05 100644 --- a/application/Conversation.cpp +++ b/application/Conversation.cpp @@ -5,6 +5,7 @@ #include "Conversation.h" +#include #include #include #include @@ -76,6 +77,9 @@ Conversation::ImMessage(BMessage* msg) { case IM_MESSAGE_RECEIVED: { +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "Conversation ― Notifications" + _EnsureUser(msg); _LogChatMessage(msg); GetView()->MessageReceived(msg); @@ -93,18 +97,19 @@ Conversation::ImMessage(BMessage* msg) if (winFocused == false && AppPreferences::Item()->NotifyNewMessage && (fUsers.CountItems() <= 2 || mentioned == true)) { - BString notifyTitle = "New mention"; - BString notifyText = "You've been summoned from %source%."; + BString notifyTitle = B_TRANSLATE("New mention"); + BString notifyText = B_TRANSLATE("You've been summoned from " + "%source%."); if (mentioned == false) { fNotifyMessageCount++; - notifyTitle.SetTo("New message"); + notifyTitle.SetTo(B_TRANSLATE("New message")); notifyText.SetTo(""); - BStringFormat pmFormat("{0, plural," + BStringFormat pmFormat(B_TRANSLATE("{0, plural," "=1{You've got a new message from %source%.}" - "other{You've got # new messages from %source%.}}"); + "other{You've got # new messages from %source%.}}")); pmFormat.Format(notifyText, fNotifyMessageCount); } else @@ -142,6 +147,9 @@ Conversation::ImMessage(BMessage* msg) } case IM_SEND_MESSAGE: { +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "Conversation ― Command info" + BString body; if (msg->FindString("body", &body) != B_OK) break; @@ -156,7 +164,8 @@ Conversation::ImMessage(BMessage* msg) ChatCommand* cmd = _GetServer()->CommandById(name, fLooper->GetInstance()); if (cmd == NULL) { - _WarnUser(BString("That isn't a valid command. Try /help for a list.")); + _WarnUser(BString(B_TRANSLATE("That isn't a valid command. " + "Try /help for a list."))); break; } diff --git a/application/Makefile b/application/Makefile index 73f2bad..4c67a2e 100644 --- a/application/Makefile +++ b/application/Makefile @@ -122,7 +122,7 @@ RSRCS = # - if your library does not follow the standard library naming scheme, # you need to specify the path to the library and it's name. # (e.g. for mylib.a, specify "mylib.a" or "path/mylib.a") -LIBS = be expat interface runview shared support translation $(STDCPPLIBS) +LIBS = be expat interface localestub runview shared support translation $(STDCPPLIBS) # Specify additional paths to directories following the standard libXXX.so @@ -151,7 +151,7 @@ OPTIMIZE := # will recreate only the "locales/en.catkeys" file. Use it as a template # for creating catkeys for other languages. All localization files must be # placed in the "locales" subdirectory. -LOCALES = +LOCALES = en # Specify all the preprocessor symbols to be defined. The symbols will not # have their values set automatically; you must supply the value (if any) to diff --git a/application/Role.h b/application/Role.h index 7d82dde..ee6cf72 100644 --- a/application/Role.h +++ b/application/Role.h @@ -5,16 +5,22 @@ #ifndef _ROLE_H #define _ROLE_H +#include #include #include #include "Flags.h" +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "User role" + + class Role { public: Role() - : fTitle("Default"), fPerms(0 | PERM_WRITE | PERM_READ), fPriority(0) + : fTitle(B_TRANSLATE("Default")), fPerms(0 | PERM_WRITE | PERM_READ), + fPriority(0) { } diff --git a/application/Server.cpp b/application/Server.cpp index aa26498..335bad5 100644 --- a/application/Server.cpp +++ b/application/Server.cpp @@ -16,6 +16,7 @@ #include "Server.h" #include +#include #include #include #include @@ -40,6 +41,10 @@ #include "Utils.h" +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "Server" + + Server::Server() : BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE) @@ -133,10 +138,10 @@ Server::Filter(BMessage* message, BHandler **target) if (AppPreferences::Item()->NotifyProtocolStatus == true && message->FindString("name", &name) == B_OK) { BBitmap* icon = new BBitmap(message); - BString content("%user% has been disabled!"); + BString content(B_TRANSLATE("%user% has been disabled!")); content.ReplaceAll("%user%", name); - _SendNotification("Disabled", content, icon); + _SendNotification(B_TRANSLATE("Disabled"), content, icon); } break; } @@ -178,8 +183,8 @@ Server::Filter(BMessage* message, BHandler **target) if (cmd_name.IsEmpty() == false) { ChatCommand* cmd = CommandById(cmd_name, instance); if (cmd == NULL) - body = "-- That command doesn't exist. Try '/help' for a " - "list.\n"; + body = B_TRANSLATE("-- That command doesn't exist. Try " + "'/help' for a list.\n"); else { body = "** "; body << cmd->GetName() << " ― " << cmd->GetDesc() << "\n"; @@ -190,7 +195,7 @@ Server::Filter(BMessage* message, BHandler **target) combinedCmds.AddList(fCommands); combinedCmds.AddList(chat->GetProtocolLooper()->Commands()); - body << "** Commands: "; + body << B_TRANSLATE("** Commands: "); for (int i = 0; i < combinedCmds.CountItems(); i++) { ChatCommand* cmd = combinedCmds.ValueAt(i); if (i > 0) body << ", "; @@ -498,9 +503,9 @@ Server::ImMessage(BMessage* msg) if (user != NULL) user_name = user->GetName(); - BString alertBody("You've been invited to %room%."); + BString alertBody(B_TRANSLATE("You've been invited to %room%.")); if (user_id.IsEmpty() == false) - alertBody = "%user% has invited you to %room%."; + alertBody = B_TRANSLATE("%user% has invited you to %room%."); if (body.IsEmpty() == false) alertBody << "\n\n\"%body%\""; @@ -516,7 +521,7 @@ Server::ImMessage(BMessage* msg) reject->AddString("chat_id", chat_id); InviteDialogue* invite = new InviteDialogue(BMessenger(looper), - "Invitation received", + B_TRANSLATE("Invitation received"), alertBody.String(), accept, reject); invite->Go(); break; @@ -579,8 +584,8 @@ Server::ImMessage(BMessage* msg) // Ready notification if (AppPreferences::Item()->NotifyProtocolStatus == true) - _ProtocolNotification(looper, BString("Connected"), - BString("%user% has connected!")); + _ProtocolNotification(looper, BString(B_TRANSLATE("Connected")), + BString(B_TRANSLATE("%user% has connected!"))); // Join cached rooms BEntry entry; @@ -647,8 +652,8 @@ Server::ImError(BMessage* msg) if (detail) errMsg << "\n\n" << detail; - BAlert* alert = new BAlert("Error", errMsg.String(), "OK", NULL, NULL, - B_WIDTH_AS_USUAL, B_STOP_ALERT); + BAlert* alert = new BAlert(B_TRANSLATE("Error"), errMsg.String(), + B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); alert->Go(); } diff --git a/application/TheApp.cpp b/application/TheApp.cpp index 5e01689..e588030 100644 --- a/application/TheApp.cpp +++ b/application/TheApp.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -28,6 +29,10 @@ #include "Server.h" +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "TheApp" + + int main(int argc, char* argv[]) { @@ -67,9 +72,9 @@ TheApp::ReadyToRun() if (entry.Exists()) Emoticor::Get()->LoadConfig(currentPath.Path()); else { - BString msg("Can't find smileys settings in:\n\n"); - msg << currentPath.Path(); - BAlert* alert = new BAlert("", msg.String(), "Ouch!"); + BString msg(B_TRANSLATE("Can't find smileys settings in:\n\n%path%")); + msg.ReplaceAll("%path%", currentPath.Path()); + BAlert* alert = new BAlert("", msg.String(), B_TRANSLATE("Ouch!")); // alert->Go(); } printf("Loaded Emoticons settings from: %s\n", currentPath.Path()); @@ -82,9 +87,9 @@ TheApp::ReadyToRun() ProtocolManager::Get()->Init(BDirectory(currentPath.Path()), fMainWin); } else { - BString msg("Can't find protocols in:\n\n"); - msg << currentPath.Path(); - BAlert* alert = new BAlert("", msg.String(), "Ouch!"); + BString msg("Can't find protocols in:\n\n%path%"); + msg.ReplaceAll("%path%", currentPath.Path()); + BAlert* alert = new BAlert("", msg.String(), B_TRANSLATE("Ouch!")); alert->Go(); PostMessage(B_QUIT_REQUESTED); return; @@ -115,14 +120,14 @@ TheApp::AboutRequested() NULL }; - BString extraInfo; - extraInfo << "%app% is released under the GNU GPL License." << "\n"; - extraInfo << "Some parts of %app% are available under MIT license." << "\n"; - extraInfo << "Built: " << BUILD_DATE; - extraInfo.ReplaceAll("%app%", APP_NAME); + BString extraInfo(B_TRANSLATE("%app% is released under the GNU GPL " + "License.\nSome parts of %app% are available under MIT license.\n" + "Built: %buildDate%")); + extraInfo.ReplaceAll("%buildDate", BUILD_DATE); + extraInfo.ReplaceAll("%app%", B_TRANSLATE_SYSTEM_NAME(APP_NAME)); - AboutWindow* about = new AboutWindow(APP_NAME, holders, - authors, extraInfo.String()); + AboutWindow* about = new AboutWindow(B_TRANSLATE_SYSTEM_NAME(APP_NAME), + holders, authors, extraInfo.String()); about->Show(); delete about; } diff --git a/application/Utils.cpp b/application/Utils.cpp index d852d50..6544225 100644 --- a/application/Utils.cpp +++ b/application/Utils.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -22,22 +23,26 @@ #include "Utils.h" +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "Utils ― Status names" + + const char* UserStatusToString(UserStatus status) { switch (status) { case STATUS_ONLINE: - return "Available"; + return B_TRANSLATE("Available"); case STATUS_AWAY: - return "Away"; + return B_TRANSLATE("Away"); case STATUS_DO_NOT_DISTURB: - return "Busy"; + return B_TRANSLATE("Busy"); case STATUS_CUSTOM_STATUS: - return "Custom Status"; + return B_TRANSLATE("Custom Status"); case STATUS_INVISIBLE: - return "Invisible"; + return B_TRANSLATE("Invisible"); case STATUS_OFFLINE: - return "Offline"; + return B_TRANSLATE("Offline"); default: return NULL; } diff --git a/application/preferences/AccountDialog.cpp b/application/preferences/AccountDialog.cpp index 4e3fb15..4e1d0e2 100644 --- a/application/preferences/AccountDialog.cpp +++ b/application/preferences/AccountDialog.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -19,6 +20,11 @@ #include "ProtocolSettings.h" #include "TemplateView.h" + +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "AccountDialog" + + const uint32 kCancel = 'canc'; const uint32 kOK = 'save'; @@ -32,7 +38,8 @@ AccountDialog::AccountDialog(const char* title, ProtocolSettings* settings, fAccount(account), fTarget(NULL) { - fAccountName = new BTextControl("accountName", "Account name:", NULL, NULL); + fAccountName = new BTextControl("accountName", B_TRANSLATE("Account name:"), + NULL, NULL); fAccountName->SetExplicitMinSize(BSize(300, B_SIZE_UNSET)); fAccountName->SetFont(be_bold_font); @@ -46,8 +53,8 @@ AccountDialog::AccountDialog(const char* title, ProtocolSettings* settings, else fSettings->Load(NULL, fTop); - BButton* cancel = new BButton("Cancel", new BMessage(kCancel)); - BButton* ok = new BButton("OK", new BMessage(kOK)); + BButton* cancel = new BButton(B_TRANSLATE("Cancel"), new BMessage(kCancel)); + BButton* ok = new BButton(B_TRANSLATE("OK"), new BMessage(kOK)); const float spacing = be_control_look->DefaultItemSpacing(); BLayoutBuilder::Group<>(this, B_VERTICAL) @@ -88,18 +95,20 @@ AccountDialog::MessageReceived(BMessage* msg) // Rename account settings if (renaming) { if (fSettings->Rename(fAccount.String(), fAccountName->Text()) != B_OK) { - BString text("An error is occurred renaming the account "); - text << fAccount << " to " << fAccountName->Text() << "!"; - BAlert* alert = new BAlert("", text.String(), "OK", NULL, NULL, - B_WIDTH_AS_USUAL, B_STOP_ALERT); + BString text(B_TRANSLATE("An error is occurred renaming " + "the account to %name%!")); + text.ReplaceAll("%name%", fAccountName->Text()); + BAlert* alert = new BAlert("", text.String(), + B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, + B_STOP_ALERT); alert->Go(); return; } } // Save account settings - BString error = "An error has occured saving the settings.\n" - "Check if your disk has enough space."; + BString error = B_TRANSLATE("An error has occured saving the " + "settings.\nCheck if your disk has enough space."); if (fSettings->Save(fAccountName->Text(), fTop, &error) == B_OK) { if (fTarget && (adding || renaming)) { @@ -116,8 +125,9 @@ AccountDialog::MessageReceived(BMessage* msg) Close(); } else { - BAlert* alert = new BAlert("", error.String(), "OK", NULL, NULL, - B_WIDTH_AS_USUAL, B_STOP_ALERT); + BAlert* alert = new BAlert("", error.String(), + B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, + B_STOP_ALERT); alert->Go(); } break; diff --git a/application/preferences/PreferencesAccounts.cpp b/application/preferences/PreferencesAccounts.cpp index 594821a..0a80bbd 100644 --- a/application/preferences/PreferencesAccounts.cpp +++ b/application/preferences/PreferencesAccounts.cpp @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -28,6 +29,10 @@ #include "TheApp.h" +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "PreferencesAccounts" + + const uint32 kAddAccount = 'adac'; const uint32 kEditAccount = 'edac'; const uint32 kDelAccount = 'dlac'; @@ -74,11 +79,14 @@ PreferencesAccounts::PreferencesAccounts() fProtosMenu->AddItem(item); } - ToolButton* proto = new ToolButton("Add", NULL); + ToolButton* proto = new ToolButton(B_TRANSLATE("Add"), NULL); proto->SetMenu(fProtosMenu); - fDelButton = new BButton("Del", new BMessage(kDelAccount)); - fEditButton = new BButton("Edit" B_UTF8_ELLIPSIS, new BMessage(kEditAccount)); - fToggleButton = new BButton("Enable", new BMessage(kToggleAccount)); + fDelButton = new BButton(B_TRANSLATE_COMMENT("Del", "Short for 'delete'"), + new BMessage(kDelAccount)); + fEditButton = new BButton(B_TRANSLATE("Edit" B_UTF8_ELLIPSIS), + new BMessage(kEditAccount)); + fToggleButton = new BButton(B_TRANSLATE("Enable"), + new BMessage(kToggleAccount)); fDelButton->SetEnabled(false); fEditButton->SetEnabled(false); fToggleButton->SetEnabled(false); @@ -125,11 +133,11 @@ PreferencesAccounts::MessageReceived(BMessage* msg) AccountListItem* item = (AccountListItem*)fListView->ItemAt(fListView->CurrentSelection()); if (_AccountEnabled(item->Account() ) == true) { - fToggleButton->SetLabel("Disable"); + fToggleButton->SetLabel(B_TRANSLATE("Disable")); fToggleButton->SetEnabled(true); } else { - fToggleButton->SetLabel("Enable"); + fToggleButton->SetLabel(B_TRANSLATE("Enable")); fToggleButton->SetEnabled(false); } } @@ -142,8 +150,8 @@ PreferencesAccounts::MessageReceived(BMessage* msg) ProtocolSettings* settings = reinterpret_cast(pointer); if (settings) { - AccountDialog* dialog = new AccountDialog("Add account", - settings); + AccountDialog* dialog = new AccountDialog( + B_TRANSLATE("Add account"), settings); dialog->SetTarget(this); dialog->Show(); } @@ -159,8 +167,9 @@ PreferencesAccounts::MessageReceived(BMessage* msg) AccountListItem* item = dynamic_cast(fListView->ItemAt(selected)); - AccountDialog* dialog = new AccountDialog("Edit account", - item->Settings(), item->Account()); + AccountDialog* dialog = new AccountDialog( + B_TRANSLATE("Edit account"), item->Settings(), + item->Account()); dialog->SetTarget(this); dialog->Show(); } @@ -202,7 +211,7 @@ PreferencesAccounts::MessageReceived(BMessage* msg) remove->AddInt64("instance", instance); ((TheApp*)be_app)->GetMainWindow()->PostMessage(remove); - fToggleButton->SetLabel("Enable"); + fToggleButton->SetLabel(B_TRANSLATE("Enable")); fToggleButton->SetEnabled(false); break; } diff --git a/application/preferences/PreferencesBehavior.cpp b/application/preferences/PreferencesBehavior.cpp index 372f6fe..07e76fa 100644 --- a/application/preferences/PreferencesBehavior.cpp +++ b/application/preferences/PreferencesBehavior.cpp @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -23,6 +24,11 @@ #include "ReplicantStatusView.h" #include "TheApp.h" + +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "PreferencesBehavior" + + const uint32 kToCurrentWorkspace = 'CBcw'; const uint32 kRaiseOnMessageReceived = 'FCmr'; const uint32 kRaiseUserIsTyping = 'FCit'; @@ -35,63 +41,69 @@ const uint32 kDisablePrompt = 'DiPr'; PreferencesBehavior::PreferencesBehavior() - : BView("Behavior", B_WILL_DRAW) + : BView(B_TRANSLATE("Behavior"), B_WILL_DRAW) { - fOnIncoming = new BStringView("onIncoming", "On incoming message..."); + fOnIncoming = new BStringView("onIncoming", B_TRANSLATE("On incoming " + "message" B_UTF8_ELLIPSIS)); fOnIncoming->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE)); fOnIncoming->SetFont(be_bold_font); fHideOffline = new BCheckBox("HideOfflineContacts", - "Hide offline contacts", + B_TRANSLATE("Hide offline contacts"), new BMessage(kHideOffline)); fToCurrentWorkspace = new BCheckBox("ToCurrentWorkspace", - "Move window to current workspace", + B_TRANSLATE("Move window to current workspace"), new BMessage(kToCurrentWorkspace)); fRaiseOnMessageReceived = new BCheckBox("FocusOnMessageReceived", - "Auto-raise when a message is received", + B_TRANSLATE("Auto-raise when a message is received"), new BMessage(kRaiseOnMessageReceived)); fRaiseUserIsTyping = new BCheckBox("FocusUserIsTyping", - "Auto-raise when user is typing", + B_TRANSLATE("Auto-raise when user is typing"), new BMessage(kRaiseUserIsTyping)); fPlaySoundOnMessageReceived = new BCheckBox("PlaySoundOnMessageReceived", - "Play sound event", NULL); + B_TRANSLATE("Play sound event"), NULL); fPlaySoundOnMessageReceived->SetEnabled(false); // not implemented fMarkUnreadWindow = new BCheckBox("MarkUnreadWindow", - "Mark unread window chat", new BMessage(kMarkUnreadWindow)); + B_TRANSLATE("Mark unread window chat"), + new BMessage(kMarkUnreadWindow)); /*fMarkUnreadWindow->SetEnabled(false); implementing it right now*/ fMarkUnreadReplicant = new BCheckBox("MarkUnreadReplicant", - "Mark unread the Deskbar Replicant", NULL); + B_TRANSLATE("Mark unread the Deskbar Replicant"), NULL); fMarkUnreadReplicant->SetEnabled(false); // not implemented fNotifications = new BStringView("notifications", - "Deskbar Notifications (experimental)"); + B_TRANSLATE("Deskbar Notifications (experimental)")); fNotifications->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE)); fNotifications->SetFont(be_bold_font); fNotifyProtocols = new BCheckBox("EnableProtocolNotify", - "Enable protocol status notifications",new BMessage(kNotifyProtocolsLogin)); + B_TRANSLATE("Enable protocol status notifications"), + new BMessage(kNotifyProtocolsLogin)); fNotifyContactStatus = new BCheckBox("EnableContactNotify", - "Enable contact status notifications",new BMessage(kNotifyContactStatus)); + B_TRANSLATE("Enable contact status notifications"), + new BMessage(kNotifyContactStatus)); fNotifyNewMessage = new BCheckBox("EnableMessageNotify", - "Enable message notifications", new BMessage(kNotifyNewMessage)); + B_TRANSLATE("Enable message notifications"), + new BMessage(kNotifyNewMessage)); - fGeneral = new BStringView("onGeneral", "General"); + fGeneral = new BStringView("onGeneral", B_TRANSLATE("General")); fGeneral->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE)); fGeneral->SetFont(be_bold_font); fDisableQuitConfirm = new BCheckBox("DisableQuitConfirm", - "Don't ask confirmation at Quit", new BMessage(kDisablePrompt)); + B_TRANSLATE("Don't ask confirmation at Quit"), + new BMessage(kDisablePrompt)); const float spacing = be_control_look->DefaultItemSpacing(); SetLayout(new BGroupLayout(B_HORIZONTAL, spacing)); diff --git a/application/preferences/PreferencesChatWindow.cpp b/application/preferences/PreferencesChatWindow.cpp index 34fa987..364b294 100644 --- a/application/preferences/PreferencesChatWindow.cpp +++ b/application/preferences/PreferencesChatWindow.cpp @@ -4,6 +4,7 @@ * Distributed under the terms of the MIT License. */ +#include #include #include #include @@ -18,19 +19,25 @@ #include "MainWindow.h" #include "TheApp.h" + +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "PreferencesChatWindow" + + const uint32 kIgnoreEmoticons = 'CBhe'; PreferencesChatWindow::PreferencesChatWindow() - : BView("Chat Window", B_WILL_DRAW) + : BView(B_TRANSLATE("Chat display"), B_WILL_DRAW) { - fChatWindowString = new BStringView("ChatWindowString", "Chat Window Settings"); + fChatWindowString = new BStringView("ChatWindowString", + B_TRANSLATE("Chat settings")); fChatWindowString->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE)); fChatWindowString->SetFont(be_bold_font); fIgnoreEmoticons = new BCheckBox("IgnoreEmoticons", - "Ignore Emoticons", + B_TRANSLATE("Ignore emoticons"), new BMessage(kIgnoreEmoticons)); fIgnoreEmoticons->SetEnabled(true); diff --git a/application/preferences/PreferencesReplicant.cpp b/application/preferences/PreferencesReplicant.cpp index c9a0965..ef59062 100644 --- a/application/preferences/PreferencesReplicant.cpp +++ b/application/preferences/PreferencesReplicant.cpp @@ -4,6 +4,7 @@ * Distributed under the terms of the MIT License. */ +#include #include #include #include @@ -21,16 +22,21 @@ #include "ReplicantStatusView.h" #include "TheApp.h" + +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "PreferencesReplicant" + + const uint32 kDisableReplicant = 'DSrp'; const uint32 kPermanentReplicant ='PRpt'; const uint32 kHideDeskbar = 'HCtk'; PreferencesReplicant::PreferencesReplicant() - : BView("Replicant", B_WILL_DRAW) + : BView(B_TRANSLATE("Replicant"), B_WILL_DRAW) { fReplicantString = new BStringView("ReplicantString", - "Deskbar Replicant"); + B_TRANSLATE("Deskbar replicant")); fReplicantString->SetExplicitAlignment( BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE)); @@ -38,17 +44,18 @@ PreferencesReplicant::PreferencesReplicant() fReplicantString->SetFont(be_bold_font); fDisableReplicant = new BCheckBox("DisableReplicant", - "Disable Deskbar replicant", new BMessage(kDisableReplicant)); + B_TRANSLATE("Disable deskbar replicant"), + new BMessage(kDisableReplicant)); if (!AppPreferences::Item()->HideDeskbar) Looper()->PostMessage(new BMessage(kDisableReplicant)); fPermanentReplicant = new BCheckBox("PermanentReplicant", - "Permanent Deskbar Replicant", NULL); + B_TRANSLATE("Permanent deskbar replicant"), NULL); fPermanentReplicant->SetEnabled(false); fHideDeskbar = new BCheckBox("HideDeskbar", - "Hide field in Deskbar", new BMessage(kHideDeskbar)); + B_TRANSLATE("Hide field in Deskbar"), new BMessage(kHideDeskbar)); fHideDeskbar->SetEnabled(false); const float spacing = be_control_look->DefaultItemSpacing(); diff --git a/application/views/ConversationListView.cpp b/application/views/ConversationListView.cpp index 893861d..734613c 100644 --- a/application/views/ConversationListView.cpp +++ b/application/views/ConversationListView.cpp @@ -5,6 +5,7 @@ #include "ConversationListView.h" +#include #include #include #include @@ -20,6 +21,10 @@ #include "TheApp.h" +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "ConversationListView" + + const uint32 kOpenSelectedChat = 'CVos'; const uint32 kLeaveSelectedChat = 'CVcs'; @@ -200,7 +205,7 @@ ConversationListView::_BlankPopUp() enabled = true; BPopUpMenu* menu = new BPopUpMenu("blankPopUp"); - BMenuItem* newChat = new BMenuItem("New chat" B_UTF8_ELLIPSIS, + BMenuItem* newChat = new BMenuItem(B_TRANSLATE("New chat" B_UTF8_ELLIPSIS), new BMessage(APP_NEW_CHAT), 'M', B_COMMAND_KEY); newChat->SetEnabled(enabled); diff --git a/application/views/InviteDialogue.cpp b/application/views/InviteDialogue.cpp index cc9f066..3251bbd 100644 --- a/application/views/InviteDialogue.cpp +++ b/application/views/InviteDialogue.cpp @@ -5,14 +5,19 @@ #include "InviteDialogue.h" +#include #include +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "InviteDialogue" + + InviteDialogue::InviteDialogue(BMessenger target, const char* title, const char* body, BMessage* acceptMsg, BMessage* rejectMsg, BBitmap* icon) : - BAlert(title, body, "Cancel", "Reject", "Accept", B_WIDTH_AS_USUAL, - B_OFFSET_SPACING), + BAlert(title, body, B_TRANSLATE("Cancel"), B_TRANSLATE("Reject"), + B_TRANSLATE("Accept"), B_WIDTH_AS_USUAL, B_OFFSET_SPACING), fMessenger(target), fAcceptMsg(acceptMsg), fRejectMsg(rejectMsg) diff --git a/application/views/ReplicantStatusView.cpp b/application/views/ReplicantStatusView.cpp index f5a402a..64b5a75 100644 --- a/application/views/ReplicantStatusView.cpp +++ b/application/views/ReplicantStatusView.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -36,6 +37,10 @@ #include "Utils.h" +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "ReplicantStatusView" + + extern "C" _EXPORT BView *instantiate_deskbar_item(void); @@ -324,10 +329,10 @@ ReplicantStatusView::_BuildMenu() fReplicantMenu->AddItem(new BSeparatorItem()); - fReplicantMenu->AddItem(new BitmapMenuItem("Preferences ", + fReplicantMenu->AddItem(new BitmapMenuItem(B_TRANSLATE("Preferences "), new BMessage(APP_SHOW_SETTINGS), fPreferencesIcon)); - fReplicantMenu->AddItem(new BitmapMenuItem("Exit", + fReplicantMenu->AddItem(new BitmapMenuItem(B_TRANSLATE("Exit"), new BMessage(APP_REPLICANT_EXIT), fExitMenuIcon)); fReplicantMenu->SetTargetForItems(this); diff --git a/application/views/RosterListView.cpp b/application/views/RosterListView.cpp index 5125186..8e4adb1 100644 --- a/application/views/RosterListView.cpp +++ b/application/views/RosterListView.cpp @@ -8,14 +8,15 @@ #include "RosterListView.h" +#include +#include + +#include #include #include #include #include -#include -#include - #include "ChatProtocolMessages.h" #include "Contact.h" #include "ProtocolLooper.h" @@ -23,6 +24,11 @@ #include "TheApp.h" #include "UserInfoWindow.h" + +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "RosterListView" + + const int32 kAddPeople = 'ADPL'; const int32 kSendFile = 'SDFL'; const int32 kShowLogs = 'SHLG'; @@ -65,14 +71,16 @@ RosterListView::RosterListView(const char* name) fPopUp = new BPopUpMenu("contextMenu", false, false); BMenuItem* item = NULL; - fPopUp->AddItem(new BMenuItem("Start a chat", new BMessage(kStartConv))); - item = new BMenuItem("Send a file" B_UTF8_ELLIPSIS, new BMessage(kSendFile)); + fPopUp->AddItem(new BMenuItem(B_TRANSLATE("Start a chat"), + new BMessage(kStartConv))); + item = new BMenuItem(B_TRANSLATE("Send a file" B_UTF8_ELLIPSIS), + new BMessage(kSendFile)); item->SetEnabled(false); fPopUp->AddItem(item); fPopUp->AddItem(new BSeparatorItem()); - fPopUp->AddItem(new BMenuItem("User info" B_UTF8_ELLIPSIS, + fPopUp->AddItem(new BMenuItem(B_TRANSLATE("User info" B_UTF8_ELLIPSIS), new BMessage(kGetInfo))); fPopUp->SetTargetForItems(this); diff --git a/application/views/RosterView.cpp b/application/views/RosterView.cpp index fee50c5..6b93321 100644 --- a/application/views/RosterView.cpp +++ b/application/views/RosterView.cpp @@ -12,6 +12,7 @@ #include "RosterView.h" +#include #include #include #include @@ -24,6 +25,10 @@ #include "RosterListView.h" +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "RosterView" + + const uint32 kSearchContact = 'RWSC'; @@ -145,13 +150,15 @@ RosterView::ImMessage(BMessage* msg) message << rosterItem->GetContact()->GetName(); if (status == STATUS_ONLINE) - message << " is available!"; + message.SetTo("%name% is available!"); else - message << " is offline!"; + message.SetTo("%name% is offline!"); + message.ReplaceAll("%name%", + rosterItem->GetContact()->GetName()); BNotification notification(B_INFORMATION_NOTIFICATION); notification.SetGroup(BString(APP_NAME)); - notification.SetTitle(BString("Presence")); + notification.SetTitle(BString(B_TRANSLATE("Presence"))); notification.SetIcon(rosterItem->Bitmap()); notification.SetContent(message); notification.Send(); diff --git a/application/views/UserListView.cpp b/application/views/UserListView.cpp index 7f0fe28..89408bd 100644 --- a/application/views/UserListView.cpp +++ b/application/views/UserListView.cpp @@ -5,6 +5,7 @@ #include "UserListView.h" +#include #include #include #include @@ -22,6 +23,9 @@ #include "UserItem.h" +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "UserListView" + UserListView::UserListView(const char* name) : BListView(name), @@ -79,8 +83,8 @@ UserListView::_BlankPopUp() { BPopUpMenu* menu = new BPopUpMenu("blankPopUp"); - BMenuItem* invite = new BMenuItem("Invite user…" B_UTF8_ELLIPSIS, - new BMessage(APP_SEND_INVITE), 'I', B_COMMAND_KEY); + BMenuItem* invite = new BMenuItem(B_TRANSLATE("Invite user" + B_UTF8_ELLIPSIS), new BMessage(APP_SEND_INVITE), 'I', B_COMMAND_KEY); if (fChat == NULL) invite->SetEnabled(false); diff --git a/application/windows/AboutWindow.cpp b/application/windows/AboutWindow.cpp index df9d2f4..1e6335d 100644 --- a/application/windows/AboutWindow.cpp +++ b/application/windows/AboutWindow.cpp @@ -9,6 +9,7 @@ */ #include +#include #include #include #include @@ -16,6 +17,10 @@ #include "AboutWindow.h" +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "About window" + + AboutWindow::AboutWindow(const char* appName, const char** holders, const char** authors, const char* extraInfo) { @@ -26,11 +31,13 @@ AboutWindow::AboutWindow(const char* appName, const char** holders, BString text(appName); text << "\n\n"; for (i = 0; holders[i]; i++) - text << "Copyright " B_UTF8_COPYRIGHT " " << holders[i] << "\n"; - text << "\nWritten by:\n"; - for (int32 i = 0; authors[i]; i++) + text << B_TRANSLATE("Copyright " B_UTF8_COPYRIGHT " ") << holders[i] + << "\n"; + + text << B_TRANSLATE("\nWritten by:\n"); + for (int32 i = 0; authors[i]; i++) { text << " " << authors[i] << "\n"; - + } // The extra information is optional if (extraInfo != NULL) text << "\n" << extraInfo << "\n"; @@ -49,7 +56,8 @@ AboutWindow::~AboutWindow() void AboutWindow::Show() { - BAlert* alert = new BAlert("About" B_UTF8_ELLIPSIS, fText->String(), "Close"); + BAlert* alert = new BAlert(B_TRANSLATE("About" B_UTF8_ELLIPSIS), + fText->String(), B_TRANSLATE("Close")); BTextView* view = alert->TextView(); BFont font; view->SetStylable(true); diff --git a/application/windows/MainWindow.cpp b/application/windows/MainWindow.cpp index be502a6..e2efaf8 100644 --- a/application/windows/MainWindow.cpp +++ b/application/windows/MainWindow.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -36,12 +37,17 @@ #include "TemplateWindow.h" +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "MainWindow" + + const uint32 kLogin = 'LOGI'; MainWindow::MainWindow() : - BWindow(BRect(0, 0, 600, 400), APP_NAME, B_TITLED_WINDOW, 0), + BWindow(BRect(0, 0, 600, 400), B_TRANSLATE_SYSTEM_NAME(APP_NAME), + B_TITLED_WINDOW, 0), fWorkspaceChanged(false), fConversation(NULL), fRosterWindow(NULL), @@ -76,9 +82,10 @@ MainWindow::QuitRequested() int32 button_index = 0; if(!AppPreferences::Item()->DisableQuitConfirm) { - BAlert* alert = new BAlert("Closing", "Are you sure you want to quit?", - "Yes", "No", NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, - B_WARNING_ALERT); + BAlert* alert = new BAlert(B_TRANSLATE("Closing"), + B_TRANSLATE("Are you sure you want to quit?"), + B_TRANSLATE("Yes"), B_TRANSLATE("No"), NULL, B_WIDTH_AS_USUAL, + B_OFFSET_SPACING, B_WARNING_ALERT); alert->SetShortcut(0, B_ESCAPE); button_index = alert->Go(); } @@ -109,8 +116,8 @@ MainWindow::MessageReceived(BMessage* message) BMessage* newMsg = new BMessage(IM_MESSAGE); newMsg->AddInt32("im_what", IM_CREATE_CHAT); - fRosterWindow = new RosterWindow("Invite contact to chat" - B_UTF8_ELLIPSIS, newMsg, new BMessenger(this), fServer); + fRosterWindow = new RosterWindow(B_TRANSLATE("Invite contact to " + "chat" B_UTF8_ELLIPSIS), newMsg, new BMessenger(this), fServer); fRosterWindow->Show(); break; } @@ -119,7 +126,7 @@ MainWindow::MessageReceived(BMessage* message) BMessage* createMsg = new BMessage(IM_MESSAGE); createMsg->AddInt32("im_what", IM_CREATE_ROOM); - TemplateWindow* win = new TemplateWindow("Create room", + TemplateWindow* win = new TemplateWindow(B_TRANSLATE("Create room"), "create_room", createMsg, fServer); win->Show(); break; @@ -129,7 +136,7 @@ MainWindow::MessageReceived(BMessage* message) BMessage* joinMsg = new BMessage(IM_MESSAGE); joinMsg->AddInt32("im_what", IM_JOIN_ROOM); - TemplateWindow* win = new TemplateWindow("Join a room", + TemplateWindow* win = new TemplateWindow(B_TRANSLATE("Join a room"), "join_room", joinMsg, fServer); win->Show(); break; @@ -146,8 +153,8 @@ MainWindow::MessageReceived(BMessage* message) ProtocolLooper* plooper = fConversation->GetProtocolLooper(); BLooper* looper = (BLooper*)plooper; - fRosterWindow = new RosterWindow("Invite contact to chat" - B_UTF8_ELLIPSIS, invite, new BMessenger(looper), fServer, + fRosterWindow = new RosterWindow(B_TRANSLATE("Invite contact to " + "chat" B_UTF8_ELLIPSIS), invite, new BMessenger(looper), fServer, plooper->GetInstance()); fRosterWindow->Show(); @@ -425,41 +432,41 @@ MainWindow::_CreateMenuBar() BMenuBar* menuBar = new BMenuBar("MenuBar"); // Program - BMenu* programMenu = new BMenu("Program"); - programMenu->AddItem(new BMenuItem("About" B_UTF8_ELLIPSIS, + BMenu* programMenu = new BMenu(B_TRANSLATE("Program")); + programMenu->AddItem(new BMenuItem(B_TRANSLATE("About" B_UTF8_ELLIPSIS), new BMessage(B_ABOUT_REQUESTED))); - programMenu->AddItem(new BMenuItem("Preferences" B_UTF8_ELLIPSIS, + programMenu->AddItem(new BMenuItem(B_TRANSLATE("Preferences" B_UTF8_ELLIPSIS), new BMessage(APP_SHOW_SETTINGS), ',', B_COMMAND_KEY)); programMenu->AddItem(new BSeparatorItem()); - programMenu->AddItem(new BMenuItem("Quit", + programMenu->AddItem(new BMenuItem(B_TRANSLATE("Quit"), new BMessage(B_QUIT_REQUESTED), 'Q', B_COMMAND_KEY)); programMenu->SetTargetForItems(this); // Chat - BMenu* chatMenu = new BMenu("Chat"); - chatMenu->AddItem(new BMenuItem("Join room" B_UTF8_ELLIPSIS, + BMenu* chatMenu = new BMenu(B_TRANSLATE("Chat")); + chatMenu->AddItem(new BMenuItem(B_TRANSLATE("Join room" B_UTF8_ELLIPSIS), new BMessage(APP_JOIN_ROOM), 'J', B_COMMAND_KEY)); chatMenu->AddSeparatorItem(); - chatMenu->AddItem(new BMenuItem("New room" B_UTF8_ELLIPSIS, + chatMenu->AddItem(new BMenuItem(B_TRANSLATE("New room" B_UTF8_ELLIPSIS), new BMessage(APP_NEW_ROOM), 'N', B_COMMAND_KEY)); - chatMenu->AddItem(new BMenuItem("New chat" B_UTF8_ELLIPSIS, + chatMenu->AddItem(new BMenuItem(B_TRANSLATE("New chat" B_UTF8_ELLIPSIS), new BMessage(APP_NEW_CHAT), 'M', B_COMMAND_KEY)); chatMenu->SetTargetForItems(this); // Roster - BMenu* rosterMenu = new BMenu("Roster"); - rosterMenu->AddItem(new BMenuItem("Edit roster" B_UTF8_ELLIPSIS, + BMenu* rosterMenu = new BMenu(B_TRANSLATE("Roster")); + rosterMenu->AddItem(new BMenuItem(B_TRANSLATE("Edit roster" B_UTF8_ELLIPSIS), new BMessage(APP_EDIT_ROSTER), 'R', B_COMMAND_KEY)); rosterMenu->AddSeparatorItem(); - rosterMenu->AddItem(new BMenuItem("Invite user" B_UTF8_ELLIPSIS, + rosterMenu->AddItem(new BMenuItem(B_TRANSLATE("Invite user" B_UTF8_ELLIPSIS), new BMessage(APP_SEND_INVITE), 'I', B_COMMAND_KEY)); rosterMenu->SetTargetForItems(this); // Window - BMenu* windowMenu = new BMenu("Window"); - windowMenu->AddItem(new BMenuItem("Up", + BMenu* windowMenu = new BMenu(B_TRANSLATE("Window")); + windowMenu->AddItem(new BMenuItem(B_TRANSLATE("Up"), new BMessage(APP_MOVE_UP), B_UP_ARROW, B_COMMAND_KEY)); - windowMenu->AddItem(new BMenuItem("Down", + windowMenu->AddItem(new BMenuItem(B_TRANSLATE("Down"), new BMessage(APP_MOVE_DOWN), B_DOWN_ARROW, B_COMMAND_KEY)); windowMenu->SetTargetForItems(this); @@ -475,7 +482,7 @@ MainWindow::_CreateMenuBar() void MainWindow::_ToggleMenuItems() { - BMenuItem* chatMenuItem = fMenuBar->FindItem("Chat"); + BMenuItem* chatMenuItem = fMenuBar->FindItem(B_TRANSLATE("Chat")); BMenu* chatMenu = chatMenuItem->Submenu(); if (chatMenuItem == NULL || chatMenu == NULL) return; diff --git a/application/windows/PreferencesWindow.cpp b/application/windows/PreferencesWindow.cpp index 54c0e76..7660325 100644 --- a/application/windows/PreferencesWindow.cpp +++ b/application/windows/PreferencesWindow.cpp @@ -9,6 +9,7 @@ #include "PreferencesWindow.h" #include +#include #include #include #include @@ -19,12 +20,16 @@ #include "PreferencesReplicant.h" +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "PreferencesWindow" + + const uint32 kApply = 'SAVE'; PreferencesWindow::PreferencesWindow() - : BWindow(BRect(0, 0, 500, 615), "Preferences", B_TITLED_WINDOW, - B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_CLOSE_ON_ESCAPE) + : BWindow(BRect(0, 0, 500, 615), B_TRANSLATE("Preferences"), + B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_CLOSE_ON_ESCAPE) { BTabView* tabView = new BTabView("tabView", B_WIDTH_AS_USUAL); tabView->AddTab(new PreferencesAccounts()); @@ -32,7 +37,7 @@ PreferencesWindow::PreferencesWindow() tabView->AddTab(new PreferencesChatWindow()); tabView->AddTab(new PreferencesReplicant()); - BButton* ok = new BButton("OK", new BMessage(kApply)); + BButton* ok = new BButton(B_TRANSLATE("OK"), new BMessage(kApply)); BLayoutBuilder::Group<>(this, B_VERTICAL) .Add(tabView) diff --git a/application/windows/RosterEditWindow.cpp b/application/windows/RosterEditWindow.cpp index fd2d9bf..c5dafc9 100644 --- a/application/windows/RosterEditWindow.cpp +++ b/application/windows/RosterEditWindow.cpp @@ -13,6 +13,7 @@ #include "RosterEditWindow.h" #include +#include #include #include #include @@ -29,6 +30,10 @@ #include "Utils.h" +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "RosterEditWindow" + + const uint32 kSendMessage = 'RWSM'; const uint32 kAddMember = 'RWAM'; const uint32 kRemoveMember = 'RWRM'; @@ -41,7 +46,7 @@ RosterEditWindow* RosterEditWindow::fInstance = NULL; RosterEditWindow::RosterEditWindow(Server* server) : - BWindow(BRect(0, 0, 300, 400), "Roster", B_FLOATING_WINDOW, 0), + BWindow(BRect(0, 0, 300, 400), B_TRANSLATE("Roster"), B_FLOATING_WINDOW, 0), fAccounts(server->GetAccounts()), fServer(server), fEditingWindow(NULL) @@ -139,8 +144,8 @@ RosterEditWindow::MessageReceived(BMessage* message) edit->AddInt32("im_what", IM_CONTACT_LIST_EDIT_CONTACT); fEditingWindow = - new TemplateWindow("Editing contact", "roster", edit, fServer, - user->GetProtocolLooper()->GetInstance()); + new TemplateWindow(B_TRANSLATE("Editing contact"), "roster", + edit, fServer, user->GetProtocolLooper()->GetInstance()); fEditingWindow->Show(); break; } @@ -149,7 +154,8 @@ RosterEditWindow::MessageReceived(BMessage* message) BMessage* add = new BMessage(IM_MESSAGE); add->AddInt32("im_what", IM_CONTACT_LIST_ADD_CONTACT); TemplateWindow* win = - new TemplateWindow("Adding contact", "roster", add, fServer); + new TemplateWindow(B_TRANSLATE("Adding contact"), "roster", + add, fServer); win->Show(); break; } diff --git a/application/windows/TemplateWindow.cpp b/application/windows/TemplateWindow.cpp index 818f1eb..961e2bb 100644 --- a/application/windows/TemplateWindow.cpp +++ b/application/windows/TemplateWindow.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -22,6 +23,10 @@ #include "TemplateView.h" +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "TemplateWindow" + + const uint32 kOK = 'save'; const uint32 kAccSelected = 'JWas'; @@ -83,14 +88,15 @@ TemplateWindow::MessageReceived(BMessage* msg) // Save account settings if (fTemplate == NULL || fTemplateView == NULL) break; - BString error = "Some items are empty. Please make sure to fill " - "out every item."; + BString error = B_TRANSLATE("Some items are empty. Please make " + "sure to fill out every item."); BMessage* settings = new BMessage(*fMessage); status_t result = fTemplate->Save(fTemplateView, settings, &error); if (result != B_OK) { - BAlert* alert = new BAlert("", error.String(), "OK", NULL, NULL, - B_WIDTH_AS_USUAL, B_WARNING_ALERT); + BAlert* alert = new BAlert("", error.String(), + B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, + B_WARNING_ALERT); alert->Go(); break; } @@ -139,7 +145,7 @@ TemplateWindow::_InitInterface(bigtime_t instance) fMenuField->SetEnabled(false); } - BButton* fOkButton = new BButton("OK", new BMessage(kOK)); + BButton* fOkButton = new BButton(B_TRANSLATE("OK"), new BMessage(kOK)); if (fAccounts.CountItems() <= 0) fOkButton->SetEnabled(false); fOkButton->MakeDefault(true); @@ -152,7 +158,8 @@ TemplateWindow::_InitInterface(bigtime_t instance) .AddGroup(B_HORIZONTAL) .Add(fMenuField) .AddGlue() - .Add(new BButton("Cancel", new BMessage(B_QUIT_REQUESTED))) + .Add(new BButton(B_TRANSLATE("Cancel"), + new BMessage(B_QUIT_REQUESTED))) .Add(fOkButton) .End() .End(); diff --git a/locales/en.catkeys b/locales/en.catkeys new file mode 100644 index 0000000..e4a7aef --- /dev/null +++ b/locales/en.catkeys @@ -0,0 +1,109 @@ +1 English application/x-vnd.cardie 2325201334 +Disable deskbar replicant PreferencesReplicant Disable deskbar replicant +New mention Conversation ― Notifications New mention +Auto-raise when a message is received PreferencesBehavior Auto-raise when a message is received +Account name: AccountDialog Account name: +Connected Server Connected +Preferences… MainWindow Preferences… +Adding contact RosterEditWindow Adding contact +Deskbar replicant PreferencesReplicant Deskbar replicant +Add account PreferencesAccounts Add account +Start a chat RosterListView Start a chat +Enable PreferencesAccounts Enable +%app% is released under the GNU GPL License.\nSome parts of %app% are available under MIT license.\nBuilt: %buildDate% TheApp %app% is released under the GNU GPL License.\nSome parts of %app% are available under MIT license.\nBuilt: %buildDate% +Create room MainWindow Create room +New chat… ConversationListView New chat… +Hide field in Deskbar PreferencesReplicant Hide field in Deskbar +Ouch! TheApp Ouch! +Edit roster… MainWindow Edit roster… +Join a room MainWindow Join a room +OK PreferencesWindow OK +Enable protocol status notifications PreferencesBehavior Enable protocol status notifications +Send a file… RosterListView Send a file… +Are you sure you want to quit? MainWindow Are you sure you want to quit? +Del PreferencesAccounts Short for 'delete' Del +New message Conversation ― Notifications New message +Some items are empty. Please make sure to fill out every item. TemplateWindow Some items are empty. Please make sure to fill out every item. +Enable message notifications PreferencesBehavior Enable message notifications +Program MainWindow Program +Cancel AccountDialog Cancel +Behavior PreferencesBehavior Behavior +Replicant PreferencesReplicant Replicant +Play sound event PreferencesBehavior Play sound event +You've been summoned from %source%. Conversation ― Notifications You've been summoned from %source%. +Disabled Server Disabled +That isn't a valid command. Try /help for a list. Conversation ― Command info That isn't a valid command. Try /help for a list. +-- That command doesn't exist. Try '/help' for a list.\n Server -- That command doesn't exist. Try '/help' for a list.\n +OK TemplateWindow OK +Reject InviteDialogue Reject +\nWritten by:\n About window \nWritten by:\n +Disable PreferencesAccounts Disable +Offline Utils ― Status names Offline +%user% has been disabled! Server %user% has been disabled! +You've been invited to %room%. Server You've been invited to %room%. +Invite user… UserListView Invite user… +Add PreferencesAccounts Add +Preferences PreferencesWindow Preferences +General PreferencesBehavior General +Presence RosterView Presence +Cancel TemplateWindow Cancel +Hide offline contacts PreferencesBehavior Hide offline contacts +Busy Utils ― Status names Busy +Roster RosterEditWindow Roster +Don't ask confirmation at Quit PreferencesBehavior Don't ask confirmation at Quit +Closing MainWindow Closing +Available Utils ― Status names Available +Up MainWindow Up +Custom Status Utils ― Status names Custom Status +Can't find smileys settings in:\n\n%path% TheApp Can't find smileys settings in:\n\n%path% +Invite user… MainWindow Invite user… +Mark unread window chat PreferencesBehavior Mark unread window chat +Join room… MainWindow Join room… +Preferences ReplicantStatusView Preferences +Quit MainWindow Quit +Chat MainWindow Chat +No MainWindow No +Chat settings PreferencesChatWindow Chat settings +Cancel InviteDialogue Cancel +Mark unread the Deskbar Replicant PreferencesBehavior Mark unread the Deskbar Replicant +OK Server OK +Deskbar Notifications (experimental) PreferencesBehavior Deskbar Notifications (experimental) +Exit ReplicantStatusView Exit +User info… RosterListView User info… +Move window to current workspace PreferencesBehavior Move window to current workspace +Away Utils ― Status names Away +OK AccountDialog OK +Editing contact RosterEditWindow Editing contact +%user% isn't a member of this room. ChatCommand %user% isn't a member of this room. +Edit account PreferencesAccounts Edit account +Down MainWindow Down +** Commands: Server ** Commands: +Cardie System name Cardie +About… About window About… +Ignore emoticons PreferencesChatWindow Ignore emoticons +Invitation received Server Invitation received +Enable contact status notifications PreferencesBehavior Enable contact status notifications +Auto-raise when user is typing PreferencesBehavior Auto-raise when user is typing +Error Server Error +Copyright © About window Copyright © +Roster MainWindow Roster +Accept InviteDialogue Accept +An error is occurred renaming the account to %name%! AccountDialog An error is occurred renaming the account to %name%! +%user% has invited you to %room%. Server %user% has invited you to %room%. +Permanent deskbar replicant PreferencesReplicant Permanent deskbar replicant +Default User role Default +Invite contact to chat… MainWindow Invite contact to chat… +%user% has connected! Server %user% has connected! +Invisible Utils ― Status names Invisible +{0, plural,=1{You've got a new message from %source%.}other{You've got # new messages from %source%.}} Conversation ― Notifications {0, plural,=1{You've got a new message from %source%.}other{You've got # new messages from %source%.}} +Window MainWindow Window +On incoming message… PreferencesBehavior On incoming message… +Yes MainWindow Yes +An error has occured saving the settings.\nCheck if your disk has enough space. AccountDialog An error has occured saving the settings.\nCheck if your disk has enough space. +Close About window Close +New chat… MainWindow New chat… +Edit… PreferencesAccounts Edit… +About… MainWindow About… +New room… MainWindow New room… +You aren't contacts with and have no chats in common with %user%. Shame. ChatCommand You aren't contacts with and have no chats in common with %user%. Shame. +Chat display PreferencesChatWindow Chat display