Localization, init catkeys

This commit is contained in:
Jaidyn Ann 2021-07-19 09:54:27 -05:00
parent 2d36152296
commit 82c06bba25
24 changed files with 404 additions and 147 deletions

View File

@ -5,6 +5,7 @@
#include "ChatCommand.h" #include "ChatCommand.h"
#include <Catalog.h>
#include <StringList.h> #include <StringList.h>
#include "Conversation.h" #include "Conversation.h"
@ -12,6 +13,10 @@
#include "TheApp.h" #include "TheApp.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "ChatCommand"
ChatCommand::ChatCommand(const char* name, BMessage msg, bool toProtocol, ChatCommand::ChatCommand(const char* name, BMessage msg, bool toProtocol,
List<int32> argTypes) List<int32> argTypes)
: :
@ -105,7 +110,8 @@ ChatCommand::_ProcessArgs(BString args, BMessage* msg, BString* errorMsg,
case CMD_ROOM_PARTICIPANT: case CMD_ROOM_PARTICIPANT:
{ {
if (chat->UserById(arg) == NULL) { 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); errorMsg->ReplaceAll("%user%", arg);
return false; return false;
} }
@ -115,8 +121,8 @@ ChatCommand::_ProcessArgs(BString args, BMessage* msg, BString* errorMsg,
case CMD_KNOWN_USER: case CMD_KNOWN_USER:
{ {
if (chat->GetProtocolLooper()->UserById(arg) == NULL) { if (chat->GetProtocolLooper()->UserById(arg) == NULL) {
errorMsg->SetTo("You aren't contacts with and have no chats " errorMsg->SetTo(B_TRANSLATE("You aren't contacts with and "
"in common with %user%. Shame."); "have no chats in common with %user%. Shame."));
errorMsg->ReplaceAll("%user%", arg); errorMsg->ReplaceAll("%user%", arg);
return false; return false;
} }

View File

@ -5,6 +5,7 @@
#include "Conversation.h" #include "Conversation.h"
#include <Catalog.h>
#include <DateTimeFormat.h> #include <DateTimeFormat.h>
#include <Locale.h> #include <Locale.h>
#include <Notification.h> #include <Notification.h>
@ -76,6 +77,9 @@ Conversation::ImMessage(BMessage* msg)
{ {
case IM_MESSAGE_RECEIVED: case IM_MESSAGE_RECEIVED:
{ {
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "Conversation ― Notifications"
_EnsureUser(msg); _EnsureUser(msg);
_LogChatMessage(msg); _LogChatMessage(msg);
GetView()->MessageReceived(msg); GetView()->MessageReceived(msg);
@ -93,18 +97,19 @@ Conversation::ImMessage(BMessage* msg)
if (winFocused == false && AppPreferences::Item()->NotifyNewMessage if (winFocused == false && AppPreferences::Item()->NotifyNewMessage
&& (fUsers.CountItems() <= 2 || mentioned == true)) && (fUsers.CountItems() <= 2 || mentioned == true))
{ {
BString notifyTitle = "New mention"; BString notifyTitle = B_TRANSLATE("New mention");
BString notifyText = "You've been summoned from %source%."; BString notifyText = B_TRANSLATE("You've been summoned from "
"%source%.");
if (mentioned == false) { if (mentioned == false) {
fNotifyMessageCount++; fNotifyMessageCount++;
notifyTitle.SetTo("New message"); notifyTitle.SetTo(B_TRANSLATE("New message"));
notifyText.SetTo(""); notifyText.SetTo("");
BStringFormat pmFormat("{0, plural," BStringFormat pmFormat(B_TRANSLATE("{0, plural,"
"=1{You've got a new message from %source%.}" "=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); pmFormat.Format(notifyText, fNotifyMessageCount);
} }
else else
@ -142,6 +147,9 @@ Conversation::ImMessage(BMessage* msg)
} }
case IM_SEND_MESSAGE: case IM_SEND_MESSAGE:
{ {
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "Conversation ― Command info"
BString body; BString body;
if (msg->FindString("body", &body) != B_OK) if (msg->FindString("body", &body) != B_OK)
break; break;
@ -156,7 +164,8 @@ Conversation::ImMessage(BMessage* msg)
ChatCommand* cmd = _GetServer()->CommandById(name, fLooper->GetInstance()); ChatCommand* cmd = _GetServer()->CommandById(name, fLooper->GetInstance());
if (cmd == NULL) { 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; break;
} }

View File

@ -122,7 +122,7 @@ RSRCS =
# - if your library does not follow the standard library naming scheme, # - if your library does not follow the standard library naming scheme,
# you need to specify the path to the library and it's name. # 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") # (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 # 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 # will recreate only the "locales/en.catkeys" file. Use it as a template
# for creating catkeys for other languages. All localization files must be # for creating catkeys for other languages. All localization files must be
# placed in the "locales" subdirectory. # placed in the "locales" subdirectory.
LOCALES = LOCALES = en
# Specify all the preprocessor symbols to be defined. The symbols will not # 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 # have their values set automatically; you must supply the value (if any) to

View File

@ -5,16 +5,22 @@
#ifndef _ROLE_H #ifndef _ROLE_H
#define _ROLE_H #define _ROLE_H
#include <Catalog.h>
#include <String.h> #include <String.h>
#include <SupportDefs.h> #include <SupportDefs.h>
#include "Flags.h" #include "Flags.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "User role"
class Role { class Role {
public: public:
Role() Role()
: fTitle("Default"), fPerms(0 | PERM_WRITE | PERM_READ), fPriority(0) : fTitle(B_TRANSLATE("Default")), fPerms(0 | PERM_WRITE | PERM_READ),
fPriority(0)
{ {
} }

View File

@ -16,6 +16,7 @@
#include "Server.h" #include "Server.h"
#include <Application.h> #include <Application.h>
#include <Catalog.h>
#include <Debug.h> #include <Debug.h>
#include <Entry.h> #include <Entry.h>
#include <Notification.h> #include <Notification.h>
@ -40,6 +41,10 @@
#include "Utils.h" #include "Utils.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "Server"
Server::Server() Server::Server()
: :
BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE) BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE)
@ -133,10 +138,10 @@ Server::Filter(BMessage* message, BHandler **target)
if (AppPreferences::Item()->NotifyProtocolStatus == true if (AppPreferences::Item()->NotifyProtocolStatus == true
&& message->FindString("name", &name) == B_OK) { && message->FindString("name", &name) == B_OK) {
BBitmap* icon = new BBitmap(message); BBitmap* icon = new BBitmap(message);
BString content("%user% has been disabled!"); BString content(B_TRANSLATE("%user% has been disabled!"));
content.ReplaceAll("%user%", name); content.ReplaceAll("%user%", name);
_SendNotification("Disabled", content, icon); _SendNotification(B_TRANSLATE("Disabled"), content, icon);
} }
break; break;
} }
@ -178,8 +183,8 @@ Server::Filter(BMessage* message, BHandler **target)
if (cmd_name.IsEmpty() == false) { if (cmd_name.IsEmpty() == false) {
ChatCommand* cmd = CommandById(cmd_name, instance); ChatCommand* cmd = CommandById(cmd_name, instance);
if (cmd == NULL) if (cmd == NULL)
body = "-- That command doesn't exist. Try '/help' for a " body = B_TRANSLATE("-- That command doesn't exist. Try "
"list.\n"; "'/help' for a list.\n");
else { else {
body = "** "; body = "** ";
body << cmd->GetName() << "" << cmd->GetDesc() << "\n"; body << cmd->GetName() << "" << cmd->GetDesc() << "\n";
@ -190,7 +195,7 @@ Server::Filter(BMessage* message, BHandler **target)
combinedCmds.AddList(fCommands); combinedCmds.AddList(fCommands);
combinedCmds.AddList(chat->GetProtocolLooper()->Commands()); combinedCmds.AddList(chat->GetProtocolLooper()->Commands());
body << "** Commands: "; body << B_TRANSLATE("** Commands: ");
for (int i = 0; i < combinedCmds.CountItems(); i++) { for (int i = 0; i < combinedCmds.CountItems(); i++) {
ChatCommand* cmd = combinedCmds.ValueAt(i); ChatCommand* cmd = combinedCmds.ValueAt(i);
if (i > 0) body << ", "; if (i > 0) body << ", ";
@ -498,9 +503,9 @@ Server::ImMessage(BMessage* msg)
if (user != NULL) if (user != NULL)
user_name = user->GetName(); 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) 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) if (body.IsEmpty() == false)
alertBody << "\n\n\"%body%\""; alertBody << "\n\n\"%body%\"";
@ -516,7 +521,7 @@ Server::ImMessage(BMessage* msg)
reject->AddString("chat_id", chat_id); reject->AddString("chat_id", chat_id);
InviteDialogue* invite = new InviteDialogue(BMessenger(looper), InviteDialogue* invite = new InviteDialogue(BMessenger(looper),
"Invitation received", B_TRANSLATE("Invitation received"),
alertBody.String(), accept, reject); alertBody.String(), accept, reject);
invite->Go(); invite->Go();
break; break;
@ -579,8 +584,8 @@ Server::ImMessage(BMessage* msg)
// Ready notification // Ready notification
if (AppPreferences::Item()->NotifyProtocolStatus == true) if (AppPreferences::Item()->NotifyProtocolStatus == true)
_ProtocolNotification(looper, BString("Connected"), _ProtocolNotification(looper, BString(B_TRANSLATE("Connected")),
BString("%user% has connected!")); BString(B_TRANSLATE("%user% has connected!")));
// Join cached rooms // Join cached rooms
BEntry entry; BEntry entry;
@ -647,8 +652,8 @@ Server::ImError(BMessage* msg)
if (detail) if (detail)
errMsg << "\n\n" << detail; errMsg << "\n\n" << detail;
BAlert* alert = new BAlert("Error", errMsg.String(), "OK", NULL, NULL, BAlert* alert = new BAlert(B_TRANSLATE("Error"), errMsg.String(),
B_WIDTH_AS_USUAL, B_STOP_ALERT); B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->Go(); alert->Go();
} }

View File

@ -13,6 +13,7 @@
#include <stdio.h> #include <stdio.h>
#include <Alert.h> #include <Alert.h>
#include <Catalog.h>
#include <Path.h> #include <Path.h>
#include <Roster.h> #include <Roster.h>
@ -28,6 +29,10 @@
#include "Server.h" #include "Server.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "TheApp"
int int
main(int argc, char* argv[]) main(int argc, char* argv[])
{ {
@ -67,9 +72,9 @@ TheApp::ReadyToRun()
if (entry.Exists()) if (entry.Exists())
Emoticor::Get()->LoadConfig(currentPath.Path()); Emoticor::Get()->LoadConfig(currentPath.Path());
else { else {
BString msg("Can't find smileys settings in:\n\n"); BString msg(B_TRANSLATE("Can't find smileys settings in:\n\n%path%"));
msg << currentPath.Path(); msg.ReplaceAll("%path%", currentPath.Path());
BAlert* alert = new BAlert("", msg.String(), "Ouch!"); BAlert* alert = new BAlert("", msg.String(), B_TRANSLATE("Ouch!"));
// alert->Go(); // alert->Go();
} }
printf("Loaded Emoticons settings from: %s\n", currentPath.Path()); printf("Loaded Emoticons settings from: %s\n", currentPath.Path());
@ -82,9 +87,9 @@ TheApp::ReadyToRun()
ProtocolManager::Get()->Init(BDirectory(currentPath.Path()), ProtocolManager::Get()->Init(BDirectory(currentPath.Path()),
fMainWin); fMainWin);
} else { } else {
BString msg("Can't find protocols in:\n\n"); BString msg("Can't find protocols in:\n\n%path%");
msg << currentPath.Path(); msg.ReplaceAll("%path%", currentPath.Path());
BAlert* alert = new BAlert("", msg.String(), "Ouch!"); BAlert* alert = new BAlert("", msg.String(), B_TRANSLATE("Ouch!"));
alert->Go(); alert->Go();
PostMessage(B_QUIT_REQUESTED); PostMessage(B_QUIT_REQUESTED);
return; return;
@ -115,14 +120,14 @@ TheApp::AboutRequested()
NULL NULL
}; };
BString extraInfo; BString extraInfo(B_TRANSLATE("%app% is released under the GNU GPL "
extraInfo << "%app% is released under the GNU GPL License." << "\n"; "License.\nSome parts of %app% are available under MIT license.\n"
extraInfo << "Some parts of %app% are available under MIT license." << "\n"; "Built: %buildDate%"));
extraInfo << "Built: " << BUILD_DATE; extraInfo.ReplaceAll("%buildDate", BUILD_DATE);
extraInfo.ReplaceAll("%app%", APP_NAME); extraInfo.ReplaceAll("%app%", B_TRANSLATE_SYSTEM_NAME(APP_NAME));
AboutWindow* about = new AboutWindow(APP_NAME, holders, AboutWindow* about = new AboutWindow(B_TRANSLATE_SYSTEM_NAME(APP_NAME),
authors, extraInfo.String()); holders, authors, extraInfo.String());
about->Show(); about->Show();
delete about; delete about;
} }

View File

@ -7,6 +7,7 @@
#include <memory.h> #include <memory.h>
#include <Bitmap.h> #include <Bitmap.h>
#include <Catalog.h>
#include <InterfaceDefs.h> #include <InterfaceDefs.h>
#include <Directory.h> #include <Directory.h>
#include <FindDirectory.h> #include <FindDirectory.h>
@ -22,22 +23,26 @@
#include "Utils.h" #include "Utils.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "Utils ― Status names"
const char* const char*
UserStatusToString(UserStatus status) UserStatusToString(UserStatus status)
{ {
switch (status) { switch (status) {
case STATUS_ONLINE: case STATUS_ONLINE:
return "Available"; return B_TRANSLATE("Available");
case STATUS_AWAY: case STATUS_AWAY:
return "Away"; return B_TRANSLATE("Away");
case STATUS_DO_NOT_DISTURB: case STATUS_DO_NOT_DISTURB:
return "Busy"; return B_TRANSLATE("Busy");
case STATUS_CUSTOM_STATUS: case STATUS_CUSTOM_STATUS:
return "Custom Status"; return B_TRANSLATE("Custom Status");
case STATUS_INVISIBLE: case STATUS_INVISIBLE:
return "Invisible"; return B_TRANSLATE("Invisible");
case STATUS_OFFLINE: case STATUS_OFFLINE:
return "Offline"; return B_TRANSLATE("Offline");
default: default:
return NULL; return NULL;
} }

View File

@ -8,6 +8,7 @@
#include <Alert.h> #include <Alert.h>
#include <Button.h> #include <Button.h>
#include <Catalog.h>
#include <ControlLook.h> #include <ControlLook.h>
#include <LayoutBuilder.h> #include <LayoutBuilder.h>
#include <TextControl.h> #include <TextControl.h>
@ -19,6 +20,11 @@
#include "ProtocolSettings.h" #include "ProtocolSettings.h"
#include "TemplateView.h" #include "TemplateView.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "AccountDialog"
const uint32 kCancel = 'canc'; const uint32 kCancel = 'canc';
const uint32 kOK = 'save'; const uint32 kOK = 'save';
@ -32,7 +38,8 @@ AccountDialog::AccountDialog(const char* title, ProtocolSettings* settings,
fAccount(account), fAccount(account),
fTarget(NULL) 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->SetExplicitMinSize(BSize(300, B_SIZE_UNSET));
fAccountName->SetFont(be_bold_font); fAccountName->SetFont(be_bold_font);
@ -46,8 +53,8 @@ AccountDialog::AccountDialog(const char* title, ProtocolSettings* settings,
else else
fSettings->Load(NULL, fTop); fSettings->Load(NULL, fTop);
BButton* cancel = new BButton("Cancel", new BMessage(kCancel)); BButton* cancel = new BButton(B_TRANSLATE("Cancel"), new BMessage(kCancel));
BButton* ok = new BButton("OK", new BMessage(kOK)); BButton* ok = new BButton(B_TRANSLATE("OK"), new BMessage(kOK));
const float spacing = be_control_look->DefaultItemSpacing(); const float spacing = be_control_look->DefaultItemSpacing();
BLayoutBuilder::Group<>(this, B_VERTICAL) BLayoutBuilder::Group<>(this, B_VERTICAL)
@ -88,18 +95,20 @@ AccountDialog::MessageReceived(BMessage* msg)
// Rename account settings // Rename account settings
if (renaming) { if (renaming) {
if (fSettings->Rename(fAccount.String(), fAccountName->Text()) != B_OK) { if (fSettings->Rename(fAccount.String(), fAccountName->Text()) != B_OK) {
BString text("An error is occurred renaming the account "); BString text(B_TRANSLATE("An error is occurred renaming "
text << fAccount << " to " << fAccountName->Text() << "!"; "the account to %name%!"));
BAlert* alert = new BAlert("", text.String(), "OK", NULL, NULL, text.ReplaceAll("%name%", fAccountName->Text());
B_WIDTH_AS_USUAL, B_STOP_ALERT); BAlert* alert = new BAlert("", text.String(),
B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL,
B_STOP_ALERT);
alert->Go(); alert->Go();
return; return;
} }
} }
// Save account settings // Save account settings
BString error = "An error has occured saving the settings.\n" BString error = B_TRANSLATE("An error has occured saving the "
"Check if your disk has enough space."; "settings.\nCheck if your disk has enough space.");
if (fSettings->Save(fAccountName->Text(), fTop, &error) == B_OK) { if (fSettings->Save(fAccountName->Text(), fTop, &error) == B_OK) {
if (fTarget && (adding || renaming)) { if (fTarget && (adding || renaming)) {
@ -116,8 +125,9 @@ AccountDialog::MessageReceived(BMessage* msg)
Close(); Close();
} else { } else {
BAlert* alert = new BAlert("", error.String(), "OK", NULL, NULL, BAlert* alert = new BAlert("", error.String(),
B_WIDTH_AS_USUAL, B_STOP_ALERT); B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL,
B_STOP_ALERT);
alert->Go(); alert->Go();
} }
break; break;

View File

@ -7,6 +7,7 @@
*/ */
#include <Button.h> #include <Button.h>
#include <Catalog.h>
#include <ControlLook.h> #include <ControlLook.h>
#include <LayoutBuilder.h> #include <LayoutBuilder.h>
#include <ListView.h> #include <ListView.h>
@ -28,6 +29,10 @@
#include "TheApp.h" #include "TheApp.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "PreferencesAccounts"
const uint32 kAddAccount = 'adac'; const uint32 kAddAccount = 'adac';
const uint32 kEditAccount = 'edac'; const uint32 kEditAccount = 'edac';
const uint32 kDelAccount = 'dlac'; const uint32 kDelAccount = 'dlac';
@ -74,11 +79,14 @@ PreferencesAccounts::PreferencesAccounts()
fProtosMenu->AddItem(item); fProtosMenu->AddItem(item);
} }
ToolButton* proto = new ToolButton("Add", NULL); ToolButton* proto = new ToolButton(B_TRANSLATE("Add"), NULL);
proto->SetMenu(fProtosMenu); proto->SetMenu(fProtosMenu);
fDelButton = new BButton("Del", new BMessage(kDelAccount)); fDelButton = new BButton(B_TRANSLATE_COMMENT("Del", "Short for 'delete'"),
fEditButton = new BButton("Edit" B_UTF8_ELLIPSIS, new BMessage(kEditAccount)); new BMessage(kDelAccount));
fToggleButton = new BButton("Enable", new BMessage(kToggleAccount)); fEditButton = new BButton(B_TRANSLATE("Edit" B_UTF8_ELLIPSIS),
new BMessage(kEditAccount));
fToggleButton = new BButton(B_TRANSLATE("Enable"),
new BMessage(kToggleAccount));
fDelButton->SetEnabled(false); fDelButton->SetEnabled(false);
fEditButton->SetEnabled(false); fEditButton->SetEnabled(false);
fToggleButton->SetEnabled(false); fToggleButton->SetEnabled(false);
@ -125,11 +133,11 @@ PreferencesAccounts::MessageReceived(BMessage* msg)
AccountListItem* item = (AccountListItem*)fListView->ItemAt(fListView->CurrentSelection()); AccountListItem* item = (AccountListItem*)fListView->ItemAt(fListView->CurrentSelection());
if (_AccountEnabled(item->Account() ) == true) { if (_AccountEnabled(item->Account() ) == true) {
fToggleButton->SetLabel("Disable"); fToggleButton->SetLabel(B_TRANSLATE("Disable"));
fToggleButton->SetEnabled(true); fToggleButton->SetEnabled(true);
} }
else { else {
fToggleButton->SetLabel("Enable"); fToggleButton->SetLabel(B_TRANSLATE("Enable"));
fToggleButton->SetEnabled(false); fToggleButton->SetEnabled(false);
} }
} }
@ -142,8 +150,8 @@ PreferencesAccounts::MessageReceived(BMessage* msg)
ProtocolSettings* settings ProtocolSettings* settings
= reinterpret_cast<ProtocolSettings*>(pointer); = reinterpret_cast<ProtocolSettings*>(pointer);
if (settings) { if (settings) {
AccountDialog* dialog = new AccountDialog("Add account", AccountDialog* dialog = new AccountDialog(
settings); B_TRANSLATE("Add account"), settings);
dialog->SetTarget(this); dialog->SetTarget(this);
dialog->Show(); dialog->Show();
} }
@ -159,8 +167,9 @@ PreferencesAccounts::MessageReceived(BMessage* msg)
AccountListItem* item AccountListItem* item
= dynamic_cast<AccountListItem*>(fListView->ItemAt(selected)); = dynamic_cast<AccountListItem*>(fListView->ItemAt(selected));
AccountDialog* dialog = new AccountDialog("Edit account", AccountDialog* dialog = new AccountDialog(
item->Settings(), item->Account()); B_TRANSLATE("Edit account"), item->Settings(),
item->Account());
dialog->SetTarget(this); dialog->SetTarget(this);
dialog->Show(); dialog->Show();
} }
@ -202,7 +211,7 @@ PreferencesAccounts::MessageReceived(BMessage* msg)
remove->AddInt64("instance", instance); remove->AddInt64("instance", instance);
((TheApp*)be_app)->GetMainWindow()->PostMessage(remove); ((TheApp*)be_app)->GetMainWindow()->PostMessage(remove);
fToggleButton->SetLabel("Enable"); fToggleButton->SetLabel(B_TRANSLATE("Enable"));
fToggleButton->SetEnabled(false); fToggleButton->SetEnabled(false);
break; break;
} }

View File

@ -5,6 +5,7 @@
*/ */
#include <Button.h> #include <Button.h>
#include <Catalog.h>
#include <CheckBox.h> #include <CheckBox.h>
#include <ControlLook.h> #include <ControlLook.h>
#include <Deskbar.h> #include <Deskbar.h>
@ -23,6 +24,11 @@
#include "ReplicantStatusView.h" #include "ReplicantStatusView.h"
#include "TheApp.h" #include "TheApp.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "PreferencesBehavior"
const uint32 kToCurrentWorkspace = 'CBcw'; const uint32 kToCurrentWorkspace = 'CBcw';
const uint32 kRaiseOnMessageReceived = 'FCmr'; const uint32 kRaiseOnMessageReceived = 'FCmr';
const uint32 kRaiseUserIsTyping = 'FCit'; const uint32 kRaiseUserIsTyping = 'FCit';
@ -35,63 +41,69 @@ const uint32 kDisablePrompt = 'DiPr';
PreferencesBehavior::PreferencesBehavior() 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->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fOnIncoming->SetFont(be_bold_font); fOnIncoming->SetFont(be_bold_font);
fHideOffline = new BCheckBox("HideOfflineContacts", fHideOffline = new BCheckBox("HideOfflineContacts",
"Hide offline contacts", B_TRANSLATE("Hide offline contacts"),
new BMessage(kHideOffline)); new BMessage(kHideOffline));
fToCurrentWorkspace = new BCheckBox("ToCurrentWorkspace", fToCurrentWorkspace = new BCheckBox("ToCurrentWorkspace",
"Move window to current workspace", B_TRANSLATE("Move window to current workspace"),
new BMessage(kToCurrentWorkspace)); new BMessage(kToCurrentWorkspace));
fRaiseOnMessageReceived = new BCheckBox("FocusOnMessageReceived", fRaiseOnMessageReceived = new BCheckBox("FocusOnMessageReceived",
"Auto-raise when a message is received", B_TRANSLATE("Auto-raise when a message is received"),
new BMessage(kRaiseOnMessageReceived)); new BMessage(kRaiseOnMessageReceived));
fRaiseUserIsTyping = new BCheckBox("FocusUserIsTyping", fRaiseUserIsTyping = new BCheckBox("FocusUserIsTyping",
"Auto-raise when user is typing", B_TRANSLATE("Auto-raise when user is typing"),
new BMessage(kRaiseUserIsTyping)); new BMessage(kRaiseUserIsTyping));
fPlaySoundOnMessageReceived = new BCheckBox("PlaySoundOnMessageReceived", fPlaySoundOnMessageReceived = new BCheckBox("PlaySoundOnMessageReceived",
"Play sound event", NULL); B_TRANSLATE("Play sound event"), NULL);
fPlaySoundOnMessageReceived->SetEnabled(false); // not implemented fPlaySoundOnMessageReceived->SetEnabled(false); // not implemented
fMarkUnreadWindow = new BCheckBox("MarkUnreadWindow", 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*/ /*fMarkUnreadWindow->SetEnabled(false); implementing it right now*/
fMarkUnreadReplicant = new BCheckBox("MarkUnreadReplicant", fMarkUnreadReplicant = new BCheckBox("MarkUnreadReplicant",
"Mark unread the Deskbar Replicant", NULL); B_TRANSLATE("Mark unread the Deskbar Replicant"), NULL);
fMarkUnreadReplicant->SetEnabled(false); fMarkUnreadReplicant->SetEnabled(false);
// not implemented // not implemented
fNotifications = new BStringView("notifications", fNotifications = new BStringView("notifications",
"Deskbar Notifications (experimental)"); B_TRANSLATE("Deskbar Notifications (experimental)"));
fNotifications->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE)); fNotifications->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fNotifications->SetFont(be_bold_font); fNotifications->SetFont(be_bold_font);
fNotifyProtocols = new BCheckBox("EnableProtocolNotify", fNotifyProtocols = new BCheckBox("EnableProtocolNotify",
"Enable protocol status notifications",new BMessage(kNotifyProtocolsLogin)); B_TRANSLATE("Enable protocol status notifications"),
new BMessage(kNotifyProtocolsLogin));
fNotifyContactStatus = new BCheckBox("EnableContactNotify", fNotifyContactStatus = new BCheckBox("EnableContactNotify",
"Enable contact status notifications",new BMessage(kNotifyContactStatus)); B_TRANSLATE("Enable contact status notifications"),
new BMessage(kNotifyContactStatus));
fNotifyNewMessage = new BCheckBox("EnableMessageNotify", 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->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fGeneral->SetFont(be_bold_font); fGeneral->SetFont(be_bold_font);
fDisableQuitConfirm = new BCheckBox("DisableQuitConfirm", 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(); const float spacing = be_control_look->DefaultItemSpacing();
SetLayout(new BGroupLayout(B_HORIZONTAL, spacing)); SetLayout(new BGroupLayout(B_HORIZONTAL, spacing));

View File

@ -4,6 +4,7 @@
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#include <Catalog.h>
#include <CheckBox.h> #include <CheckBox.h>
#include <ControlLook.h> #include <ControlLook.h>
#include <GroupLayout.h> #include <GroupLayout.h>
@ -18,19 +19,25 @@
#include "MainWindow.h" #include "MainWindow.h"
#include "TheApp.h" #include "TheApp.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "PreferencesChatWindow"
const uint32 kIgnoreEmoticons = 'CBhe'; const uint32 kIgnoreEmoticons = 'CBhe';
PreferencesChatWindow::PreferencesChatWindow() 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->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fChatWindowString->SetFont(be_bold_font); fChatWindowString->SetFont(be_bold_font);
fIgnoreEmoticons = new BCheckBox("IgnoreEmoticons", fIgnoreEmoticons = new BCheckBox("IgnoreEmoticons",
"Ignore Emoticons", B_TRANSLATE("Ignore emoticons"),
new BMessage(kIgnoreEmoticons)); new BMessage(kIgnoreEmoticons));
fIgnoreEmoticons->SetEnabled(true); fIgnoreEmoticons->SetEnabled(true);

View File

@ -4,6 +4,7 @@
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#include <Catalog.h>
#include <CheckBox.h> #include <CheckBox.h>
#include <ControlLook.h> #include <ControlLook.h>
#include <Deskbar.h> #include <Deskbar.h>
@ -21,16 +22,21 @@
#include "ReplicantStatusView.h" #include "ReplicantStatusView.h"
#include "TheApp.h" #include "TheApp.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "PreferencesReplicant"
const uint32 kDisableReplicant = 'DSrp'; const uint32 kDisableReplicant = 'DSrp';
const uint32 kPermanentReplicant ='PRpt'; const uint32 kPermanentReplicant ='PRpt';
const uint32 kHideDeskbar = 'HCtk'; const uint32 kHideDeskbar = 'HCtk';
PreferencesReplicant::PreferencesReplicant() PreferencesReplicant::PreferencesReplicant()
: BView("Replicant", B_WILL_DRAW) : BView(B_TRANSLATE("Replicant"), B_WILL_DRAW)
{ {
fReplicantString = new BStringView("ReplicantString", fReplicantString = new BStringView("ReplicantString",
"Deskbar Replicant"); B_TRANSLATE("Deskbar replicant"));
fReplicantString->SetExplicitAlignment( fReplicantString->SetExplicitAlignment(
BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE)); BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
@ -38,17 +44,18 @@ PreferencesReplicant::PreferencesReplicant()
fReplicantString->SetFont(be_bold_font); fReplicantString->SetFont(be_bold_font);
fDisableReplicant = new BCheckBox("DisableReplicant", fDisableReplicant = new BCheckBox("DisableReplicant",
"Disable Deskbar replicant", new BMessage(kDisableReplicant)); B_TRANSLATE("Disable deskbar replicant"),
new BMessage(kDisableReplicant));
if (!AppPreferences::Item()->HideDeskbar) if (!AppPreferences::Item()->HideDeskbar)
Looper()->PostMessage(new BMessage(kDisableReplicant)); Looper()->PostMessage(new BMessage(kDisableReplicant));
fPermanentReplicant = new BCheckBox("PermanentReplicant", fPermanentReplicant = new BCheckBox("PermanentReplicant",
"Permanent Deskbar Replicant", NULL); B_TRANSLATE("Permanent deskbar replicant"), NULL);
fPermanentReplicant->SetEnabled(false); fPermanentReplicant->SetEnabled(false);
fHideDeskbar = new BCheckBox("HideDeskbar", fHideDeskbar = new BCheckBox("HideDeskbar",
"Hide field in Deskbar", new BMessage(kHideDeskbar)); B_TRANSLATE("Hide field in Deskbar"), new BMessage(kHideDeskbar));
fHideDeskbar->SetEnabled(false); fHideDeskbar->SetEnabled(false);
const float spacing = be_control_look->DefaultItemSpacing(); const float spacing = be_control_look->DefaultItemSpacing();

View File

@ -5,6 +5,7 @@
#include "ConversationListView.h" #include "ConversationListView.h"
#include <Catalog.h>
#include <PopUpMenu.h> #include <PopUpMenu.h>
#include <MenuItem.h> #include <MenuItem.h>
#include <Window.h> #include <Window.h>
@ -20,6 +21,10 @@
#include "TheApp.h" #include "TheApp.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "ConversationListView"
const uint32 kOpenSelectedChat = 'CVos'; const uint32 kOpenSelectedChat = 'CVos';
const uint32 kLeaveSelectedChat = 'CVcs'; const uint32 kLeaveSelectedChat = 'CVcs';
@ -200,7 +205,7 @@ ConversationListView::_BlankPopUp()
enabled = true; enabled = true;
BPopUpMenu* menu = new BPopUpMenu("blankPopUp"); 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); new BMessage(APP_NEW_CHAT), 'M', B_COMMAND_KEY);
newChat->SetEnabled(enabled); newChat->SetEnabled(enabled);

View File

@ -5,14 +5,19 @@
#include "InviteDialogue.h" #include "InviteDialogue.h"
#include <Catalog.h>
#include <Messenger.h> #include <Messenger.h>
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "InviteDialogue"
InviteDialogue::InviteDialogue(BMessenger target, const char* title, InviteDialogue::InviteDialogue(BMessenger target, const char* title,
const char* body, BMessage* acceptMsg, BMessage* rejectMsg, BBitmap* icon) const char* body, BMessage* acceptMsg, BMessage* rejectMsg, BBitmap* icon)
: :
BAlert(title, body, "Cancel", "Reject", "Accept", B_WIDTH_AS_USUAL, BAlert(title, body, B_TRANSLATE("Cancel"), B_TRANSLATE("Reject"),
B_OFFSET_SPACING), B_TRANSLATE("Accept"), B_WIDTH_AS_USUAL, B_OFFSET_SPACING),
fMessenger(target), fMessenger(target),
fAcceptMsg(acceptMsg), fAcceptMsg(acceptMsg),
fRejectMsg(rejectMsg) fRejectMsg(rejectMsg)

View File

@ -13,6 +13,7 @@
#include <Application.h> #include <Application.h>
#include <AppFileInfo.h> #include <AppFileInfo.h>
#include <Bitmap.h> #include <Bitmap.h>
#include <Catalog.h>
#include <Deskbar.h> #include <Deskbar.h>
#include <IconUtils.h> #include <IconUtils.h>
#include <Message.h> #include <Message.h>
@ -36,6 +37,10 @@
#include "Utils.h" #include "Utils.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "ReplicantStatusView"
extern "C" _EXPORT BView *instantiate_deskbar_item(void); extern "C" _EXPORT BView *instantiate_deskbar_item(void);
@ -324,10 +329,10 @@ ReplicantStatusView::_BuildMenu()
fReplicantMenu->AddItem(new BSeparatorItem()); fReplicantMenu->AddItem(new BSeparatorItem());
fReplicantMenu->AddItem(new BitmapMenuItem("Preferences ", fReplicantMenu->AddItem(new BitmapMenuItem(B_TRANSLATE("Preferences "),
new BMessage(APP_SHOW_SETTINGS), fPreferencesIcon)); new BMessage(APP_SHOW_SETTINGS), fPreferencesIcon));
fReplicantMenu->AddItem(new BitmapMenuItem("Exit", fReplicantMenu->AddItem(new BitmapMenuItem(B_TRANSLATE("Exit"),
new BMessage(APP_REPLICANT_EXIT), fExitMenuIcon)); new BMessage(APP_REPLICANT_EXIT), fExitMenuIcon));
fReplicantMenu->SetTargetForItems(this); fReplicantMenu->SetTargetForItems(this);

View File

@ -8,14 +8,15 @@
#include "RosterListView.h" #include "RosterListView.h"
#include <string.h>
#include <stdio.h>
#include <Catalog.h>
#include <Looper.h> #include <Looper.h>
#include <MenuItem.h> #include <MenuItem.h>
#include <PopUpMenu.h> #include <PopUpMenu.h>
#include <SeparatorItem.h> #include <SeparatorItem.h>
#include <string.h>
#include <stdio.h>
#include "ChatProtocolMessages.h" #include "ChatProtocolMessages.h"
#include "Contact.h" #include "Contact.h"
#include "ProtocolLooper.h" #include "ProtocolLooper.h"
@ -23,6 +24,11 @@
#include "TheApp.h" #include "TheApp.h"
#include "UserInfoWindow.h" #include "UserInfoWindow.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "RosterListView"
const int32 kAddPeople = 'ADPL'; const int32 kAddPeople = 'ADPL';
const int32 kSendFile = 'SDFL'; const int32 kSendFile = 'SDFL';
const int32 kShowLogs = 'SHLG'; const int32 kShowLogs = 'SHLG';
@ -65,14 +71,16 @@ RosterListView::RosterListView(const char* name)
fPopUp = new BPopUpMenu("contextMenu", false, false); fPopUp = new BPopUpMenu("contextMenu", false, false);
BMenuItem* item = NULL; BMenuItem* item = NULL;
fPopUp->AddItem(new BMenuItem("Start a chat", new BMessage(kStartConv))); fPopUp->AddItem(new BMenuItem(B_TRANSLATE("Start a chat"),
item = new BMenuItem("Send a file" B_UTF8_ELLIPSIS, new BMessage(kSendFile)); new BMessage(kStartConv)));
item = new BMenuItem(B_TRANSLATE("Send a file" B_UTF8_ELLIPSIS),
new BMessage(kSendFile));
item->SetEnabled(false); item->SetEnabled(false);
fPopUp->AddItem(item); fPopUp->AddItem(item);
fPopUp->AddItem(new BSeparatorItem()); 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))); new BMessage(kGetInfo)));
fPopUp->SetTargetForItems(this); fPopUp->SetTargetForItems(this);

View File

@ -12,6 +12,7 @@
#include "RosterView.h" #include "RosterView.h"
#include <Catalog.h>
#include <LayoutBuilder.h> #include <LayoutBuilder.h>
#include <Notification.h> #include <Notification.h>
#include <ScrollView.h> #include <ScrollView.h>
@ -24,6 +25,10 @@
#include "RosterListView.h" #include "RosterListView.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "RosterView"
const uint32 kSearchContact = 'RWSC'; const uint32 kSearchContact = 'RWSC';
@ -145,13 +150,15 @@ RosterView::ImMessage(BMessage* msg)
message << rosterItem->GetContact()->GetName(); message << rosterItem->GetContact()->GetName();
if (status == STATUS_ONLINE) if (status == STATUS_ONLINE)
message << " is available!"; message.SetTo("%name% is available!");
else else
message << " is offline!"; message.SetTo("%name% is offline!");
message.ReplaceAll("%name%",
rosterItem->GetContact()->GetName());
BNotification notification(B_INFORMATION_NOTIFICATION); BNotification notification(B_INFORMATION_NOTIFICATION);
notification.SetGroup(BString(APP_NAME)); notification.SetGroup(BString(APP_NAME));
notification.SetTitle(BString("Presence")); notification.SetTitle(BString(B_TRANSLATE("Presence")));
notification.SetIcon(rosterItem->Bitmap()); notification.SetIcon(rosterItem->Bitmap());
notification.SetContent(message); notification.SetContent(message);
notification.Send(); notification.Send();

View File

@ -5,6 +5,7 @@
#include "UserListView.h" #include "UserListView.h"
#include <Catalog.h>
#include <PopUpMenu.h> #include <PopUpMenu.h>
#include <MenuItem.h> #include <MenuItem.h>
#include <Window.h> #include <Window.h>
@ -22,6 +23,9 @@
#include "UserItem.h" #include "UserItem.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "UserListView"
UserListView::UserListView(const char* name) UserListView::UserListView(const char* name)
: BListView(name), : BListView(name),
@ -79,8 +83,8 @@ UserListView::_BlankPopUp()
{ {
BPopUpMenu* menu = new BPopUpMenu("blankPopUp"); BPopUpMenu* menu = new BPopUpMenu("blankPopUp");
BMenuItem* invite = new BMenuItem("Invite user" B_UTF8_ELLIPSIS, BMenuItem* invite = new BMenuItem(B_TRANSLATE("Invite user"
new BMessage(APP_SEND_INVITE), 'I', B_COMMAND_KEY); B_UTF8_ELLIPSIS), new BMessage(APP_SEND_INVITE), 'I', B_COMMAND_KEY);
if (fChat == NULL) if (fChat == NULL)
invite->SetEnabled(false); invite->SetEnabled(false);

View File

@ -9,6 +9,7 @@
*/ */
#include <Alert.h> #include <Alert.h>
#include <Catalog.h>
#include <Font.h> #include <Font.h>
#include <String.h> #include <String.h>
#include <TextView.h> #include <TextView.h>
@ -16,6 +17,10 @@
#include "AboutWindow.h" #include "AboutWindow.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "About window"
AboutWindow::AboutWindow(const char* appName, const char** holders, AboutWindow::AboutWindow(const char* appName, const char** holders,
const char** authors, const char* extraInfo) const char** authors, const char* extraInfo)
{ {
@ -26,11 +31,13 @@ AboutWindow::AboutWindow(const char* appName, const char** holders,
BString text(appName); BString text(appName);
text << "\n\n"; text << "\n\n";
for (i = 0; holders[i]; i++) for (i = 0; holders[i]; i++)
text << "Copyright " B_UTF8_COPYRIGHT " " << holders[i] << "\n"; text << B_TRANSLATE("Copyright " B_UTF8_COPYRIGHT " ") << holders[i]
text << "\nWritten by:\n"; << "\n";
for (int32 i = 0; authors[i]; i++)
text << B_TRANSLATE("\nWritten by:\n");
for (int32 i = 0; authors[i]; i++) {
text << " " << authors[i] << "\n"; text << " " << authors[i] << "\n";
}
// The extra information is optional // The extra information is optional
if (extraInfo != NULL) if (extraInfo != NULL)
text << "\n" << extraInfo << "\n"; text << "\n" << extraInfo << "\n";
@ -49,7 +56,8 @@ AboutWindow::~AboutWindow()
void void
AboutWindow::Show() 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(); BTextView* view = alert->TextView();
BFont font; BFont font;
view->SetStylable(true); view->SetStylable(true);

View File

@ -12,6 +12,7 @@
#include <Application.h> #include <Application.h>
#include <Alert.h> #include <Alert.h>
#include <Catalog.h>
#include <LayoutBuilder.h> #include <LayoutBuilder.h>
#include <MenuBar.h> #include <MenuBar.h>
#include <ScrollView.h> #include <ScrollView.h>
@ -36,12 +37,17 @@
#include "TemplateWindow.h" #include "TemplateWindow.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "MainWindow"
const uint32 kLogin = 'LOGI'; const uint32 kLogin = 'LOGI';
MainWindow::MainWindow() 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), fWorkspaceChanged(false),
fConversation(NULL), fConversation(NULL),
fRosterWindow(NULL), fRosterWindow(NULL),
@ -76,9 +82,10 @@ MainWindow::QuitRequested()
int32 button_index = 0; int32 button_index = 0;
if(!AppPreferences::Item()->DisableQuitConfirm) if(!AppPreferences::Item()->DisableQuitConfirm)
{ {
BAlert* alert = new BAlert("Closing", "Are you sure you want to quit?", BAlert* alert = new BAlert(B_TRANSLATE("Closing"),
"Yes", "No", NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_TRANSLATE("Are you sure you want to quit?"),
B_WARNING_ALERT); B_TRANSLATE("Yes"), B_TRANSLATE("No"), NULL, B_WIDTH_AS_USUAL,
B_OFFSET_SPACING, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE); alert->SetShortcut(0, B_ESCAPE);
button_index = alert->Go(); button_index = alert->Go();
} }
@ -109,8 +116,8 @@ MainWindow::MessageReceived(BMessage* message)
BMessage* newMsg = new BMessage(IM_MESSAGE); BMessage* newMsg = new BMessage(IM_MESSAGE);
newMsg->AddInt32("im_what", IM_CREATE_CHAT); newMsg->AddInt32("im_what", IM_CREATE_CHAT);
fRosterWindow = new RosterWindow("Invite contact to chat" fRosterWindow = new RosterWindow(B_TRANSLATE("Invite contact to "
B_UTF8_ELLIPSIS, newMsg, new BMessenger(this), fServer); "chat" B_UTF8_ELLIPSIS), newMsg, new BMessenger(this), fServer);
fRosterWindow->Show(); fRosterWindow->Show();
break; break;
} }
@ -119,7 +126,7 @@ MainWindow::MessageReceived(BMessage* message)
BMessage* createMsg = new BMessage(IM_MESSAGE); BMessage* createMsg = new BMessage(IM_MESSAGE);
createMsg->AddInt32("im_what", IM_CREATE_ROOM); 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); "create_room", createMsg, fServer);
win->Show(); win->Show();
break; break;
@ -129,7 +136,7 @@ MainWindow::MessageReceived(BMessage* message)
BMessage* joinMsg = new BMessage(IM_MESSAGE); BMessage* joinMsg = new BMessage(IM_MESSAGE);
joinMsg->AddInt32("im_what", IM_JOIN_ROOM); 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); "join_room", joinMsg, fServer);
win->Show(); win->Show();
break; break;
@ -146,8 +153,8 @@ MainWindow::MessageReceived(BMessage* message)
ProtocolLooper* plooper = fConversation->GetProtocolLooper(); ProtocolLooper* plooper = fConversation->GetProtocolLooper();
BLooper* looper = (BLooper*)plooper; BLooper* looper = (BLooper*)plooper;
fRosterWindow = new RosterWindow("Invite contact to chat" fRosterWindow = new RosterWindow(B_TRANSLATE("Invite contact to "
B_UTF8_ELLIPSIS, invite, new BMessenger(looper), fServer, "chat" B_UTF8_ELLIPSIS), invite, new BMessenger(looper), fServer,
plooper->GetInstance()); plooper->GetInstance());
fRosterWindow->Show(); fRosterWindow->Show();
@ -425,41 +432,41 @@ MainWindow::_CreateMenuBar()
BMenuBar* menuBar = new BMenuBar("MenuBar"); BMenuBar* menuBar = new BMenuBar("MenuBar");
// Program // Program
BMenu* programMenu = new BMenu("Program"); BMenu* programMenu = new BMenu(B_TRANSLATE("Program"));
programMenu->AddItem(new BMenuItem("About" B_UTF8_ELLIPSIS, programMenu->AddItem(new BMenuItem(B_TRANSLATE("About" B_UTF8_ELLIPSIS),
new BMessage(B_ABOUT_REQUESTED))); 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)); new BMessage(APP_SHOW_SETTINGS), ',', B_COMMAND_KEY));
programMenu->AddItem(new BSeparatorItem()); 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)); new BMessage(B_QUIT_REQUESTED), 'Q', B_COMMAND_KEY));
programMenu->SetTargetForItems(this); programMenu->SetTargetForItems(this);
// Chat // Chat
BMenu* chatMenu = new BMenu("Chat"); BMenu* chatMenu = new BMenu(B_TRANSLATE("Chat"));
chatMenu->AddItem(new BMenuItem("Join room" B_UTF8_ELLIPSIS, chatMenu->AddItem(new BMenuItem(B_TRANSLATE("Join room" B_UTF8_ELLIPSIS),
new BMessage(APP_JOIN_ROOM), 'J', B_COMMAND_KEY)); new BMessage(APP_JOIN_ROOM), 'J', B_COMMAND_KEY));
chatMenu->AddSeparatorItem(); 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)); 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)); new BMessage(APP_NEW_CHAT), 'M', B_COMMAND_KEY));
chatMenu->SetTargetForItems(this); chatMenu->SetTargetForItems(this);
// Roster // Roster
BMenu* rosterMenu = new BMenu("Roster"); BMenu* rosterMenu = new BMenu(B_TRANSLATE("Roster"));
rosterMenu->AddItem(new BMenuItem("Edit roster" B_UTF8_ELLIPSIS, rosterMenu->AddItem(new BMenuItem(B_TRANSLATE("Edit roster" B_UTF8_ELLIPSIS),
new BMessage(APP_EDIT_ROSTER), 'R', B_COMMAND_KEY)); new BMessage(APP_EDIT_ROSTER), 'R', B_COMMAND_KEY));
rosterMenu->AddSeparatorItem(); 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)); new BMessage(APP_SEND_INVITE), 'I', B_COMMAND_KEY));
rosterMenu->SetTargetForItems(this); rosterMenu->SetTargetForItems(this);
// Window // Window
BMenu* windowMenu = new BMenu("Window"); BMenu* windowMenu = new BMenu(B_TRANSLATE("Window"));
windowMenu->AddItem(new BMenuItem("Up", windowMenu->AddItem(new BMenuItem(B_TRANSLATE("Up"),
new BMessage(APP_MOVE_UP), B_UP_ARROW, B_COMMAND_KEY)); 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)); new BMessage(APP_MOVE_DOWN), B_DOWN_ARROW, B_COMMAND_KEY));
windowMenu->SetTargetForItems(this); windowMenu->SetTargetForItems(this);
@ -475,7 +482,7 @@ MainWindow::_CreateMenuBar()
void void
MainWindow::_ToggleMenuItems() MainWindow::_ToggleMenuItems()
{ {
BMenuItem* chatMenuItem = fMenuBar->FindItem("Chat"); BMenuItem* chatMenuItem = fMenuBar->FindItem(B_TRANSLATE("Chat"));
BMenu* chatMenu = chatMenuItem->Submenu(); BMenu* chatMenu = chatMenuItem->Submenu();
if (chatMenuItem == NULL || chatMenu == NULL) if (chatMenuItem == NULL || chatMenu == NULL)
return; return;

View File

@ -9,6 +9,7 @@
#include "PreferencesWindow.h" #include "PreferencesWindow.h"
#include <Button.h> #include <Button.h>
#include <Catalog.h>
#include <ControlLook.h> #include <ControlLook.h>
#include <LayoutBuilder.h> #include <LayoutBuilder.h>
#include <TabView.h> #include <TabView.h>
@ -19,12 +20,16 @@
#include "PreferencesReplicant.h" #include "PreferencesReplicant.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "PreferencesWindow"
const uint32 kApply = 'SAVE'; const uint32 kApply = 'SAVE';
PreferencesWindow::PreferencesWindow() PreferencesWindow::PreferencesWindow()
: BWindow(BRect(0, 0, 500, 615), "Preferences", B_TITLED_WINDOW, : BWindow(BRect(0, 0, 500, 615), B_TRANSLATE("Preferences"),
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_CLOSE_ON_ESCAPE) B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_CLOSE_ON_ESCAPE)
{ {
BTabView* tabView = new BTabView("tabView", B_WIDTH_AS_USUAL); BTabView* tabView = new BTabView("tabView", B_WIDTH_AS_USUAL);
tabView->AddTab(new PreferencesAccounts()); tabView->AddTab(new PreferencesAccounts());
@ -32,7 +37,7 @@ PreferencesWindow::PreferencesWindow()
tabView->AddTab(new PreferencesChatWindow()); tabView->AddTab(new PreferencesChatWindow());
tabView->AddTab(new PreferencesReplicant()); 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) BLayoutBuilder::Group<>(this, B_VERTICAL)
.Add(tabView) .Add(tabView)

View File

@ -13,6 +13,7 @@
#include "RosterEditWindow.h" #include "RosterEditWindow.h"
#include <Button.h> #include <Button.h>
#include <Catalog.h>
#include <LayoutBuilder.h> #include <LayoutBuilder.h>
#include <MenuField.h> #include <MenuField.h>
#include <Notification.h> #include <Notification.h>
@ -29,6 +30,10 @@
#include "Utils.h" #include "Utils.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "RosterEditWindow"
const uint32 kSendMessage = 'RWSM'; const uint32 kSendMessage = 'RWSM';
const uint32 kAddMember = 'RWAM'; const uint32 kAddMember = 'RWAM';
const uint32 kRemoveMember = 'RWRM'; const uint32 kRemoveMember = 'RWRM';
@ -41,7 +46,7 @@ RosterEditWindow* RosterEditWindow::fInstance = NULL;
RosterEditWindow::RosterEditWindow(Server* server) 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()), fAccounts(server->GetAccounts()),
fServer(server), fServer(server),
fEditingWindow(NULL) fEditingWindow(NULL)
@ -139,8 +144,8 @@ RosterEditWindow::MessageReceived(BMessage* message)
edit->AddInt32("im_what", IM_CONTACT_LIST_EDIT_CONTACT); edit->AddInt32("im_what", IM_CONTACT_LIST_EDIT_CONTACT);
fEditingWindow = fEditingWindow =
new TemplateWindow("Editing contact", "roster", edit, fServer, new TemplateWindow(B_TRANSLATE("Editing contact"), "roster",
user->GetProtocolLooper()->GetInstance()); edit, fServer, user->GetProtocolLooper()->GetInstance());
fEditingWindow->Show(); fEditingWindow->Show();
break; break;
} }
@ -149,7 +154,8 @@ RosterEditWindow::MessageReceived(BMessage* message)
BMessage* add = new BMessage(IM_MESSAGE); BMessage* add = new BMessage(IM_MESSAGE);
add->AddInt32("im_what", IM_CONTACT_LIST_ADD_CONTACT); add->AddInt32("im_what", IM_CONTACT_LIST_ADD_CONTACT);
TemplateWindow* win = TemplateWindow* win =
new TemplateWindow("Adding contact", "roster", add, fServer); new TemplateWindow(B_TRANSLATE("Adding contact"), "roster",
add, fServer);
win->Show(); win->Show();
break; break;
} }

