Translate all regions in Time prefs
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42649 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d29d58edea
commit
fefa98aaf8
@ -1,17 +1,27 @@
|
|||||||
1 german x-vnd.Haiku-Time 453699369
|
1 german x-vnd.Haiku-Time 453699369
|
||||||
<Other> Time <Andere>
|
<Other> Time <Andere>
|
||||||
Add Time Hinzu
|
Add Time Hinzu
|
||||||
|
Africa Time Afrika
|
||||||
|
America Time Amerika
|
||||||
|
Antarctica Time Antarktis
|
||||||
|
Arctic Time Arktis
|
||||||
|
Asia Time Asien
|
||||||
|
Atlantic Time Atlantik
|
||||||
|
Australia Time Australien
|
||||||
Could not contact server Time Server konnte nicht erreicht werden
|
Could not contact server Time Server konnte nicht erreicht werden
|
||||||
Could not create socket Time Socket konnte nicht erzeugt werden
|
Could not create socket Time Socket konnte nicht erzeugt werden
|
||||||
Current time: Time Aktuelle Zeit:
|
Current time: Time Aktuelle Zeit:
|
||||||
Date and time Time Datum und Zeit
|
Date and time Time Datum und Zeit
|
||||||
Etc Time Etc
|
Etc Time Etc
|
||||||
|
Europe Time Europa
|
||||||
GMT Time GMT
|
GMT Time GMT
|
||||||
Hardware clock set to: Time Hardware-Uhr gestellt auf:
|
Hardware clock set to: Time Hardware-Uhr gestellt auf:
|
||||||
|
Indian Time Indischer Ozean
|
||||||
Local time Time Lokale Zeit
|
Local time Time Lokale Zeit
|
||||||
Message receiving failed Time Nachricht wurde nicht erhalten
|
Message receiving failed Time Nachricht wurde nicht erhalten
|
||||||
Network time Time Netzwerkzeit
|
Network time Time Netzwerkzeit
|
||||||
OK Time OK
|
OK Time OK
|
||||||
|
Pacific Time Pazifik
|
||||||
Preview time: Time Vorschau-Zeit:
|
Preview time: Time Vorschau-Zeit:
|
||||||
Received invalid time Time Ungültige Zeit erhalten
|
Received invalid time Time Ungültige Zeit erhalten
|
||||||
Remove Time Entfernen
|
Remove Time Entfernen
|
||||||
|
@ -279,14 +279,30 @@ TimeZoneView::_BuildZoneMenu()
|
|||||||
* and add an additional region with generic GMT-offset timezones at the end
|
* and add an additional region with generic GMT-offset timezones at the end
|
||||||
*/
|
*/
|
||||||
typedef std::map<BString, TimeZoneListItem*, TimeZoneItemLess> ZoneItemMap;
|
typedef std::map<BString, TimeZoneListItem*, TimeZoneItemLess> ZoneItemMap;
|
||||||
ZoneItemMap zoneMap;
|
ZoneItemMap zoneItemMap;
|
||||||
const char* kOtherRegion = B_TRANSLATE("<Other>");
|
const char* kOtherRegion = B_TRANSLATE_MARK("<Other>");
|
||||||
const char* kSupportedRegions[] = {
|
const char* kSupportedRegions[] = {
|
||||||
"Africa", "America", "Antarctica", "Arctic", "Asia", "Atlantic",
|
B_TRANSLATE_MARK("Africa"), B_TRANSLATE_MARK("America"),
|
||||||
"Australia", "Europe", "Indian", "Pacific", kOtherRegion, NULL
|
B_TRANSLATE_MARK("Antarctica"), B_TRANSLATE_MARK("Arctic"),
|
||||||
|
B_TRANSLATE_MARK("Asia"), B_TRANSLATE_MARK("Atlantic"),
|
||||||
|
B_TRANSLATE_MARK("Australia"), B_TRANSLATE_MARK("Europe"),
|
||||||
|
B_TRANSLATE_MARK("Indian"), B_TRANSLATE_MARK("Pacific"),
|
||||||
|
kOtherRegion,
|
||||||
|
NULL
|
||||||
};
|
};
|
||||||
for (const char** region = kSupportedRegions; *region != NULL; ++region)
|
// Since the zone-map contains translated country-names (we get those from
|
||||||
zoneMap[*region] = NULL;
|
// ICU), we need to use translated region names in the zone-map, too:
|
||||||
|
typedef std::map<BString, BString> TranslatedRegionMap;
|
||||||
|
TranslatedRegionMap regionMap;
|
||||||
|
for (const char** region = kSupportedRegions; *region != NULL; ++region) {
|
||||||
|
BString translatedRegion = B_TRANSLATE_NOCOLLECT(*region);
|
||||||
|
regionMap[*region] = translatedRegion;
|
||||||
|
|
||||||
|
TimeZoneListItem* regionItem
|
||||||
|
= new TimeZoneListItem(translatedRegion, NULL, NULL);
|
||||||
|
regionItem->SetOutlineLevel(0);
|
||||||
|
zoneItemMap[translatedRegion] = regionItem;
|
||||||
|
}
|
||||||
|
|
||||||
BString countryCode;
|
BString countryCode;
|
||||||
for (int c = 0; countryList.FindString("country", c, &countryCode)
|
for (int c = 0; countryList.FindString("country", c, &countryCode)
|
||||||
@ -324,22 +340,18 @@ TimeZoneView::_BuildZoneMenu()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// just accept timezones from "proper" regions, others are aliases
|
// just accept timezones from our supported regions, others are
|
||||||
ZoneItemMap::iterator regionIter = zoneMap.find(region);
|
// aliases and would just make the list even longer
|
||||||
if (regionIter == zoneMap.end())
|
TranslatedRegionMap::iterator regionIter = regionMap.find(region);
|
||||||
|
if (regionIter == zoneItemMap.end())
|
||||||
continue;
|
continue;
|
||||||
|
const BString& regionName = regionIter->second;
|
||||||
|
|
||||||
BString fullCountryID = region;
|
BString fullCountryID = regionName;
|
||||||
if (countryName != region)
|
bool countryIsRegion = countryName == regionName;
|
||||||
|
if (!countryIsRegion)
|
||||||
fullCountryID << "/" << countryName;
|
fullCountryID << "/" << countryName;
|
||||||
|
|
||||||
TimeZoneListItem* regionItem = regionIter->second;
|
|
||||||
if (regionItem == NULL) {
|
|
||||||
regionItem = new TimeZoneListItem(region, NULL, NULL);
|
|
||||||
regionItem->SetOutlineLevel(0);
|
|
||||||
zoneMap[region] = regionItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
BTimeZone* timeZone = new BTimeZone(zoneID, &language);
|
BTimeZone* timeZone = new BTimeZone(zoneID, &language);
|
||||||
BString tzName = timeZone->Name();
|
BString tzName = timeZone->Name();
|
||||||
if (tzName == "GMT+00:00")
|
if (tzName == "GMT+00:00")
|
||||||
@ -356,8 +368,8 @@ TimeZoneView::_BuildZoneMenu()
|
|||||||
fullZoneID << "/" << tzName;
|
fullZoneID << "/" << tzName;
|
||||||
|
|
||||||
// skip duplicates
|
// skip duplicates
|
||||||
ZoneItemMap::iterator zoneIter = zoneMap.find(fullZoneID);
|
ZoneItemMap::iterator zoneIter = zoneItemMap.find(fullZoneID);
|
||||||
if (zoneIter != zoneMap.end()) {
|
if (zoneIter != zoneItemMap.end()) {
|
||||||
delete timeZone;
|
delete timeZone;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -365,28 +377,32 @@ TimeZoneView::_BuildZoneMenu()
|
|||||||
TimeZoneListItem* countryItem = NULL;
|
TimeZoneListItem* countryItem = NULL;
|
||||||
TimeZoneListItem* zoneItem = NULL;
|
TimeZoneListItem* zoneItem = NULL;
|
||||||
if (count > 1 && countryName.Length() > 0) {
|
if (count > 1 && countryName.Length() > 0) {
|
||||||
ZoneItemMap::iterator countryIter = zoneMap.find(fullCountryID);
|
ZoneItemMap::iterator countryIter
|
||||||
if (countryIter == zoneMap.end()) {
|
= zoneItemMap.find(fullCountryID);
|
||||||
|
if (countryIter == zoneItemMap.end()) {
|
||||||
countryItem = new TimeZoneListItem(countryName, NULL, NULL);
|
countryItem = new TimeZoneListItem(countryName, NULL, NULL);
|
||||||
countryItem->SetOutlineLevel(1);
|
countryItem->SetOutlineLevel(1);
|
||||||
zoneMap[fullCountryID] = countryItem;
|
zoneItemMap[fullCountryID] = countryItem;
|
||||||
} else
|
} else
|
||||||
countryItem = countryIter->second;
|
countryItem = countryIter->second;
|
||||||
|
|
||||||
zoneItem = new TimeZoneListItem(tzName, NULL, timeZone);
|
zoneItem = new TimeZoneListItem(tzName, NULL, timeZone);
|
||||||
zoneItem->SetOutlineLevel(2);
|
zoneItem->SetOutlineLevel(countryIsRegion ? 1 : 2);
|
||||||
} else {
|
} else {
|
||||||
BString& name = countryName.Length() > 0 ? countryName : tzName;
|
BString& name = countryName.Length() > 0 ? countryName : tzName;
|
||||||
zoneItem = new TimeZoneListItem(name, NULL, timeZone);
|
zoneItem = new TimeZoneListItem(name, NULL, timeZone);
|
||||||
zoneItem->SetOutlineLevel(1);
|
zoneItem->SetOutlineLevel(1);
|
||||||
}
|
}
|
||||||
zoneMap[fullZoneID] = zoneItem;
|
zoneItemMap[fullZoneID] = zoneItem;
|
||||||
|
|
||||||
if (timeZone->ID() == defaultTimeZone.ID()) {
|
if (timeZone->ID() == defaultTimeZone.ID()) {
|
||||||
fCurrentZoneItem = zoneItem;
|
fCurrentZoneItem = zoneItem;
|
||||||
if (countryItem != NULL)
|
if (countryItem != NULL)
|
||||||
countryItem->SetExpanded(true);
|
countryItem->SetExpanded(true);
|
||||||
regionItem->SetExpanded(true);
|
ZoneItemMap::iterator regionItemIter
|
||||||
|
= zoneItemMap.find(regionName);
|
||||||
|
if (regionItemIter != zoneItemMap.end())
|
||||||
|
regionItemIter->second->SetExpanded(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -395,8 +411,9 @@ TimeZoneView::_BuildZoneMenu()
|
|||||||
|
|
||||||
ZoneItemMap::iterator zoneIter;
|
ZoneItemMap::iterator zoneIter;
|
||||||
bool lastWasCountryItem = false;
|
bool lastWasCountryItem = false;
|
||||||
TimeZoneListItem* lastCountryItem = NULL;
|
TimeZoneListItem* currentCountryItem = NULL;
|
||||||
for (zoneIter = zoneMap.begin(); zoneIter != zoneMap.end(); ++zoneIter) {
|
for (zoneIter = zoneItemMap.begin(); zoneIter != zoneItemMap.end();
|
||||||
|
++zoneIter) {
|
||||||
if (zoneIter->second->OutlineLevel() == 2 && lastWasCountryItem) {
|
if (zoneIter->second->OutlineLevel() == 2 && lastWasCountryItem) {
|
||||||
/* Some countries (e.g. Spain and Chile) have their timezones
|
/* Some countries (e.g. Spain and Chile) have their timezones
|
||||||
* spread across different regions. As a result, there might still
|
* spread across different regions. As a result, there might still
|
||||||
@ -405,18 +422,19 @@ TimeZoneView::_BuildZoneMenu()
|
|||||||
*/
|
*/
|
||||||
ZoneItemMap::iterator next = zoneIter;
|
ZoneItemMap::iterator next = zoneIter;
|
||||||
++next;
|
++next;
|
||||||
if (next != zoneMap.end() && next->second->OutlineLevel() != 2) {
|
if (next != zoneItemMap.end()
|
||||||
fZoneList->RemoveItem(lastCountryItem);
|
&& next->second->OutlineLevel() != 2) {
|
||||||
zoneIter->second->SetText(lastCountryItem->Text());
|
fZoneList->RemoveItem(currentCountryItem);
|
||||||
|
zoneIter->second->SetText(currentCountryItem->Text());
|
||||||
zoneIter->second->SetOutlineLevel(1);
|
zoneIter->second->SetOutlineLevel(1);
|
||||||
delete lastCountryItem;
|
delete currentCountryItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fZoneList->AddItem(zoneIter->second);
|
fZoneList->AddItem(zoneIter->second);
|
||||||
if (zoneIter->second->OutlineLevel() == 1) {
|
if (zoneIter->second->OutlineLevel() == 1) {
|
||||||
lastWasCountryItem = true;
|
lastWasCountryItem = true;
|
||||||
lastCountryItem = zoneIter->second;
|
currentCountryItem = zoneIter->second;
|
||||||
} else
|
} else
|
||||||
lastWasCountryItem = false;
|
lastWasCountryItem = false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user