Fix missing localization

This addresses some of what's reported in ticket #14637.

* Keymap preferences: Localize key labels. Translators have
  to be careful not too use too long words here...

* Media preferences: Fix typo "SoundFonts" -> "SoundFont"
  The two popup menus, Video input/output, both use "<none>",
  which when the catkeys are collected is reduced to one item.
  Apparently, Italian likes to have different tranlsations for
  them. I hope to fix that by using B_TRANSLATE_COMMENT with
  differing comments. Not sure if that'll work...

* Network preferences: Localize "on/off" and "Enable/Disable"
  in the Services.

* Repositories preferences:
  Add RepoRow.cpp to DoCatalogs.

* Shortcuts preferences: Localize "Left/Right/Both/Either/None"

* Bluetooth replicant: Localize menu items and alerts.

* DeskCalc: Localize button names.

* HaikuDepot:
  - Use BStringFormat and variables to replace for the WorkStatusView.
  - Put package name in single quotes; nicer if you have package names
    with spaces.
  - Avoid leading and trailing spaces in translatable strings. Those
    can be overlooked b the translator.
  - Use B_UTF8_ELLIPSIS instead of "...".

Change-Id: Ia32908f9faad5188aa87c918c31229277decbda9
Reviewed-on: https://review.haiku-os.org/631
Reviewed-by: Jérôme Duval <[email protected]>
This commit is contained in:
Humdinger
2018-10-24 09:01:06 +00:00
committed by Jérôme Duval
parent 85477b7896
commit bc622f6b59
15 changed files with 143 additions and 84 deletions
+24 -22
View File
@@ -78,14 +78,14 @@ static const float kMinimumHeightScientific = 200.0f;
static const float kMaximumHeightScientific = 400.0f; static const float kMaximumHeightScientific = 400.0f;
// basic mode keypad layout (default) // basic mode keypad layout (default)
const char *kKeypadDescriptionBasic = const char *kKeypadDescriptionBasic = B_TRANSLATE_MARK(
"7 8 9 ( ) \n" "7 8 9 ( ) \n"
"4 5 6 * / \n" "4 5 6 * / \n"
"1 2 3 + - \n" "1 2 3 + - \n"
"0 . BS = C \n"; "0 . BS = C \n");
// scientific mode keypad layout // scientific mode keypad layout
const char *kKeypadDescriptionScientific = const char *kKeypadDescriptionScientific = B_TRANSLATE_MARK(
"ln sin cos tan π \n" "ln sin cos tan π \n"
"log asin acos atan sqrt \n" "log asin acos atan sqrt \n"
"exp sinh cosh tanh cbrt \n" "exp sinh cosh tanh cbrt \n"
@@ -93,7 +93,7 @@ const char *kKeypadDescriptionScientific =
"7 8 9 ( ) \n" "7 8 9 ( ) \n"
"4 5 6 * / \n" "4 5 6 * / \n"
"1 2 3 + - \n" "1 2 3 + - \n"
"0 . BS = C \n"; "0 . BS = C \n");
enum { enum {
@@ -1214,28 +1214,30 @@ CalcView::_PressKey(int key)
assert(key < (fRows * fColumns)); assert(key < (fRows * fColumns));
assert(key >= 0); assert(key >= 0);
if (strcmp(fKeypad[key].label, "BS") == 0) { if (strcmp(fKeypad[key].label, B_TRANSLATE_COMMENT("BS",
"Key label, 'BS' means backspace")) == 0) {
// BS means backspace // BS means backspace
fExpressionTextView->BackSpace(); fExpressionTextView->BackSpace();
} else if (strcmp(fKeypad[key].label, "C") == 0) { } else if (strcmp(fKeypad[key].label, B_TRANSLATE_COMMENT("C",
"Key label, 'C' means clear")) == 0) {
// C means clear // C means clear
fExpressionTextView->Clear(); fExpressionTextView->Clear();
} else if (strcmp(fKeypad[key].label, "acos") == 0 } else if (strcmp(fKeypad[key].label, B_TRANSLATE("acos")) == 0
|| strcmp(fKeypad[key].label, "asin") == 0 || strcmp(fKeypad[key].label, B_TRANSLATE("asin")) == 0
|| strcmp(fKeypad[key].label, "atan") == 0 || strcmp(fKeypad[key].label, B_TRANSLATE("atan")) == 0
|| strcmp(fKeypad[key].label, "cbrt") == 0 || strcmp(fKeypad[key].label, B_TRANSLATE("cbrt")) == 0
|| strcmp(fKeypad[key].label, "ceil") == 0 || strcmp(fKeypad[key].label, B_TRANSLATE("ceil")) == 0
|| strcmp(fKeypad[key].label, "cos") == 0 || strcmp(fKeypad[key].label, B_TRANSLATE("cos")) == 0
|| strcmp(fKeypad[key].label, "cosh") == 0 || strcmp(fKeypad[key].label, B_TRANSLATE("cosh")) == 0
|| strcmp(fKeypad[key].label, "exp") == 0 || strcmp(fKeypad[key].label, B_TRANSLATE("exp")) == 0
|| strcmp(fKeypad[key].label, "floor") == 0 || strcmp(fKeypad[key].label, B_TRANSLATE("floor")) == 0
|| strcmp(fKeypad[key].label, "log") == 0 || strcmp(fKeypad[key].label, B_TRANSLATE("log")) == 0
|| strcmp(fKeypad[key].label, "ln") == 0 || strcmp(fKeypad[key].label, B_TRANSLATE("ln")) == 0
|| strcmp(fKeypad[key].label, "sin") == 0 || strcmp(fKeypad[key].label, B_TRANSLATE("sin")) == 0
|| strcmp(fKeypad[key].label, "sinh") == 0 || strcmp(fKeypad[key].label, B_TRANSLATE("sinh")) == 0
|| strcmp(fKeypad[key].label, "sqrt") == 0 || strcmp(fKeypad[key].label, B_TRANSLATE("sqrt")) == 0
|| strcmp(fKeypad[key].label, "tan") == 0 || strcmp(fKeypad[key].label, B_TRANSLATE("tan")) == 0
|| strcmp(fKeypad[key].label, "tanh") == 0) { || strcmp(fKeypad[key].label, B_TRANSLATE("tanh")) == 0) {
int32 labelLen = strlen(fKeypad[key].label); int32 labelLen = strlen(fKeypad[key].label);
int32 startSelection = 0; int32 startSelection = 0;
int32 endSelection = 0; int32 endSelection = 0;
+2 -2
View File
@@ -1250,7 +1250,7 @@ MainWindow::_StartRefreshWorker(bool force)
if (parameters == NULL) if (parameters == NULL)
return; return;
fWorkStatusView->SetBusy(B_TRANSLATE("Refreshing...")); fWorkStatusView->SetBusy(B_TRANSLATE("Refreshing" B_UTF8_ELLIPSIS));
ObjectDeleter<RefreshWorkerParameters> deleter(parameters); ObjectDeleter<RefreshWorkerParameters> deleter(parameters);
fModelWorker = spawn_thread(&_RefreshModelThreadWorker, "model loader", fModelWorker = spawn_thread(&_RefreshModelThreadWorker, "model loader",
@@ -1304,7 +1304,7 @@ MainWindow::_PackageActionWorker(void* arg)
BMessenger messenger(window); BMessenger messenger(window);
BMessage busyMessage(MSG_PACKAGE_WORKER_BUSY); BMessage busyMessage(MSG_PACKAGE_WORKER_BUSY);
BString text(ref->Label()); BString text(ref->Label());
text << "..."; text << B_UTF8_ELLIPSIS;
busyMessage.AddString("reason", text); busyMessage.AddString("reason", text);
messenger.SendMessage(&busyMessage); messenger.SendMessage(&busyMessage);
+3 -2
View File
@@ -678,8 +678,9 @@ UserLoginWindow::_CreateAccountThread()
} else if (message == "validationerror") { } else if (message == "validationerror") {
_CollectValidationFailures(result, error); _CollectValidationFailures(result, error);
} else { } else {
error << B_TRANSLATE(" It responded with: "); BString response = B_TRANSLATE("It responded with: %message%");
error << message; response.ReplaceFirst("%message%", message);
error << " " << response;
} }
} }
} }
+14 -11
View File
@@ -11,6 +11,7 @@
#include <LayoutBuilder.h> #include <LayoutBuilder.h>
#include <SeparatorView.h> #include <SeparatorView.h>
#include <StatusBar.h> #include <StatusBar.h>
#include <StringFormat.h>
#include <StringView.h> #include <StringView.h>
#include <stdio.h> #include <stdio.h>
@@ -144,12 +145,11 @@ void
WorkStatusView::_SetTextPendingDownloads() WorkStatusView::_SetTextPendingDownloads()
{ {
BString text; BString text;
const size_t pendingCount = fPendingPackages.size(); static BStringFormat format(B_TRANSLATE("{0, plural,"
text << pendingCount; "one{1 package to download}"
if (pendingCount > 1) "other{# packages to download}}"));
text << B_TRANSLATE(" packages to download"); format.Format(text, fPendingPackages.size());
else
text << B_TRANSLATE(" package to download");
SetText(text); SetText(text);
} }
@@ -157,12 +157,15 @@ WorkStatusView::_SetTextPendingDownloads()
void void
WorkStatusView::_SetTextDownloading(const BString& title) WorkStatusView::_SetTextDownloading(const BString& title)
{ {
BString text(B_TRANSLATE("Downloading package ")); BString text(B_TRANSLATE("Downloading package '%name%'"));
text << title; text.ReplaceFirst("%name%", title);
if (!fPendingPackages.empty()) { if (!fPendingPackages.empty()) {
text << " ("; BString count;
text << fPendingPackages.size(); cout << fPendingPackages.size();
text << B_TRANSLATE(" more to download)"); BString more(B_TRANSLATE("(%count% more to download)"));
more.ReplaceFirst("%count%", count);
text += more;
} }
SetText(text); SetText(text);
} }
+6
View File
@@ -103,3 +103,9 @@ for architectureObject in [ MultiArchSubDirSetup ] {
; ;
} }
} }
DoCatalogs libbe.so
: x-vnd.Haiku-libmedia
:
MediaDefs.cpp
;
+47 -26
View File
@@ -934,26 +934,41 @@ const char*
KeyboardLayoutView::_SpecialKeyLabel(const key_map& map, uint32 code, KeyboardLayoutView::_SpecialKeyLabel(const key_map& map, uint32 code,
bool abbreviated) bool abbreviated)
{ {
if (code == map.caps_key) if (code == map.caps_key) {
return abbreviated ? "CAPS" : "CAPS LOCK"; return abbreviated
? B_TRANSLATE_COMMENT("CAPS", "Very short for 'caps lock'")
: B_TRANSLATE("CAPS LOCK");
}
if (code == map.scroll_key) if (code == map.scroll_key)
return "SCROLL"; return B_TRANSLATE("SCROLL");
if (code == map.num_key) if (code == map.num_key) {
return abbreviated ? "NUM" : "NUM LOCK"; return abbreviated
? B_TRANSLATE_COMMENT("NUM", "Very short for 'num lock'")
: B_TRANSLATE("NUM LOCK");
}
if (code == map.left_shift_key || code == map.right_shift_key) if (code == map.left_shift_key || code == map.right_shift_key)
return "SHIFT"; return B_TRANSLATE("SHIFT");
if (code == map.left_command_key || code == map.right_command_key) if (code == map.left_command_key || code == map.right_command_key) {
return abbreviated ? "CMD" : "COMMAND"; return abbreviated
if (code == map.left_control_key || code == map.right_control_key) ? B_TRANSLATE_COMMENT("CMD", "Very short for 'command'")
return abbreviated ? "CTRL" : "CONTROL"; : B_TRANSLATE("COMMAND");
if (code == map.left_option_key || code == map.right_option_key) }
return abbreviated ? "OPT" : "OPTION"; if (code == map.left_control_key || code == map.right_control_key) {
return abbreviated
? B_TRANSLATE_COMMENT("CTRL", "Very short for 'control'")
: B_TRANSLATE("CONTROL");
}
if (code == map.left_option_key || code == map.right_option_key) {
return abbreviated
? B_TRANSLATE_COMMENT("OPT", "Very short for 'option'")
: B_TRANSLATE("OPTION");
}
if (code == map.menu_key) if (code == map.menu_key)
return "MENU"; return B_TRANSLATE("MENU");
if (code == B_PRINT_KEY) if (code == B_PRINT_KEY)
return "PRINT"; return B_TRANSLATE("PRINT");
if (code == B_PAUSE_KEY) if (code == B_PAUSE_KEY)
return "PAUSE"; return B_TRANSLATE("PAUSE");
return NULL; return NULL;
} }
@@ -991,22 +1006,28 @@ KeyboardLayoutView::_SpecialMappedKeyLabel(const char* bytes, size_t numBytes,
{ {
if (numBytes != 1) if (numBytes != 1)
return NULL; return NULL;
if (bytes[0] == B_ESCAPE) if (bytes[0] == B_ESCAPE)
return "ESC"; return B_TRANSLATE("ESC");
if (bytes[0] == B_INSERT) if (bytes[0] == B_INSERT)
return "INS"; return B_TRANSLATE("INS");
if (bytes[0] == B_DELETE) if (bytes[0] == B_DELETE)
return "DEL"; return B_TRANSLATE("DEL");
if (bytes[0] == B_HOME) if (bytes[0] == B_HOME)
return "HOME"; return B_TRANSLATE("HOME");
if (bytes[0] == B_END) if (bytes[0] == B_END)
return "END"; return B_TRANSLATE("END");
if (bytes[0] == B_PAGE_UP) if (bytes[0] == B_PAGE_UP) {
return abbreviated ? "PG \xe2\x86\x91" : "PAGE \xe2\x86\x91"; return abbreviated
if (bytes[0] == B_PAGE_DOWN) ? B_TRANSLATE_COMMENT("PG \xe2\x86\x91",
return abbreviated ? "PG \xe2\x86\x93" : "PAGE \xe2\x86\x93"; "Very short for 'page up'")
: B_TRANSLATE("PAGE \xe2\x86\x91");
}
if (bytes[0] == B_PAGE_DOWN) {
return abbreviated
? B_TRANSLATE_COMMENT("PG \xe2\x86\x93",
"Very short for 'page down'")
: B_TRANSLATE("PAGE \xe2\x86\x93");
}
return NULL; return NULL;
} }
+5 -3
View File
@@ -48,11 +48,13 @@ SettingsView::SettingsView()
fOutputMenu(NULL) fOutputMenu(NULL)
{ {
// input menu // input menu
fInputMenu = new BPopUpMenu(B_TRANSLATE("<none>")); fInputMenu = new BPopUpMenu(B_TRANSLATE_ALL("<none>",
"VideoInputMenu", "Used when no video input is available"));
fInputMenu->SetLabelFromMarked(true); fInputMenu->SetLabelFromMarked(true);
// input menu // output menu
fOutputMenu = new BPopUpMenu(B_TRANSLATE("<none>")); fOutputMenu = new BPopUpMenu(B_TRANSLATE_ALL("<none>",
"VideoOutputMenu", "Used when no video output is available"));
fOutputMenu->SetLabelFromMarked(true); fOutputMenu->SetLabelFromMarked(true);
} }
+1 -1
View File
@@ -256,7 +256,7 @@ MidiSettingsView::_UpdateSoundFontStatus()
{ {
if (fListView->IsEmpty()) { if (fListView->IsEmpty()) {
fSoundFontStatus->SetText( fSoundFontStatus->SetText(
B_TRANSLATE("There are no SoundFont installed.")); B_TRANSLATE("There are no SoundFonts installed."));
return; return;
} }
int32 selection = fListView->CurrentSelection(); int32 selection = fListView->CurrentSelection();
+2 -1
View File
@@ -313,7 +313,8 @@ InterfaceView::_Update(bool updateWirelessNetworks)
} }
//fRenegotiateButton->SetEnabled(!disabled); //fRenegotiateButton->SetEnabled(!disabled);
fToggleButton->SetLabel(disabled ? "Enable" : "Disable"); fToggleButton->SetLabel(disabled
? B_TRANSLATE("Enable") : B_TRANSLATE("Disable"));
return B_OK; return B_OK;
} }
+4 -4
View File
@@ -13,14 +13,14 @@
#include <ControlLook.h> #include <ControlLook.h>
static const char* kEnabledState = "on";
static const char* kDisabledState = "off";
#undef B_TRANSLATION_CONTEXT #undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "ServiceListItem" #define B_TRANSLATION_CONTEXT "ServiceListItem"
static const char* kEnabledState = B_TRANSLATE_MARK("on");
static const char* kDisabledState = B_TRANSLATE_MARK("off");
ServiceListItem::ServiceListItem(const char* name, const char* label, ServiceListItem::ServiceListItem(const char* name, const char* label,
const BNetworkSettings& settings) const BNetworkSettings& settings)
: :
+1
View File
@@ -23,6 +23,7 @@ DoCatalogs Repositories :
: :
AddRepoWindow.cpp AddRepoWindow.cpp
constants.h constants.h
RepoRow.cpp
Repositories.cpp Repositories.cpp
RepositoriesView.cpp RepositoriesView.cpp
RepositoriesWindow.cpp RepositoriesWindow.cpp
+7 -1
View File
@@ -9,11 +9,16 @@
#include "RepoRow.h" #include "RepoRow.h"
#include <Catalog.h>
#include <ColumnTypes.h> #include <ColumnTypes.h>
#include "constants.h" #include "constants.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "RepoRow"
RepoRow::RepoRow(const char* repo_name, const char* repo_url, bool enabled) RepoRow::RepoRow(const char* repo_name, const char* repo_url, bool enabled)
: :
BRow(), BRow(),
@@ -53,7 +58,8 @@ RepoRow::RefreshEnabledField()
{ {
BStringField* field = (BStringField*)GetField(kEnabledColumn); BStringField* field = (BStringField*)GetField(kEnabledColumn);
if (fTaskState == STATE_NOT_IN_QUEUE) if (fTaskState == STATE_NOT_IN_QUEUE)
field->SetString(fEnabled ? B_TRANSLATE("Enabled") : ""); field->SetString(fEnabled ? B_TRANSLATE_COMMENT("Enabled",
"Tag in the Status column") : "");
else else
field->SetString(B_UTF8_ELLIPSIS); field->SetString(B_UTF8_ELLIPSIS);
Invalidate(); Invalidate();
+5 -5
View File
@@ -75,20 +75,20 @@ SetupStandardMap(MetaKeyStateMap& map, const char* name, uint32 both,
map.SetInfo(name); map.SetInfo(name);
// In this state, neither key may be pressed. // In this state, neither key may be pressed.
map.AddState("(None)", new HasBitsFieldTester(0, both)); map.AddState(B_TRANSLATE("(None)"), new HasBitsFieldTester(0, both));
// Here, either may be pressed. (Remember both is NOT a 2-bit chord, it's // Here, either may be pressed. (Remember both is NOT a 2-bit chord, it's
// another bit entirely) // another bit entirely)
map.AddState("Either", new HasBitsFieldTester(both)); map.AddState(B_TRANSLATE("Either"), new HasBitsFieldTester(both));
// Here, only the left may be pressed // Here, only the left may be pressed
map.AddState("Left", new HasBitsFieldTester(left, right)); map.AddState(B_TRANSLATE("Left"), new HasBitsFieldTester(left, right));
// Here, only the right may be pressed // Here, only the right may be pressed
map.AddState("Right", new HasBitsFieldTester(right, left)); map.AddState(B_TRANSLATE("Right"), new HasBitsFieldTester(right, left));
// Here, both must be pressed. // Here, both must be pressed.
map.AddState("Both", new HasBitsFieldTester(left | right)); map.AddState(B_TRANSLATE("Both"), new HasBitsFieldTester(left | right));
} }
+15 -5
View File
@@ -12,6 +12,7 @@
#include <Alert.h> #include <Alert.h>
#include <Application.h> #include <Application.h>
#include <Bitmap.h> #include <Bitmap.h>
#include <Catalog.h>
#include <Deskbar.h> #include <Deskbar.h>
#include <IconUtils.h> #include <IconUtils.h>
#include <MenuItem.h> #include <MenuItem.h>
@@ -32,6 +33,11 @@ const uint32 kMsgQuitBluetoothServer = 'qbts';
const char* kDeskbarItemName = "BluetoothServerReplicant"; const char* kDeskbarItemName = "BluetoothServerReplicant";
const char* kClassName = "DeskbarReplicant"; const char* kClassName = "DeskbarReplicant";
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "BluetoothReplicant"
// #pragma mark - // #pragma mark -
@@ -167,12 +173,12 @@ DeskbarReplicant::MouseDown(BPoint where)
BPopUpMenu* menu = new BPopUpMenu(B_EMPTY_STRING, false, false); BPopUpMenu* menu = new BPopUpMenu(B_EMPTY_STRING, false, false);
menu->AddItem(new BMenuItem("Settings" B_UTF8_ELLIPSIS, menu->AddItem(new BMenuItem(B_TRANSLATE("Settings" B_UTF8_ELLIPSIS),
new BMessage(kMsgOpenBluetoothPreferences))); new BMessage(kMsgOpenBluetoothPreferences)));
// TODO show list of known/paired devices // TODO show list of known/paired devices
menu->AddItem(new BMenuItem("Quit", menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"),
new BMessage(kMsgQuitBluetoothServer))); new BMessage(kMsgQuitBluetoothServer)));
menu->SetTargetForItems(this); menu->SetTargetForItems(this);
@@ -194,7 +200,8 @@ DeskbarReplicant::_QuitBluetoothServer()
status_t status = BMessenger(BLUETOOTH_SIGNATURE).SendMessage( status_t status = BMessenger(BLUETOOTH_SIGNATURE).SendMessage(
B_QUIT_REQUESTED); B_QUIT_REQUESTED);
if (status < B_OK) { if (status < B_OK) {
_ShowErrorAlert("Stopping the Bluetooth server failed.", status); _ShowErrorAlert(B_TRANSLATE("Stopping the Bluetooth server failed."),
status);
} }
} }
@@ -202,8 +209,11 @@ DeskbarReplicant::_QuitBluetoothServer()
void void
DeskbarReplicant::_ShowErrorAlert(BString msg, status_t status) DeskbarReplicant::_ShowErrorAlert(BString msg, status_t status)
{ {
msg << "\n\nError: " << strerror(status); BString error = B_TRANSLATE("Error: %status%");
BAlert* alert = new BAlert("Bluetooth error", msg.String(), "OK"); error.ReplaceFirst("%status%", strerror(status));
msg << "\n\n" << error;
BAlert* alert = new BAlert(B_TRANSLATE("Bluetooth error"), msg.String(),
B_TRANSLATE("OK"));
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go(NULL); alert->Go(NULL);
} }
+7 -1
View File
@@ -15,6 +15,12 @@ Server bluetooth_server
HCITransportAccessor.cpp HCITransportAccessor.cpp
LocalDeviceHandler.cpp LocalDeviceHandler.cpp
LocalDeviceImpl.cpp LocalDeviceImpl.cpp
: be network libbluetooth.so : be network libbluetooth.so localestub
[ TargetLibstdc++ ] [ TargetLibstdc++ ]
; ;
DoCatalogs bluetooth_server :
x-vnd.Haiku-bluetooth_server
:
DeskbarReplicant.cpp
;