Patch by Mike Roll:localize DataTranslations. Thanks!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40030 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
f2758b750b
commit
10e2c9e012
@ -11,6 +11,7 @@
|
||||
#include "DataTranslations.h"
|
||||
|
||||
#include <Alert.h>
|
||||
#include <Catalog.h>
|
||||
#include <Directory.h>
|
||||
#include <FindDirectory.h>
|
||||
#include <String.h>
|
||||
@ -21,6 +22,10 @@
|
||||
#include "DataTranslationsWindow.h"
|
||||
|
||||
|
||||
#undef B_TRANSLATE_CONTEXT
|
||||
#define B_TRANSLATE_CONTEXT "DataTranslations"
|
||||
|
||||
|
||||
const char* kApplicationSignature = "application/x-vnd.Haiku-DataTranslations";
|
||||
|
||||
|
||||
@ -46,9 +51,10 @@ DataTranslationsApplication::SetWindowCorner(const BPoint& leftTop)
|
||||
void
|
||||
DataTranslationsApplication::AboutRequested()
|
||||
{
|
||||
BAlert* alert = new BAlert("about", "DataTranslations\n\twritten by Oliver "
|
||||
"Siebenmarck and others\n\tCopyright 2002-2010, Haiku Inc. All rights "
|
||||
"reserved.\n", "OK");
|
||||
BAlert* alert = new BAlert(B_TRANSLATE("about"),
|
||||
B_TRANSLATE("DataTranslations\n\twritten by Oliver Siebenmarck and"
|
||||
" others\n\tCopyright 2002-2010, Haiku Inc. All rights reserved.\n"),
|
||||
B_TRANSLATE("OK"));
|
||||
|
||||
BTextView* view = alert->TextView();
|
||||
view->SetStylable(true);
|
||||
@ -66,9 +72,10 @@ DataTranslationsApplication::AboutRequested()
|
||||
void
|
||||
DataTranslationsApplication::_InstallError(const char* name, status_t status)
|
||||
{
|
||||
BString text("Could not install ");
|
||||
BString text(B_TRANSLATE("Could not install "));
|
||||
text << name << ":\n" << strerror(status);
|
||||
BAlert* alert = new BAlert("DataTranslations - Error", text.String(), "Ok");
|
||||
BAlert* alert = new BAlert(B_TRANSLATE("DataTranslations - Error"),
|
||||
text.String(), B_TRANSLATE("Ok"));
|
||||
alert->Go();
|
||||
}
|
||||
|
||||
@ -95,10 +102,11 @@ DataTranslationsApplication::_Install(BDirectory& target, BEntry& entry)
|
||||
void
|
||||
DataTranslationsApplication::_NoTranslatorError(const char* name)
|
||||
{
|
||||
BString text("The item '");
|
||||
text << name << "' does not appear to be a Translator and will not be "
|
||||
"installed.";
|
||||
BAlert* alert = new BAlert("", text.String(), "Ok");
|
||||
BString text(B_TRANSLATE("The item '"));
|
||||
text << B_TRANSLATE("%name' does not appear to be a Translator and will"
|
||||
" not be installed.");
|
||||
text.ReplaceAll(%name, name);
|
||||
BAlert* alert = new BAlert("", text.String(), B_TRANSLATE("Ok"));
|
||||
alert->Go();
|
||||
}
|
||||
|
||||
@ -144,12 +152,15 @@ DataTranslationsApplication::RefsReceived(BMessage* message)
|
||||
}
|
||||
|
||||
if (target.Contains(ref.name)) {
|
||||
BString string("An item named '");
|
||||
string << ref.name << "' already exists in the Translators folder! "
|
||||
"Shall the existing translator be overwritten?";
|
||||
BString string(B_TRANSLATE("An item named '"));
|
||||
string << B_TRANSLATE("%ref.name' already exists in the "
|
||||
"Translators folder! Shall the existing translator be "
|
||||
"overwritten?");
|
||||
string.ReplaceAll(%ref.name, ref.name);
|
||||
|
||||
BAlert* alert = new BAlert("DataTranslations - Note", string.String(),
|
||||
"Cancel", "Overwrite");
|
||||
BAlert* alert = new BAlert(B_TRANSLATE("DataTranslations - Note"),
|
||||
string.String(), B_TRANSLATE("Cancel"),
|
||||
B_TRANSLATE("Overwrite"));
|
||||
alert->SetShortcut(0, B_ESCAPE);
|
||||
if (alert->Go() != 1)
|
||||
continue;
|
||||
@ -161,8 +172,9 @@ DataTranslationsApplication::RefsReceived(BMessage* message)
|
||||
|
||||
status = _Install(target, entry);
|
||||
if (status == B_OK) {
|
||||
BAlert* alert = new BAlert("DataTranslations - Note", "The new "
|
||||
"translator has been installed successfully.", "OK");
|
||||
BAlert* alert = new BAlert(B_TRANSLATE("DataTranslations - Note"),
|
||||
B_TRANSLATE("The new translator has been installed "
|
||||
"successfully."), B_TRANSLATE("OK"));
|
||||
alert->Go(NULL);
|
||||
} else
|
||||
_InstallError(ref.name, status);
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <Bitmap.h>
|
||||
#include <Box.h>
|
||||
#include <Button.h>
|
||||
#include <Catalog.h>
|
||||
#include <ControlLook.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <ListView.h>
|
||||
@ -34,15 +35,19 @@
|
||||
#include <TranslatorRoster.h>
|
||||
|
||||
|
||||
#undef B_TRANSLATE_CONTEXT
|
||||
#define B_TRANSLATE_CONTEXT "DataTranslations"
|
||||
|
||||
|
||||
const uint32 kMsgTranslatorInfo = 'trin';
|
||||
const uint32 kMsgSelectedTranslator = 'trsl';
|
||||
|
||||
|
||||
DataTranslationsWindow::DataTranslationsWindow()
|
||||
:
|
||||
BWindow(BRect(0, 0, 550, 350), "DataTranslations", B_TITLED_WINDOW,
|
||||
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE
|
||||
| B_AUTO_UPDATE_SIZE_LIMITS)
|
||||
BWindow(BRect(0, 0, 550, 350), B_TRANSLATE("DataTranslations"),
|
||||
B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
|
||||
| B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS)
|
||||
{
|
||||
MoveTo(static_cast<DataTranslationsApplication *>(be_app)->WindowCorner());
|
||||
|
||||
@ -171,11 +176,11 @@ DataTranslationsWindow::_SetupViews()
|
||||
B_ALIGN_USE_FULL_HEIGHT));
|
||||
|
||||
// Add the translator icon view
|
||||
fIconView = new IconView(BRect(0, 0, 31, 31), "Icon",
|
||||
fIconView = new IconView(BRect(0, 0, 31, 31), B_TRANSLATE("Icon"),
|
||||
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW | B_FRAME_EVENTS);
|
||||
|
||||
// Add the translator info button
|
||||
BButton *button = new BButton("STD", "Info" B_UTF8_ELLIPSIS,
|
||||
BButton *button = new BButton("STD", B_TRANSLATE("Info" B_UTF8_ELLIPSIS),
|
||||
new BMessage(kMsgTranslatorInfo), B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE);
|
||||
|
||||
// Populate the translators list view
|
||||
@ -218,16 +223,18 @@ DataTranslationsWindow::_ShowInfoAlert(int32 id)
|
||||
_GetTranslatorInfo(id, name, info, version, path);
|
||||
|
||||
BString message;
|
||||
message << "Name: " << name << "\nVersion: ";
|
||||
message << B_TRANSLATE("Name: %name \nVersion: ");
|
||||
message.ReplaceAll(%name, name);
|
||||
|
||||
// Convert the version number into a readable format
|
||||
message << (int)B_TRANSLATION_MAJOR_VERSION(version)
|
||||
<< '.' << (int)B_TRANSLATION_MINOR_VERSION(version)
|
||||
<< '.' << (int)B_TRANSLATION_REVISION_VERSION(version);
|
||||
message << "\nInfo: " << info <<
|
||||
"\n\nPath:\n" << path.Path() << "\n";
|
||||
message << B_TRANSLATE("\nInfo: %info\n\nPath:\n") << path.Path() << "\n";
|
||||
message.ReplaceAll(%info, info);
|
||||
|
||||
BAlert* alert = new BAlert("info", message.String(), "OK");
|
||||
BAlert* alert = new BAlert(B_TRANSLATE("info"), message.String(),
|
||||
B_TRANSLATE("OK"));
|
||||
BTextView *view = alert->TextView();
|
||||
BFont font;
|
||||
|
||||
@ -236,7 +243,8 @@ DataTranslationsWindow::_ShowInfoAlert(int32 id)
|
||||
view->GetFont(&font);
|
||||
font.SetFace(B_BOLD_FACE);
|
||||
|
||||
const char* labels[] = {"Name:", "Version:", "Info:", "Path:", NULL};
|
||||
const char* labels[] = {B_TRANSLATE("Name:"), B_TRANSLATE("Version:"),
|
||||
B_TRANSLATE("Info:"), B_TRANSLATE("Path:"), NULL};
|
||||
for (int32 i = 0; labels[i]; i++) {
|
||||
int32 index = message.FindFirst(labels[i]);
|
||||
view->SetFontAndColor(index, index + strlen(labels[i]), &font);
|
||||
@ -256,12 +264,12 @@ DataTranslationsWindow::MessageReceived(BMessage *message)
|
||||
if (selected < 0) {
|
||||
// If no translator is selected, show a message explaining
|
||||
// what the config panel is for
|
||||
(new BAlert("Panel Info",
|
||||
"Translation Settings\n\n"
|
||||
(new BAlert(B_TRANSLATE("Panel Info"),
|
||||
B_TRANSLATE("Translation Settings\n\n"
|
||||
"Use this control panel to set values that various\n"
|
||||
"translators use when no other settings are specified\n"
|
||||
"in the application.",
|
||||
"OK"))->Go();
|
||||
"in the application."),
|
||||
B_TRANSLATE("OK")))->Go();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,13 @@ Preference DataTranslations :
|
||||
IconView.cpp
|
||||
TranslatorListView.cpp
|
||||
|
||||
: be translation $(TARGET_LIBSUPC++)
|
||||
: be translation $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS)
|
||||
: DataTranslations.rdef
|
||||
;
|
||||
|
||||
DoCatalogs DataTranslations :
|
||||
x-vnd.Haiku-DataTranslations
|
||||
:
|
||||
DataTranslations.cpp
|
||||
DataTranslationsWindow.cpp
|
||||
;
|
||||
|
Loading…
Reference in New Issue
Block a user