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