From Murai Takashi <tmurai01@xxxxxxxxx>:
Murai Takashi has uploaded this change for review. (
https://review.haiku-os.org/c/haiku/+/2602 ;)
Change subject: SerialConnect: Add localization.
......................................................................
SerialConnect: Add localization.
Add localization for menus, statusbar and system name.
Change-Id: I85ef95c1ff940c6d794f49a859ff1b696b866839
---
M src/apps/serialconnect/Jamfile
M src/apps/serialconnect/SerialConnect.rdef
M src/apps/serialconnect/SerialWindow.cpp
M src/apps/serialconnect/XModem.cpp
4 files changed, 75 insertions(+), 40 deletions(-)
git pull ssh://git.haiku-os.org:22/haiku refs/changes/02/2602/1
diff --git a/src/apps/serialconnect/Jamfile b/src/apps/serialconnect/Jamfile
index 620a5c9..ddeb9c2 100644
--- a/src/apps/serialconnect/Jamfile
+++ b/src/apps/serialconnect/Jamfile
@@ -24,3 +24,10 @@
: SerialConnect.rdef
;
+DoCatalogs SerialConnect :
+ x-vnd.haiku.SerialConnect
+ :
+ CustomRateWindow.cpp
+ SerialWindow.cpp
+ XModem.cpp
+;
diff --git a/src/apps/serialconnect/SerialConnect.rdef
b/src/apps/serialconnect/SerialConnect.rdef
index fe9a822..3d3394b 100644
--- a/src/apps/serialconnect/SerialConnect.rdef
+++ b/src/apps/serialconnect/SerialConnect.rdef
@@ -1,6 +1,8 @@
resource app_signature "application/x-vnd.haiku.SerialConnect";
+resource app_name_catalog_entry "x-vnd.haiku.SerialConnect:System
name:SerialConnect";
+
resource app_version {
major = 0,
middle = 0,
diff --git a/src/apps/serialconnect/SerialWindow.cpp
b/src/apps/serialconnect/SerialWindow.cpp
index e4c3e3e..580e53a 100644
--- a/src/apps/serialconnect/SerialWindow.cpp
+++ b/src/apps/serialconnect/SerialWindow.cpp
@@ -8,6 +8,7 @@
#include <stdio.h>
+#include <Catalog.h>
#include <FilePanel.h>
#include <GroupLayout.h>
#include <Menu.h>
@@ -21,6 +22,8 @@
#include "TermView.h"
+#define B_TRANSLATION_CONTEXT "SerialWindow"
+
const int SerialWindow::kBaudrates[] = { 50, 75, 110, 134, 150, 200, 300, 600,
1200, 1800, 2400, 4800, 9600, 19200, 31250, 38400, 57600, 115200, 230400
};
@@ -35,7 +38,8 @@
};
-const char* SerialWindow::kWindowTitle = "SerialConnect";
+const char* SerialWindow::kWindowTitle =
+ B_TRANSLATE_SYSTEM_NAME("SerialConnect");
SerialWindow::SerialWindow()
@@ -69,7 +73,8 @@
r = fTermView->Frame();
r.top = r.bottom - 37;
- fStatusBar = new BStatusBar(r, "file transfer progress", NULL, NULL);
+ fStatusBar = new BStatusBar(r, B_TRANSLATE("file transfer progress"),
+ NULL, NULL);
fStatusBar->SetResizingMode(B_FOLLOW_BOTTOM | B_FOLLOW_LEFT_RIGHT);
fStatusBar->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fStatusBar->Hide();
@@ -79,10 +84,10 @@
AddChild(scrollBar);
AddChild(fStatusBar);
- fConnectionMenu = new BMenu("Connection");
- fFileMenu = new BMenu("File");
- BMenu* settingsMenu = new BMenu("Settings");
- BMenu* editMenu = new BMenu("Edit");
+ fConnectionMenu = new BMenu(B_TRANSLATE("Connection"));
+ fFileMenu = new BMenu(B_TRANSLATE("File"));
+ BMenu* settingsMenu = new BMenu(B_TRANSLATE("Settings"));
+ BMenu* editMenu = new BMenu(B_TRANSLATE("Edit"));
fConnectionMenu->SetRadioMode(true);
@@ -91,20 +96,21 @@
menuBar->AddItem(fFileMenu);
menuBar->AddItem(settingsMenu);
- BMenuItem* logFile = new BMenuItem("Log to file" B_UTF8_ELLIPSIS,
- new BMessage(kMsgLogfile));
+ BMenuItem* logFile = new BMenuItem(
+ B_TRANSLATE("Log to file" B_UTF8_ELLIPSIS), new
BMessage(kMsgLogfile));
fFileMenu->AddItem(logFile);
// The "send" items are disabled initially. They are enabled only once
we
// are connected to a serial port.
BMessage* sendMsg = new BMessage(kMsgSendFile);
sendMsg->AddString("protocol", "xmodem");
- BMenuItem* xmodemSend = new BMenuItem("XModem send" B_UTF8_ELLIPSIS,
+ BMenuItem* xmodemSend = new BMenuItem(
+ B_TRANSLATE("XModem send" B_UTF8_ELLIPSIS),
sendMsg);
fFileMenu->AddItem(xmodemSend);
xmodemSend->SetEnabled(false);
- BMenuItem* rawSend = new BMenuItem("Raw send" B_UTF8_ELLIPSIS,
+ BMenuItem* rawSend = new BMenuItem(B_TRANSLATE("Raw send"
B_UTF8_ELLIPSIS),
new BMessage(kMsgSendFile));
fFileMenu->AddItem(rawSend);
rawSend->SetEnabled(false);
@@ -118,7 +124,7 @@
#endif
// Items for the edit menu
- BMenuItem* clearScreen = new BMenuItem("Clear history",
+ BMenuItem* clearScreen = new BMenuItem(B_TRANSLATE("Clear history"),
new BMessage(kMsgClear));
editMenu->AddItem(clearScreen);
@@ -126,41 +132,44 @@
// Configuring all this by menus may be a bit unhandy. Make a setting
// window instead ?
- fBaudrateMenu = new BMenu("Baud rate");
+ fBaudrateMenu = new BMenu(B_TRANSLATE("Baud rate"));
fBaudrateMenu->SetRadioMode(true);
settingsMenu->AddItem(fBaudrateMenu);
- fParityMenu = new BMenu("Parity");
+ fParityMenu = new BMenu(B_TRANSLATE("Parity"));
fParityMenu->SetRadioMode(true);
settingsMenu->AddItem(fParityMenu);
- fStopbitsMenu = new BMenu("Stop bits");
+ fStopbitsMenu = new BMenu(B_TRANSLATE("Stop bits"));
fStopbitsMenu->SetRadioMode(true);
settingsMenu->AddItem(fStopbitsMenu);
- fFlowcontrolMenu = new BMenu("Flow control");
+ fFlowcontrolMenu = new BMenu(B_TRANSLATE("Flow control"));
fFlowcontrolMenu->SetRadioMode(true);
settingsMenu->AddItem(fFlowcontrolMenu);
- fDatabitsMenu = new BMenu("Data bits");
+ fDatabitsMenu = new BMenu(B_TRANSLATE("Data bits"));
fDatabitsMenu->SetRadioMode(true);
settingsMenu->AddItem(fDatabitsMenu);
- fLineTerminatorMenu = new BMenu("Line terminator");
+ fLineTerminatorMenu = new BMenu(B_TRANSLATE("Line terminator"));
fLineTerminatorMenu->SetRadioMode(true);
settingsMenu->AddItem(fLineTerminatorMenu);
BMessage* message = new BMessage(kMsgSettings);
message->AddInt32("parity", B_NO_PARITY);
- BMenuItem* parityNone = new BMenuItem("None", message);
+ BMenuItem* parityNone =
+ new BMenuItem(B_TRANSLATE_COMMENT("None", "Parity"), message);
message = new BMessage(kMsgSettings);
message->AddInt32("parity", B_ODD_PARITY);
- BMenuItem* parityOdd = new BMenuItem("Odd", message);
+ BMenuItem* parityOdd = new BMenuItem(B_TRANSLATE_COMMENT("Odd",
"Parity"),
+ message);
message = new BMessage(kMsgSettings);
message->AddInt32("parity", B_EVEN_PARITY);
- BMenuItem* parityEven = new BMenuItem("Even", message);
+ BMenuItem* parityEven =
+ new BMenuItem(B_TRANSLATE_COMMENT("Even", "Parity"), message);
fParityMenu->AddItem(parityNone);
fParityMenu->AddItem(parityOdd);
@@ -169,11 +178,13 @@
message = new BMessage(kMsgSettings);
message->AddInt32("databits", B_DATA_BITS_7);
- BMenuItem* data7 = new BMenuItem("7", message);
+ BMenuItem* data7 =
+ new BMenuItem(B_TRANSLATE_COMMENT("7", "Databits"), message);
message = new BMessage(kMsgSettings);
message->AddInt32("databits", B_DATA_BITS_8);
- BMenuItem* data8 = new BMenuItem("8", message);
+ BMenuItem* data8 =
+ new BMenuItem(B_TRANSLATE_COMMENT("8", "Databits"), message);
fDatabitsMenu->AddItem(data7);
fDatabitsMenu->AddItem(data8);
@@ -181,11 +192,13 @@
message = new BMessage(kMsgSettings);
message->AddInt32("stopbits", B_STOP_BITS_1);
- BMenuItem* stop1 = new BMenuItem("1", message);
+ BMenuItem* stop1 =
+ new BMenuItem(B_TRANSLATE_COMMENT("1", "Stopbits"), message);
message = new BMessage(kMsgSettings);
message->AddInt32("stopbits", B_STOP_BITS_2);
- BMenuItem* stop2 = new BMenuItem("2", message);
+ BMenuItem* stop2 =
+ new BMenuItem(B_TRANSLATE_COMMENT("2", "Stopbits"), message);
fStopbitsMenu->AddItem(stop1);
fStopbitsMenu->AddItem(stop2);
@@ -205,26 +218,30 @@
}
message = new BMessage(kMsgCustomBaudrate);
- BMenuItem* custom = new BMenuItem("custom" B_UTF8_ELLIPSIS, message);
+ BMenuItem* custom = new BMenuItem(B_TRANSLATE("custom"
B_UTF8_ELLIPSIS), message);
fBaudrateMenu->AddItem(custom);
fBaudrateMenu->SetTargetForItems(be_app);
message = new BMessage(kMsgSettings);
message->AddInt32("flowcontrol", B_HARDWARE_CONTROL);
- BMenuItem* hardware = new BMenuItem("Hardware", message);
+ BMenuItem* hardware =
+ new BMenuItem(B_TRANSLATE_COMMENT("Hardware", "Flowcontrol"),
message);
message = new BMessage(kMsgSettings);
message->AddInt32("flowcontrol", B_SOFTWARE_CONTROL);
- BMenuItem* software = new BMenuItem("Software", message);
+ BMenuItem* software =
+ new BMenuItem(B_TRANSLATE_COMMENT("Software", "Flowcontrol"),
message);
message = new BMessage(kMsgSettings);
message->AddInt32("flowcontrol", B_HARDWARE_CONTROL |
B_SOFTWARE_CONTROL);
- BMenuItem* both = new BMenuItem("Both", message);
+ BMenuItem* both =
+ new BMenuItem(B_TRANSLATE_COMMENT("Both", "Flowcontrol"),
message);
message = new BMessage(kMsgSettings);
message->AddInt32("flowcontrol", 0);
- BMenuItem* noFlow = new BMenuItem("None", message);
+ BMenuItem* noFlow =
+ new BMenuItem(B_TRANSLATE_COMMENT("None", "Flowcontrol"),
message);
fFlowcontrolMenu->AddItem(hardware);
fFlowcontrolMenu->AddItem(software);
@@ -234,15 +251,19 @@
message = new BMessage(kMsgSettings);
message->AddString("terminator", "\n");
- BMenuItem* lf = new BMenuItem("LF (\\n)", message);
+ BMenuItem* lf =
+ new BMenuItem(B_TRANSLATE_COMMENT("LF (\\n)", "Terminator"),
message);
message = new BMessage(kMsgSettings);
message->AddString("terminator", "\r");
- BMenuItem* cr = new BMenuItem("CR (\\r)", message);
+ BMenuItem* cr =
+ new BMenuItem(B_TRANSLATE_COMMENT("CR (\\r)", "Terminator"),
message);
message = new BMessage(kMsgSettings);
message->AddString("terminator", "\r\n");
- BMenuItem* crlf = new BMenuItem("CR/LF (\\r\\n)", message);
+ BMenuItem* crlf =
+ new BMenuItem(B_TRANSLATE_COMMENT("CR/LF (\\r\\n)",
"Terminator"),
+ message);
fLineTerminatorMenu->AddItem(lf);
fLineTerminatorMenu->AddItem(cr);
@@ -292,14 +313,14 @@
if (deviceCount > 0) {
fConnectionMenu->AddSeparatorItem();
- BMenuItem* disconnect = new BMenuItem("Disconnect",
+ BMenuItem* disconnect = new BMenuItem(B_TRANSLATE("Disconnect"),
new BMessage(kMsgOpenPort), 'Z', B_OPTION_KEY);
if (!connected)
disconnect->SetEnabled(false);
disconnect->SetTarget(be_app);
fConnectionMenu->AddItem(disconnect);
} else {
- BMenuItem* noDevices = new BMenuItem("<no serial port
available>", NULL);
+ BMenuItem* noDevices = new BMenuItem(B_TRANSLATE("<no serial
port available>"), NULL);
noDevices->SetEnabled(false);
fConnectionMenu->AddItem(noDevices);
}
diff --git a/src/apps/serialconnect/XModem.cpp
b/src/apps/serialconnect/XModem.cpp
index 6628b89..201e3e9 100644
--- a/src/apps/serialconnect/XModem.cpp
+++ b/src/apps/serialconnect/XModem.cpp
@@ -8,12 +8,15 @@
#include "SerialApp.h"
+#include <Catalog.h>
#include <String.h>
#include <stdio.h>
#include <string.h>
+#define B_TRANSLATION_CONTEXT "XModemStatus"
+
// ASCII control characters used in XMODEM protocol
static const char kSOH = 1;
static const char kEOT = 4;
@@ -33,7 +36,7 @@
fEotSent(false),
fUseCRC(false)
{
- fStatus = "Waiting for receiver" B_UTF8_ELLIPSIS;
+ fStatus = B_TRANSLATE("Waiting for receiver" B_UTF8_ELLIPSIS);
BPositionIO* pos = dynamic_cast<BPositionIO*>(source);
if (pos)
@@ -65,7 +68,7 @@
// in place of an 8-bit checksum.
// In any other place, it is ignored.
if (fBlockNumber <= 1) {
- fStatus = "CRC requested";
+ fStatus = B_TRANSLATE("CRC requested");
fUseCRC = true;
SendBlock();
} else
@@ -74,7 +77,7 @@
if (fEotSent) {
fSink->Write(&kEOT, 1);
} else {
- fStatus = "Checksum error, re-send
block";
+ fStatus = B_TRANSLATE("Checksum error,
re-send block");
SendBlock();
}
break;
@@ -85,10 +88,11 @@
}
if (NextBlock() == B_OK) {
- fStatus = "Sending" B_UTF8_ELLIPSIS;
+ fStatus = B_TRANSLATE("Sending"
B_UTF8_ELLIPSIS);
SendBlock();
} else {
- fStatus = "Everything sent, waiting for
acknowledge";
+ fStatus = B_TRANSLATE("Everything sent,
"
+ "waiting for acknowledge");
fSink->Write(&kEOT, 1);
fEotSent = true;
}
@@ -99,7 +103,8 @@
BMessage msg(kMsgProgress);
msg.AddInt32("pos", 0);
msg.AddInt32("size", 0);
- msg.AddString("info", "Remote cancelled
transfer");
+ msg.AddString("info",
+ B_TRANSLATE("Remote cancelled
transfer"));
fListener.SendMessage(&msg);
return true;
}
--
To view, visit https://review.haiku-os.org/c/haiku/+/2602
To unsubscribe, or for help writing mail filters, visit
https://review.haiku-os.org/settings
Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I85ef95c1ff940c6d794f49a859ff1b696b866839
Gerrit-Change-Number: 2602
Gerrit-PatchSet: 1
Gerrit-Owner: Murai Takashi <tmurai01@xxxxxxxxx>
Gerrit-MessageType: newchange