Patch by Dziadek: localize People.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40024 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues 2010-12-29 10:41:14 +00:00
parent ae0f70fc69
commit 54526b1534
4 changed files with 85 additions and 45 deletions

View File

@ -5,7 +5,14 @@ Application People : main.cpp
PeopleView.cpp
PeopleWindow.cpp
TTextControl.cpp
: libbe.so libtracker.so $(TARGET_LIBSUPC++)
: libbe.so libtracker.so $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS)
: People.rdef
;
DoCatalogs People :
x-vnd.Be-PEPL
:
PeopleApp.cpp
PeopleView.cpp
PeopleWindow.cpp
;

View File

@ -11,15 +11,17 @@
*/
#include <Alert.h>
#include <Bitmap.h>
#include <Catalog.h>
#include <Directory.h>
#include <FindDirectory.h>
#include <fs_index.h>
#include <Locale.h>
#include <Path.h>
#include <Screen.h>
#include <Volume.h>
#include <VolumeRoster.h>
#include <Path.h>
#include <FindDirectory.h>
#include <Screen.h>
#include <Alert.h>
#include <fs_index.h>
#include "PeopleApp.h"
#include "PeopleWindow.h"
@ -28,21 +30,25 @@
#include <string.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "People"
struct people_field gFields[] = {
{ "META:name", 120, "Contact name" },
{ "META:nickname", 120, "Nickname" },
{ "META:company", 120, "Company" },
{ "META:address", 120, "Address" },
{ "META:city", 90, "City" },
{ "META:state", 50, "State" },
{ "META:zip", 50, "Zip" },
{ "META:country", 120, "Country" },
{ "META:hphone", 90, "Home phone" },
{ "META:wphone", 90, "Work phone" },
{ "META:fax", 90, "Fax" },
{ "META:email", 120, "E-mail" },
{ "META:url", 120, "URL" },
{ "META:group", 120, "Group" },
{ "META:name", 120, B_TRANSLATE("Contact name") },
{ "META:nickname", 120, B_TRANSLATE("Nickname") },
{ "META:company", 120, B_TRANSLATE("Company") },
{ "META:address", 120, B_TRANSLATE("Address") },
{ "META:city", 90, B_TRANSLATE("City") },
{ "META:state", 50, B_TRANSLATE("State") },
{ "META:zip", 50, B_TRANSLATE("Zip") },
{ "META:country", 120, B_TRANSLATE("Country") },
{ "META:hphone", 90, B_TRANSLATE("Home phone") },
{ "META:wphone", 90, B_TRANSLATE("Work phone") },
{ "META:fax", 90, B_TRANSLATE("Fax") },
{ "META:email", 120, B_TRANSLATE("E-mail") },
{ "META:url", 120, B_TRANSLATE("URL") },
{ "META:group", 120, B_TRANSLATE("Group") },
{ NULL, 0, NULL }
};
@ -107,8 +113,11 @@ TPeopleApp::TPeopleApp(void)
}
if (!valid) {
mime.Install();
mime.SetShortDescription("Person");
mime.SetLongDescription("Contact information for a person.");
mime.SetShortDescription(B_TRANSLATE_WITH_CONTEXT("Person",
"Short mimetype description"));
mime.SetLongDescription(B_TRANSLATE_WITH_CONTEXT(
"Contact information for a person.",
"Long mimetype description"));
mime.SetIcon(kPersonIcon, sizeof(kPersonIcon));
mime.SetPreferredApp(APP_SIG);
@ -140,7 +149,7 @@ TPeopleApp::~TPeopleApp(void)
void
TPeopleApp::AboutRequested(void)
{
(new BAlert("", "...by Robert Polic", "OK"))->Go();
(new BAlert("", "...by Robert Polic", B_TRANSLATE("OK")))->Go();
}
@ -230,7 +239,7 @@ TPeopleApp::NewWindow(entry_ref *ref)
{
TPeopleWindow *window;
window = new TPeopleWindow(fPosition, "New person", ref);
window = new TPeopleWindow(fPosition, B_TRANSLATE("New person"), ref);
window->Show();
fWindowCount++;
fPosition.OffsetBy(20, 20);

View File

@ -16,10 +16,12 @@
#include <stdlib.h>
#include <string.h>
#include <Catalog.h>
#include <fs_attr.h>
#include <Box.h>
#include <ControlLook.h>
#include <GridLayout.h>
#include <Locale.h>
#include <MenuField.h>
#include <MenuItem.h>
#include <PopUpMenu.h>
@ -30,6 +32,10 @@
#include "TTextControl.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "People"
TPeopleView::TPeopleView(const char* name, entry_ref *ref)
:
BGridView()
@ -58,7 +64,7 @@ TPeopleView::AttachedToWindow(void)
const char *name = gFields[i].name;
if (i == F_NAME)
name = "Name";
name = B_TRANSLATE("Name");
char *text = NULL;
attr_info info;
@ -202,7 +208,9 @@ TPeopleView::BuildGroupMenu(void)
}
if (!count) {
fGroups->AddItem(item = new BMenuItem("none", new BMessage(M_GROUP_MENU)));
fGroups->AddItem(item = new BMenuItem(
B_TRANSLATE_WITH_CONTEXT("none", "Groups list"),
new BMessage(M_GROUP_MENU)));
item->SetEnabled(false);
}
}

View File