View File

@ -12,6 +12,7 @@
#include <Alert.h> #include <Alert.h>
#include <Button.h> #include <Button.h>
#include <Catalog.h>
#include <ControlLook.h> #include <ControlLook.h>
#include <LayoutBuilder.h> #include <LayoutBuilder.h>
#include <TextControl.h> #include <TextControl.h>
@ -22,6 +23,10 @@
#include "TemplateView.h" #include "TemplateView.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "TemplateWindow"
const uint32 kOK = 'save'; const uint32 kOK = 'save';
const uint32 kAccSelected = 'JWas'; const uint32 kAccSelected = 'JWas';
@ -83,14 +88,15 @@ TemplateWindow::MessageReceived(BMessage* msg)
// Save account settings // Save account settings
if (fTemplate == NULL || fTemplateView == NULL) if (fTemplate == NULL || fTemplateView == NULL)
break; break;
BString error = "Some items are empty. Please make sure to fill " BString error = B_TRANSLATE("Some items are empty. Please make "
"out every item."; "sure to fill out every item.");
BMessage* settings = new BMessage(*fMessage); BMessage* settings = new BMessage(*fMessage);
status_t result = fTemplate->Save(fTemplateView, settings, &error); status_t result = fTemplate->Save(fTemplateView, settings, &error);
if (result != B_OK) { if (result != B_OK) {
BAlert* alert = new BAlert("", error.String(), "OK", NULL, NULL, BAlert* alert = new BAlert("", error.String(),
B_WIDTH_AS_USUAL, B_WARNING_ALERT); B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL,
B_WARNING_ALERT);
alert->Go(); alert->Go();
break; break;
} }
@ -139,7 +145,7 @@ TemplateWindow::_InitInterface(bigtime_t instance)
fMenuField->SetEnabled(false); 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) if (fAccounts.CountItems() <= 0)
fOkButton->SetEnabled(false); fOkButton->SetEnabled(false);
fOkButton->MakeDefault(true); fOkButton->MakeDefault(true);
@ -152,7 +158,8 @@ TemplateWindow::_InitInterface(bigtime_t instance)
.AddGroup(B_HORIZONTAL) .AddGroup(B_HORIZONTAL)
.Add(fMenuField) .Add(fMenuField)
.AddGlue() .AddGlue()
.Add(new BButton("Cancel", new BMessage(B_QUIT_REQUESTED))) .Add(new BButton(B_TRANSLATE("Cancel"),
new BMessage(B_QUIT_REQUESTED)))
.Add(fOkButton) .Add(fOkButton)
.End() .End()
.End(); .End();

109
locales/en.catkeys Normal file
View File

@ -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