Localization of some UI parts:
- context menu of the replicant dragger. Fixes #7363; - default <empty> menu placeholder. Fixes #7072; - other messages used in PrintJob, Dragger and ZombieReplicantView classes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40991 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
89534eeb88
commit
4115645af6
|
@ -89,6 +89,7 @@ private:
|
|||
|
||||
BDragger& operator=(const BDragger& other);
|
||||
|
||||
void _InitData();
|
||||
void _AddToList();
|
||||
void _RemoveFromList();
|
||||
status_t _DetermineRelationship();
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
#include <Alert.h>
|
||||
#include <Beep.h>
|
||||
#include <Bitmap.h>
|
||||
#include <Catalog.h>
|
||||
#include <Dragger.h>
|
||||
#include <LocaleBackend.h>
|
||||
#include <MenuItem.h>
|
||||
#include <Message.h>
|
||||
#include <PopUpMenu.h>
|
||||
|
@ -35,6 +37,15 @@
|
|||
|
||||
#include "ZombieReplicantView.h"
|
||||
|
||||
using BPrivate::gLocaleBackend;
|
||||
using BPrivate::LocaleBackend;
|
||||
|
||||
#undef B_TRANSLATE_CONTEXT
|
||||
#define B_TRANSLATE_CONTEXT "Dragger"
|
||||
|
||||
#undef B_TRANSLATE
|
||||
#define B_TRANSLATE(str) \
|
||||
gLocaleBackend->GetString(B_TRANSLATE_MARK(str), "Dragger")
|
||||
|
||||
const uint32 kMsgDragStarted = 'Drgs';
|
||||
|
||||
|
@ -114,8 +125,7 @@ BDragger::BDragger(BRect bounds, BView *target, uint32 rmask, uint32 flags)
|
|||
fPopUpIsCustom(false),
|
||||
fPopUp(NULL)
|
||||
{
|
||||
fBitmap = new BBitmap(BRect(0.0f, 0.0f, 7.0f, 7.0f), B_CMAP8, false, false);
|
||||
fBitmap->SetBits(kHandBitmap, fBitmap->BitsLength(), 0, B_CMAP8);
|
||||
_InitData();
|
||||
}
|
||||
|
||||
|
||||
|
@ -132,8 +142,7 @@ BDragger::BDragger(BMessage *data)
|
|||
{
|
||||
data->FindInt32("_rel", (int32 *)&fRelation);
|
||||
|
||||
fBitmap = new BBitmap(BRect(0.0f, 0.0f, 7.0f, 7.0f), B_CMAP8, false, false);
|
||||
fBitmap->SetBits(kHandBitmap, fBitmap->BitsLength(), 0, B_CMAP8);
|
||||
_InitData();
|
||||
|
||||
BMessage popupMsg;
|
||||
if (data->FindMessage("_popup", &popupMsg) == B_OK) {
|
||||
|
@ -292,10 +301,10 @@ BDragger::MessageReceived(BMessage *msg)
|
|||
if (fShelf != NULL)
|
||||
Window()->PostMessage(kDeleteReplicant, fTarget, NULL);
|
||||
else {
|
||||
(new BAlert("??",
|
||||
"Can't delete this replicant from its original "
|
||||
"application. Life goes on.",
|
||||
"OK", NULL, NULL, B_WIDTH_FROM_WIDEST,
|
||||
(new BAlert(B_TRANSLATE("Warning"),
|
||||
B_TRANSLATE("Can't delete this replicant from its original "
|
||||
"application. Life goes on."),
|
||||
B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_FROM_WIDEST,
|
||||
B_WARNING_ALERT))->Go(NULL);
|
||||
}
|
||||
break;
|
||||
|
@ -615,6 +624,19 @@ BDragger::_UpdateShowAllDraggers(bool visible)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
BDragger::_InitData()
|
||||
{
|
||||
fBitmap = new BBitmap(BRect(0.0f, 0.0f, 7.0f, 7.0f), B_CMAP8, false, false);
|
||||
fBitmap->SetBits(kHandBitmap, fBitmap->BitsLength(), 0, B_CMAP8);
|
||||
|
||||
// we need to translate some strings, and in order to do so, we need
|
||||
// to use the LocaleBackend to reach liblocale.so
|
||||
if (gLocaleBackend == NULL)
|
||||
LocaleBackend::LoadBackend();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BDragger::_AddToList()
|
||||
{
|
||||
|
@ -722,12 +744,12 @@ BDragger::_BuildDefaultPopUp()
|
|||
if (name)
|
||||
msg->AddString("target", name);
|
||||
|
||||
char about[B_OS_NAME_LENGTH];
|
||||
snprintf(about, B_OS_NAME_LENGTH, "About %s" B_UTF8_ELLIPSIS, name);
|
||||
BString about(B_TRANSLATE("About %app"B_UTF8_ELLIPSIS));
|
||||
about.ReplaceFirst("%app", name);
|
||||
|
||||
fPopUp->AddItem(new BMenuItem(about, msg));
|
||||
fPopUp->AddItem(new BMenuItem(about.String(), msg));
|
||||
fPopUp->AddSeparatorItem();
|
||||
fPopUp->AddItem(new BMenuItem("Remove replicant",
|
||||
fPopUp->AddItem(new BMenuItem(B_TRANSLATE("Remove replicant"),
|
||||
new BMessage(kDeleteReplicant)));
|
||||
}
|
||||
|
||||
|
|
|
@ -17,12 +17,14 @@
|
|||
#include <string.h>
|
||||
|
||||
#include <Bitmap.h>
|
||||
#include <Catalog.h>
|
||||
#include <ControlLook.h>
|
||||
#include <Debug.h>
|
||||
#include <File.h>
|
||||
#include <FindDirectory.h>
|
||||
#include <Layout.h>
|
||||
#include <LayoutUtils.h>
|
||||
#include <LocaleBackend.h>
|
||||
#include <MenuBar.h>
|
||||
#include <MenuItem.h>
|
||||
#include <Messenger.h>
|
||||
|
@ -44,6 +46,17 @@
|
|||
|
||||
#define USE_CACHED_MENUWINDOW 1
|
||||
|
||||
using BPrivate::gLocaleBackend;
|
||||
using BPrivate::LocaleBackend;
|
||||
|
||||
#undef B_TRANSLATE_CONTEXT
|
||||
#define B_TRANSLATE_CONTEXT "Menu"
|
||||
|
||||
#undef B_TRANSLATE
|
||||
#define B_TRANSLATE(str) \
|
||||
gLocaleBackend->GetString(B_TRANSLATE_MARK(str), "Menu")
|
||||
|
||||
|
||||
using std::nothrow;
|
||||
using BPrivate::BMenuWindow;
|
||||
|
||||
|
@ -180,6 +193,7 @@ static property_info sPropList[] = {
|
|||
};
|
||||
|
||||
|
||||
// note: this is redefined to localized one in BMenu::_InitData
|
||||
const char* BPrivate::kEmptyMenuLabel = "<empty>";
|
||||
|
||||
|
||||
|
@ -1396,6 +1410,13 @@ void BMenu::_ReservedMenu6() {}
|
|||
void
|
||||
BMenu::_InitData(BMessage* archive)
|
||||
{
|
||||
// we need to translate some strings, and in order to do so, we need
|
||||
// to use the LocaleBackend to reach liblocale.so
|
||||
if (gLocaleBackend == NULL)
|
||||
LocaleBackend::LoadBackend();
|
||||
|
||||
BPrivate::kEmptyMenuLabel = B_TRANSLATE("<empty>");
|
||||
|
||||
// TODO: Get _color, _fname, _fflt from the message, if present
|
||||
BFont font;
|
||||
font.SetFamilyAndStyle(sMenuInfo.f_family, sMenuInfo.f_style);
|
||||
|
|
|
@ -19,10 +19,12 @@
|
|||
#include <Alert.h>
|
||||
#include <Application.h>
|
||||
#include <Button.h>
|
||||
#include <Catalog.h>
|
||||
#include <Debug.h>
|
||||
#include <Entry.h>
|
||||
#include <File.h>
|
||||
#include <FindDirectory.h>
|
||||
#include <LocaleBackend.h>
|
||||
#include <Messenger.h>
|
||||
#include <NodeInfo.h>
|
||||
#include <OS.h>
|
||||
|
@ -34,6 +36,16 @@
|
|||
#include <pr_server.h>
|
||||
#include <ViewPrivate.h>
|
||||
|
||||
using BPrivate::gLocaleBackend;
|
||||
using BPrivate::LocaleBackend;
|
||||
|
||||
#undef B_TRANSLATE_CONTEXT
|
||||
#define B_TRANSLATE_CONTEXT "PrintJob"
|
||||
|
||||
#undef B_TRANSLATE
|
||||
#define B_TRANSLATE(str) \
|
||||
gLocaleBackend->GetString(B_TRANSLATE_MARK(str), "PrintJob")
|
||||
|
||||
|
||||
/*! Summary of spool file:
|
||||
|
||||
|
@ -92,7 +104,7 @@ struct _page_header_ {
|
|||
static void
|
||||
ShowError(const char* message)
|
||||
{
|
||||
BAlert* alert = new BAlert("Error", message, "OK");
|
||||
BAlert* alert = new BAlert(B_TRANSLATE("Error"), message, B_TRANSLATE("OK"));
|
||||
alert->Go();
|
||||
}
|
||||
|
||||
|
@ -158,6 +170,11 @@ BPrintJob::BPrintJob(const char* jobName)
|
|||
fCurrentPageHeader = new _page_header_;
|
||||
if (fCurrentPageHeader != NULL)
|
||||
memset(fCurrentPageHeader, 0, sizeof(_page_header_));
|
||||
|
||||
// we need to translate some strings, and in order to do so, we need
|
||||
// to use the LocaleBackend to reach liblocale.so
|
||||
if (gLocaleBackend == NULL)
|
||||
LocaleBackend::LoadBackend();
|
||||
}
|
||||
|
||||
|
||||
|
@ -282,7 +299,7 @@ BPrintJob::CommitJob()
|
|||
return;
|
||||
|
||||
if (fSpoolFileHeader.page_count == 0) {
|
||||
ShowError("No Pages to print!");
|
||||
ShowError(B_TRANSLATE("No Pages to print!"));
|
||||
CancelJob();
|
||||
return;
|
||||
}
|
||||
|
@ -843,7 +860,7 @@ PrintServerMessenger::MessengerThread(void* data)
|
|||
|
||||
BMessenger printServer;
|
||||
if (messenger->GetPrintServerMessenger(printServer) != B_OK) {
|
||||
ShowError("Print Server is not responding.");
|
||||
ShowError(B_TRANSLATE("Print Server is not responding."));
|
||||
messenger->SetResult(NULL);
|
||||
return B_ERROR;
|
||||
}
|
||||
|
|
|
@ -7,8 +7,11 @@
|
|||
*/
|
||||
|
||||
#include <Alert.h>
|
||||
#include <Catalog.h>
|
||||
#include <LocaleBackend.h>
|
||||
#include <Message.h>
|
||||
#include <MimeType.h>
|
||||
#include <String.h>
|
||||
|
||||
#include "ZombieReplicantView.h"
|
||||
|
||||
|
@ -17,6 +20,15 @@
|
|||
#include <string.h>
|
||||
#include <new>
|
||||
|
||||
using BPrivate::gLocaleBackend;
|
||||
using BPrivate::LocaleBackend;
|
||||
|
||||
#undef B_TRANSLATE_CONTEXT
|
||||
#define B_TRANSLATE_CONTEXT "ZombieReplicantView"
|
||||
|
||||
#undef B_TRANSLATE
|
||||
#define B_TRANSLATE(str) \
|
||||
gLocaleBackend->GetString(B_TRANSLATE_MARK(str), "ZombieReplicantView")
|
||||
|
||||
|
||||
_BZombieReplicantView_::_BZombieReplicantView_(BRect frame, status_t error)
|
||||
|
@ -28,6 +40,11 @@ _BZombieReplicantView_::_BZombieReplicantView_(BRect frame, status_t error)
|
|||
font.SetSize(9.0f); // TODO
|
||||
SetFont(&font);
|
||||
SetViewColor(kZombieColor);
|
||||
|
||||
// we need to translate some strings, and in order to do so, we need
|
||||
// to use the LocaleBackend to reach liblocale.so
|
||||
if (gLocaleBackend == NULL)
|
||||
LocaleBackend::LoadBackend();
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,23 +60,23 @@ _BZombieReplicantView_::MessageReceived(BMessage* msg)
|
|||
case B_ABOUT_REQUESTED:
|
||||
{
|
||||
const char* addOn = NULL;
|
||||
char error[1024];
|
||||
BString error;
|
||||
if (fArchive->FindString("add_on", &addOn) == B_OK) {
|
||||
char description[B_MIME_TYPE_LENGTH] = "";
|
||||
BMimeType type(addOn);
|
||||
type.GetShortDescription(description);
|
||||
snprintf(error, sizeof(error),
|
||||
"Cannot create the replicant for \"%s\". (%s)",
|
||||
description, strerror(fError));
|
||||
} else {
|
||||
snprintf(error, sizeof(error),
|
||||
"Cannot locate the application for the replicant. "
|
||||
"No application signature supplied. (%s)", strerror(fError));
|
||||
}
|
||||
|
||||
error = B_TRANSLATE("Cannot create the replicant for "
|
||||
"\"%description\".\n%error");
|
||||
error.ReplaceFirst("%description", description);
|
||||
} else
|
||||
error = B_TRANSLATE("Cannot locate the application for the "
|
||||
"replicant. No application signature supplied.\n%error)");
|
||||
|
||||
error.ReplaceFirst("%error", strerror(fError));
|
||||
|
||||
BAlert* alert = new (std::nothrow) BAlert("Error", error, "OK", NULL, NULL,
|
||||
B_WIDTH_AS_USUAL, B_STOP_ALERT);
|
||||
BAlert* alert = new (std::nothrow) BAlert(B_TRANSLATE("Error"),
|
||||
error.String(), B_TRANSLATE("OK"), NULL, NULL,
|
||||
B_WIDTH_AS_USUAL, B_STOP_ALERT);
|
||||
if (alert != NULL)
|
||||
alert->Go();
|
||||
|
||||
|
|
|
@ -68,13 +68,21 @@ SEARCH on [ FGristFiles AboutWindow.cpp ] += [ FDirName $(HAIKU_TOP) src kits sh
|
|||
SEARCH on [ FGristFiles ColorControl.cpp ] += [ FDirName $(HAIKU_TOP) src kits interface ] ;
|
||||
SEARCH on [ FGristFiles StringForSize.cpp ] += [ FDirName $(HAIKU_TOP) src kits shared ] ;
|
||||
SEARCH on [ FGristFiles TextView.cpp ] += [ FDirName $(HAIKU_TOP) src kits interface ] ;
|
||||
|
||||
SEARCH on [ FGristFiles Dragger.cpp ] += [ FDirName $(HAIKU_TOP) src kits interface ] ;
|
||||
SEARCH on [ FGristFiles Menu.cpp ] += [ FDirName $(HAIKU_TOP) src kits interface ] ;
|
||||
SEARCH on [ FGristFiles PrintJob.cpp ] += [ FDirName $(HAIKU_TOP) src kits interface ] ;
|
||||
SEARCH on [ FGristFiles ZombieReplicantView.cpp ] += [ FDirName $(HAIKU_TOP) src kits interface ] ;
|
||||
|
||||
DoCatalogs liblocale.so
|
||||
: system
|
||||
:
|
||||
AboutMenuItem.cpp
|
||||
AboutWindow.cpp
|
||||
ColorControl.cpp
|
||||
Dragger.cpp
|
||||
Menu.cpp
|
||||
PrintJob.cpp
|
||||
StringForSize.cpp
|
||||
TextView.cpp
|
||||
ZombieReplicantView.cpp
|
||||
;
|
||||
|
|
Loading…
Reference in New Issue