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