Patch by Mike Roll as part of GCI: Localize Time preflet.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39935 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues 2010-12-24 09:33:21 +00:00
parent 27d38ee976
commit 825d265efd
4 changed files with 35 additions and 13 deletions

View File

@ -32,3 +32,10 @@ Preference Time
: Time.rdef
;
DoCatalogs Time :
x-vnd.Haiku-Time
:
Time.cpp
TimeWindow.cpp
ZoneView.cpp
;

View File

@ -13,10 +13,12 @@
#include <Alert.h>
#include <Catalog.h>
#include <unistd.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "Time"
const char* kAppSignature = "application/x-vnd.Haiku-Time";
@ -44,9 +46,10 @@ TimeApplication::ReadyToRun()
void
TimeApplication::AboutRequested()
{
BAlert* alert = new BAlert("about",
"Time & Date, writen by:\n\n\tAndrew Edward McCall\n\tMike Berg\n\t"
"Julun\n\tPhilippe Saint-Pierre\n\nCopyright 2004-2008, Haiku.", "OK");
BAlert* alert = new BAlert(B_TRANSLATE("about"),
B_TRANSLATE("Time & Date, writen by:\n\n\tAndrew Edward McCall\n\tMike Berg\n\t"
"Julun\n\tPhilippe Saint-Pierre\n\nCopyright 2004-2008, Haiku."),
B_TRANSLATE("OK"));
alert->Go();
}

View File

@ -17,14 +17,17 @@
#include <Application.h>
#include <Catalog.h>
#include <Message.h>
#include <Screen.h>
#include <TabView.h>
#include <Button.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "Time"
TTimeWindow::TTimeWindow(BRect rect)
: BWindow(rect, "Time", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
: BWindow(rect, B_TRANSLATE("Time"), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
{
_InitWindow();
_AlignWindow();
@ -116,11 +119,11 @@ TTimeWindow::_InitWindow()
BTab* tab = new BTab();
tabView->AddTab(fDateTimeView, tab);
tab->SetLabel("Date & Time");
tab->SetLabel(B_TRANSLATE("Date & Time"));
tab = new BTab();
tabView->AddTab(fTimeZoneView, tab);
tab->SetLabel("Time zone");
tab->SetLabel(B_TRANSLATE("Time zone"));
fBaseView->AddChild(tabView);
tabView->ResizeBy(0.0, tabView->TabHeight());

View File

@ -20,6 +20,7 @@
#include <AutoDeleter.h>
#include <Button.h>
#include <Catalog.h>
#include <Collator.h>
#include <Country.h>
#include <Directory.h>
@ -51,6 +52,10 @@
#include "TimeWindow.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "Time"
using BPrivate::MutableLocaleRoster;
using BPrivate::ObjectDeleter;
@ -194,7 +199,8 @@ TimeZoneView::GetToolTipAt(BPoint point, BToolTip** _tip)
BString toolTip = item->Text();
toolTip << '\n' << item->TimeZone().ShortName() << " / "
<< item->TimeZone().ShortDaylightSavingName()
<< "\nNow: " << nowInTimeZone << " (" << dateInTimeZone << ')';
<< B_TRANSLATE("\nNow: ") << nowInTimeZone
<< " (" << dateInTimeZone << ')';
if (fToolTip != NULL)
fToolTip->ReleaseReference();
@ -251,17 +257,20 @@ TimeZoneView::_InitView()
frameRight.top = frameLeft.top;
// Time Displays
fCurrent = new TTZDisplay(frameRight, "currentTime", "Current time:");
fCurrent = new TTZDisplay(frameRight, "currentTime",
B_TRANSLATE("Current time:"));
AddChild(fCurrent);
fCurrent->ResizeToPreferred();
frameRight.top = fCurrent->Frame().bottom + 10.0;
fPreview = new TTZDisplay(frameRight, "previewTime", "Preview time:");
fPreview = new TTZDisplay(frameRight, "previewTime",
B_TRANSLATE("Preview time:"));
AddChild(fPreview);
fPreview->ResizeToPreferred();
// set button
fSetZone = new BButton(frameRight, "setTimeZone", "Set time zone",
fSetZone = new BButton(frameRight, "setTimeZone",
B_TRANSLATE("Set time zone"),
new BMessage(H_SET_TIME_ZONE));
AddChild(fSetZone);
fSetZone->SetEnabled(false);
@ -291,7 +300,7 @@ TimeZoneView::_BuildZoneMenu()
*/
typedef std::map<BString, TimeZoneListItem*, TimeZoneItemLess> ZoneItemMap;
ZoneItemMap zoneMap;
const char* kOtherRegion = "<Other>";
const char* kOtherRegion = B_TRANSLATE("<Other>");
const char* kSupportedRegions[] = {
"Africa", "America", "Antarctica", "Arctic", "Asia", "Atlantic",
"Australia", "Europe", "Indian", "Pacific", kOtherRegion, NULL
@ -327,7 +336,7 @@ TimeZoneView::_BuildZoneMenu()
BString region(zoneID, slashPos);
if (region == "Etc")
if (region == B_TRANSLATE("Etc"))
region = kOtherRegion;
else if (countryName.Length() == 0) {
// skip global timezones from other regions, we are just