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
|
||||
<Other> Time <Andere>
|
||||
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 create socket Time Socket konnte nicht erzeugt werden
|
||||
Current time: Time Aktuelle Zeit:
|
||||
Date and time Time Datum und Zeit
|
||||
Etc Time Etc
|
||||
Europe Time Europa
|
||||
GMT Time GMT
|
||||
Hardware clock set to: Time Hardware-Uhr gestellt auf:
|
||||
Indian Time Indischer Ozean
|
||||
Local time Time Lokale Zeit
|
||||
Message receiving failed Time Nachricht wurde nicht erhalten
|
||||
Network time Time Netzwerkzeit
|
||||
OK Time OK
|
||||
Pacific Time Pazifik
|
||||
Preview time: Time Vorschau-Zeit:
|
||||
Received invalid time Time Ungültige Zeit erhalten
|
||||
Remove Time Entfernen
|
||||
|
@ -279,14 +279,30 @@ TimeZoneView::_BuildZoneMenu()
|
||||
* and add an additional region with generic GMT-offset timezones at the end
|
||||
*/
|
||||
typedef std::map<BString, TimeZoneListItem*, TimeZoneItemLess> ZoneItemMap;
|
||||
ZoneItemMap zoneMap;
|
||||
const char* kOtherRegion = B_TRANSLATE("<Other>");
|
||||
ZoneItemMap zoneItemMap;
|
||||
const char* kOtherRegion = B_TRANSLATE_MARK("<Other>");
|
||||
const char* kSupportedRegions[] = {
|
||||
"Africa", "America", "Antarctica", "Arctic", "Asia", "Atlantic",
|
||||
"Australia", "Europe", "Indian", "Pacific", kOtherRegion, NULL
|
||||
B_TRANSLATE_MARK("Africa"), B_TRANSLATE_MARK("America"),
|
||||
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)
|
||||
zoneMap[*region] = NULL;
|
||||
// Since the zone-map contains translated country-names (we get those from
|
||||
// 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;
|
||||
for (int c = 0; countryList.FindString("country", c, &countryCode)
|
||||
@ -324,22 +340,18 @@ TimeZoneView::_BuildZoneMenu()
|
||||
continue;
|
||||
}
|
||||
|
||||
// just accept timezones from "proper" regions, others are aliases
|
||||
ZoneItemMap::iterator regionIter = zoneMap.find(region);
|
||||
if (regionIter == zoneMap.end())
|
||||
// just accept timezones from our supported regions, others are
|
||||
// aliases and would just make the list even longer
|
||||
TranslatedRegionMap::iterator regionIter = regionMap.find(region);
|
||||
if (regionIter == zoneItemMap.end())
|
||||
continue;
|
||||
const BString& regionName = regionIter->second;
|
||||
|
||||
BString fullCountryID = region;
|
||||
if (countryName != region)
|
||||
BString fullCountryID = regionName;
|
||||
bool countryIsRegion = countryName == regionName;
|
||||
if (!countryIsRegion)
|
||||
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);
|
||||
BString tzName = timeZone->Name();
|
||||
if (tzName == "GMT+00:00")
|
||||
@ -356,8 +368,8 @@ TimeZoneView::_BuildZoneMenu()
|
||||
fullZoneID << "/" << tzName;
|
||||
|
||||
// skip duplicates
|
||||
ZoneItemMap::iterator zoneIter = zoneMap.find(fullZoneID);
|
||||
if (zoneIter != zoneMap.end()) {
|
||||
ZoneItemMap::iterator zoneIter = zoneItemMap.find(fullZoneID);
|
||||
if (zoneIter != zoneItemMap.end()) {
|
||||
delete timeZone;
|
||||
continue;
|
||||
}
|
||||
@ -365,28 +377,32 @@ TimeZoneView::_BuildZoneMenu()
|
||||
TimeZoneListItem* countryItem = NULL;
|
||||
TimeZoneListItem* zoneItem = NULL;
|
||||
if (count > 1 && countryName.Length() > 0) {
|
||||
ZoneItemMap::iterator countryIter = zoneMap.find(fullCountryID);
|
||||
if (countryIter == zoneMap.end()) {
|
||||
ZoneItemMap::iterator countryIter
|
||||
= zoneItemMap.find(fullCountryID);
|
||||
if (countryIter == zoneItemMap.end()) {
|
||||
countryItem = new TimeZoneListItem(countryName, NULL, NULL);
|
||||
countryItem->SetOutlineLevel(1);
|
||||
zoneMap[fullCountryID] = countryItem;
|
||||
zoneItemMap[fullCountryID] = countryItem;
|
||||
} else
|
||||
countryItem = countryIter->second;
|
||||
|
||||
zoneItem = new TimeZoneListItem(tzName, NULL, timeZone);
|
||||
zoneItem->SetOutlineLevel(2);
|
||||
zoneItem->SetOutlineLevel(countryIsRegion ? 1 : 2);
|
||||
} else {
|
||||
BString& name = countryName.Length() > 0 ? countryName : tzName;
|
||||
zoneItem = new TimeZoneListItem(name, NULL, timeZone);
|
||||
zoneItem->SetOutlineLevel(1);
|
||||
}
|
||||
zoneMap[fullZoneID] = zoneItem;
|
||||
zoneItemMap[fullZoneID] = zoneItem;
|
||||
|
||||
if (timeZone->ID() == defaultTimeZone.ID()) {
|
||||
fCurrentZoneItem = zoneItem;
|
||||
if (countryItem != NULL)
|
||||
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;
|
||||
bool lastWasCountryItem = false;
|
||||
TimeZoneListItem* lastCountryItem = NULL;
|
||||
for (zoneIter = zoneMap.begin(); zoneIter != zoneMap.end(); ++zoneIter) {
|
||||
TimeZoneListItem* currentCountryItem = NULL;
|
||||
for (zoneIter = zoneItemMap.begin(); zoneIter != zoneItemMap.end();
|
||||
++zoneIter) {
|
||||
if (zoneIter->second->OutlineLevel() == 2 && lastWasCountryItem) {
|
||||
/* Some countries (e.g. Spain and Chile) have their timezones
|
||||
* spread across different regions. As a result, there might still
|
||||
@ -405,18 +422,19 @@ TimeZoneView::_BuildZoneMenu()
|
||||
*/
|
||||
ZoneItemMap::iterator next = zoneIter;
|
||||
++next;
|
||||
if (next != zoneMap.end() && next->second->OutlineLevel() != 2) {
|
||||
fZoneList->RemoveItem(lastCountryItem);
|
||||
zoneIter->second->SetText(lastCountryItem->Text());
|
||||
if (next != zoneItemMap.end()
|
||||
&& next->second->OutlineLevel() != 2) {
|
||||
fZoneList->RemoveItem(currentCountryItem);
|
||||
zoneIter->second->SetText(currentCountryItem->Text());
|
||||
zoneIter->second->SetOutlineLevel(1);
|
||||
delete lastCountryItem;
|
||||
delete currentCountryItem;
|
||||
}
|
||||
}
|
||||
|
||||
fZoneList->AddItem(zoneIter->second);
|
||||
if (zoneIter->second->OutlineLevel() == 1) {
|
||||
lastWasCountryItem = true;
|
||||
lastCountryItem = zoneIter->second;
|
||||
currentCountryItem = zoneIter->second;
|
||||
} else
|
||||
lastWasCountryItem = false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user