* Remove direct access to ICU in locale preflet, use the locale kit instead.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37619 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -23,6 +23,7 @@ namespace BPrivate {
|
|||||||
class EditableCatalog;
|
class EditableCatalog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
B_LOCALE_CHANGED = '_LCC',
|
B_LOCALE_CHANGED = '_LCC',
|
||||||
};
|
};
|
||||||
@@ -33,16 +34,14 @@ class BLocaleRoster {
|
|||||||
BLocaleRoster();
|
BLocaleRoster();
|
||||||
~BLocaleRoster();
|
~BLocaleRoster();
|
||||||
|
|
||||||
// status_t GetLocaleFor(const char *langCode, const char *countryCode);
|
|
||||||
|
|
||||||
status_t GetSystemCatalog(BCatalogAddOn **) const;
|
status_t GetSystemCatalog(BCatalogAddOn **) const;
|
||||||
status_t GetDefaultCollator(BCollator **) const;
|
status_t GetDefaultCollator(BCollator **) const;
|
||||||
status_t GetDefaultLanguage(BLanguage **) const;
|
status_t GetDefaultLanguage(BLanguage **) const;
|
||||||
status_t GetDefaultCountry(BCountry **) const;
|
status_t GetDefaultCountry(BCountry **) const;
|
||||||
void SetDefaultCountry(BCountry *) const;
|
void SetDefaultCountry(BCountry *) const;
|
||||||
|
|
||||||
status_t GetLanguage(const char* languageCode,
|
status_t GetLanguage(const char* languageCode, BLanguage** _language)
|
||||||
BLanguage** _language) const;
|
const;
|
||||||
|
|
||||||
status_t GetPreferredLanguages(BMessage *) const;
|
status_t GetPreferredLanguages(BMessage *) const;
|
||||||
status_t SetPreferredLanguages(BMessage *);
|
status_t SetPreferredLanguages(BMessage *);
|
||||||
|
|||||||
@@ -11,15 +11,10 @@ local sources =
|
|||||||
TimeFormatSettingsView.cpp
|
TimeFormatSettingsView.cpp
|
||||||
;
|
;
|
||||||
|
|
||||||
SubDirSysHdrs $(HAIKU_ICU_HEADERS) ;
|
|
||||||
Includes [ FGristFiles $(sources) ] : $(HAIKU_ICU_HEADERS_DEPENDENCY) ;
|
|
||||||
# Dependency needed to trigger downloading/unzipping the package before
|
|
||||||
# compiling the files.
|
|
||||||
|
|
||||||
Preference Locale
|
Preference Locale
|
||||||
: $(sources)
|
: $(sources)
|
||||||
: be $(TARGET_LIBSTDC++) $(TARGET_LIBSUPC++)
|
: be $(TARGET_LIBSTDC++) $(TARGET_LIBSUPC++) libshared.a
|
||||||
libshared.a $(HAIKU_LOCALE_LIBS) $(HAIKU_ICU_LIBS)
|
$(HAIKU_LOCALE_LIBS)
|
||||||
: Locale.rdef
|
: Locale.rdef
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -26,11 +26,6 @@
|
|||||||
#include <TabView.h>
|
#include <TabView.h>
|
||||||
#include <UnicodeChar.h>
|
#include <UnicodeChar.h>
|
||||||
|
|
||||||
#include <ICUWrapper.h>
|
|
||||||
|
|
||||||
#include <unicode/locid.h>
|
|
||||||
#include <unicode/datefmt.h>
|
|
||||||
|
|
||||||
#include "TimeFormatSettingsView.h"
|
#include "TimeFormatSettingsView.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -176,6 +171,25 @@ LocaleWindow::LocaleWindow()
|
|||||||
// get all available countries from ICU
|
// get all available countries from ICU
|
||||||
// Use DateFormat::getAvailableLocale so we get only the one we can
|
// Use DateFormat::getAvailableLocale so we get only the one we can
|
||||||
// use. Maybe check the NumberFormat one and see if there is more.
|
// use. Maybe check the NumberFormat one and see if there is more.
|
||||||
|
BMessage countryList;
|
||||||
|
be_locale_roster->GetInstalledLanguages(&countryList);
|
||||||
|
BString countryCode;
|
||||||
|
|
||||||
|
for (int i = 0; countryList.FindString("langs", i, &countryCode) == B_OK;
|
||||||
|
i++) {
|
||||||
|
BCountry country(countryCode);
|
||||||
|
BString countryName;
|
||||||
|
|
||||||
|
country.Name(countryName);
|
||||||
|
|
||||||
|
LanguageListItem* item
|
||||||
|
= new LanguageListItem(countryName, countryCode,
|
||||||
|
NULL);
|
||||||
|
listView->AddItem(item);
|
||||||
|
if (!strcmp(countryCode, defaultCountry->Code()))
|
||||||
|
listView->Select(listView->CountItems() - 1);
|
||||||
|
}
|
||||||
|
/*
|
||||||
int32_t localeCount;
|
int32_t localeCount;
|
||||||
const Locale* currentLocale = Locale::getAvailableLocales(localeCount);
|
const Locale* currentLocale = Locale::getAvailableLocales(localeCount);
|
||||||
|
|
||||||
@@ -192,7 +206,7 @@ LocaleWindow::LocaleWindow()
|
|||||||
listView->AddItem(item);
|
listView->AddItem(item);
|
||||||
if (!strcmp(currentLocale[index].getName(), defaultCountry->Code()))
|
if (!strcmp(currentLocale[index].getName(), defaultCountry->Code()))
|
||||||
listView->Select(listView->CountItems() - 1);
|
listView->Select(listView->CountItems() - 1);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// TODO: find a real solution intead of this hack
|
// TODO: find a real solution intead of this hack
|
||||||
listView->SetExplicitMinSize(
|
listView->SetExplicitMinSize(
|
||||||
|
|||||||
@@ -30,8 +30,6 @@
|
|||||||
#include <TextControl.h>
|
#include <TextControl.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
#include <unicode/utypes.h>
|
|
||||||
|
|
||||||
|
|
||||||
#undef B_TRANSLATE_CONTEXT
|
#undef B_TRANSLATE_CONTEXT
|
||||||
#define B_TRANSLATE_CONTEXT "TimeFormatSettings"
|
#define B_TRANSLATE_CONTEXT "TimeFormatSettings"
|
||||||
@@ -613,10 +611,10 @@ FormatView::_UpdateExamples()
|
|||||||
fShortTimeExampleView->SetText(timeFormat);
|
fShortTimeExampleView->SetText(timeFormat);
|
||||||
|
|
||||||
status_t Error = fCountry->FormatNumber(&timeFormat, 1234.5678);
|
status_t Error = fCountry->FormatNumber(&timeFormat, 1234.5678);
|
||||||
if (Error == U_ZERO_ERROR)
|
if (Error == B_OK)
|
||||||
fNumberFormatExampleView->SetText(timeFormat);
|
fNumberFormatExampleView->SetText(timeFormat);
|
||||||
else
|
else
|
||||||
fNumberFormatExampleView->SetText(u_errorName((UErrorCode)Error));
|
fNumberFormatExampleView->SetText("ERROR");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user