@ -16,12 +16,14 @@
#include <string.h>
#include <Alert.h>
#include <Catalog.h>
#include <Clipboard.h>
#include <ControlLook.h>
#include <FilePanel.h>
#include <FindDirectory.h>
#include <Font.h>
#include <LayoutBuilder.h>
#include <Locale.h>
#include <MenuBar.h>
#include <MenuItem.h>
#include <NodeInfo.h>
@ -35,6 +37,10 @@
#include "PeopleView.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "People"
TPeopleWindow::TPeopleWindow(BRect frame, const char *title, entry_ref *ref)
:
BWindow(frame, title, B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE
@ -45,37 +51,46 @@ TPeopleWindow::TPeopleWindow(BRect frame, const char *title, entry_ref *ref)
BMenuItem* item;
BMenuBar* menuBar = new BMenuBar("");
menu = new BMenu("File");
menu->AddItem(item = new BMenuItem("New person" B_UTF8_ELLIPSIS,
menu = new BMenu(B_TRANSLATE("File"));
menu->AddItem(item = new BMenuItem(
B_TRANSLATE("New person" B_UTF8_ELLIPSIS),
new BMessage(M_NEW), 'N'));
item->SetTarget(NULL, be_app);
menu->AddItem(new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED), 'W'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Close"),
new BMessage(B_QUIT_REQUESTED), 'W'));
menu->AddSeparatorItem();
menu->AddItem(fSave = new BMenuItem("Save", new BMessage(M_SAVE), 'S'));
menu->AddItem(fSave = new BMenuItem(B_TRANSLATE("Save"),
new BMessage(M_SAVE), 'S'));
fSave->SetEnabled(FALSE);
menu->AddItem(new BMenuItem("Save as"B_UTF8_ELLIPSIS,
menu->AddItem(new BMenuItem(
B_TRANSLATE("Save as"B_UTF8_ELLIPSIS),
new BMessage(M_SAVE_AS)));
menu->AddItem(fRevert = new BMenuItem("Revert",
menu->AddItem(fRevert = new BMenuItem(B_TRANSLATE("Revert"),
new BMessage(M_REVERT), 'R'));
fRevert->SetEnabled(FALSE);
menu->AddSeparatorItem();
item = new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q');
item = new BMenuItem(B_TRANSLATE("Quit"),
new BMessage(B_QUIT_REQUESTED), 'Q');
item->SetTarget(NULL, be_app);
menu->AddItem(item);
menuBar->AddItem(menu);
menu = new BMenu("Edit");
menu->AddItem(fUndo = new BMenuItem("Undo", new BMessage(B_UNDO), 'Z'));
menu = new BMenu(B_TRANSLATE("Edit"));
menu->AddItem(fUndo = new BMenuItem(B_TRANSLATE("Undo"),
new BMessage(B_UNDO), 'Z'));
fUndo->SetTarget(NULL, this);
fUndo->SetEnabled(false);
menu->AddSeparatorItem();
menu->AddItem(fCut = new BMenuItem("Cut", new BMessage(B_CUT), 'X'));
menu->AddItem(fCut = new BMenuItem(B_TRANSLATE("Cut"),
new BMessage(B_CUT), 'X'));
fCut->SetTarget(NULL, this);
menu->AddItem(fCopy = new BMenuItem("Copy", new BMessage(B_COPY), 'C'));
menu->AddItem(fCopy = new BMenuItem(B_TRANSLATE("Copy"),
new BMessage(B_COPY), 'C'));
fCopy->SetTarget(NULL, this);
menu->AddItem(fPaste = new BMenuItem("Paste", new BMessage(B_PASTE), 'V'));
menu->AddItem(fPaste = new BMenuItem(B_TRANSLATE("Paste"),
new BMessage(B_PASTE), 'V'));
fPaste->SetTarget(NULL, this);
menu->AddItem(item = new BMenuItem("Select all",
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Select all"),
new BMessage(M_SELECT), 'A'));
item->SetTarget(NULL, this);
menuBar->AddItem(menu);
@ -119,9 +134,9 @@ TPeopleWindow::MenusBeginning(void)
fUndo->SetEnabled(state != B_UNDO_UNAVAILABLE);
if (isRedo)
fUndo->SetLabel("Redo");
fUndo->SetLabel(B_TRANSLATE("Redo"));
else
fUndo->SetLabel("Undo");
fUndo->SetLabel(B_TRANSLATE("Undo"));
enabled = fView->TextSelected();
fCut->SetEnabled(enabled);
@ -191,8 +206,8 @@ TPeopleWindow::MessageReceived(BMessage* msg)
fView->NewFile(fRef);
}
else {
sprintf(str, "Could not create %s.", name);
(new BAlert("", str, "Sorry"))->Go();
sprintf(str, B_TRANSLATE("Could not create %s."), name);
(new BAlert("", str, B_TRANSLATE("Sorry")))->Go();
}
}
}
@ -279,8 +294,9 @@ TPeopleWindow::QuitRequested(void)
status_t result;
if (fView->CheckSave()) {
result = (new BAlert("", "Save changes before quitting?",
"Cancel", "Quit", "Save"))->Go();
result = (new BAlert("", B_TRANSLATE("Save changes before quitting?"),
B_TRANSLATE("Cancel"), B_TRANSLATE("Quit"),
B_TRANSLATE("Save")))->Go();
if (result == 2) {
if (fRef)
fView->Save();