* Changed BLocaleRoster::GetLanguage() to a signature that makes more sense,
and looks more like the rest of the API.
* Also, it will now return an appropriate error code if the language couldn't
be allocated (anything else than B_OK is an improvement :-)).
* Several changes in BLanguage:
- GetName() now gets a BString reference, also
- it now returns the name in its own language, ie. for German this would
always be "deutsch", no matter the current language settings, and finally,
- it now empties the string it gets before adding the name.
- added GetTranslatedName() that behaves like the previous version.
- added const where it made sense (ie. almost everywhere).
- Code() now returns the code of the language only.
- ID() now returns the full ID of this language, ie. including country,
variant, and keywords if any.
- added Country(), and Variant().
- renamed IsCountry() to IsCountrySpecific().
- added IsVariant().
* Cleaned up Language.h, minor cleanup in LocaleRoster.cpp.
* Removed the whole move item logic from LanguageListView; while this was not
only spaghetti code, it doesn't make much sense in the first place.
* Instead of removing stuff from the left, and even worse, moving all countries
for a language even if only one had been dragged, we now only mark the items
that are already in the preferred list, and only those.
* Fixed various mixups of FullList*() vs. *() methods that could lead to things
like bug #5896.
* Pressing the delete key in the preferred list view will now remove the
language.
* Moved LocaleWindow specific message constants to LocaleWindow.cpp; Locale.h
is supposed to contain application wide constants.
* The drop logic is now in LocaleWindow.
* We now make sure that each base language can only be in the list once.
* Lots of cleanup, even though I mostly replaced spaghettie code with different
looking spaghettie code - still, I think things have slightly improved.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36727 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-07 21:38:40 +04:00
|
|
|
/*
|
2011-05-25 21:09:30 +04:00
|
|
|
* Copyright 2003-2011, Haiku. All rights reserved.
|
* Changed BLocaleRoster::GetLanguage() to a signature that makes more sense,
and looks more like the rest of the API.
* Also, it will now return an appropriate error code if the language couldn't
be allocated (anything else than B_OK is an improvement :-)).
* Several changes in BLanguage:
- GetName() now gets a BString reference, also
- it now returns the name in its own language, ie. for German this would
always be "deutsch", no matter the current language settings, and finally,
- it now empties the string it gets before adding the name.
- added GetTranslatedName() that behaves like the previous version.
- added const where it made sense (ie. almost everywhere).
- Code() now returns the code of the language only.
- ID() now returns the full ID of this language, ie. including country,
variant, and keywords if any.
- added Country(), and Variant().
- renamed IsCountry() to IsCountrySpecific().
- added IsVariant().
* Cleaned up Language.h, minor cleanup in LocaleRoster.cpp.
* Removed the whole move item logic from LanguageListView; while this was not
only spaghetti code, it doesn't make much sense in the first place.
* Instead of removing stuff from the left, and even worse, moving all countries
for a language even if only one had been dragged, we now only mark the items
that are already in the preferred list, and only those.
* Fixed various mixups of FullList*() vs. *() methods that could lead to things
like bug #5896.
* Pressing the delete key in the preferred list view will now remove the
language.
* Moved LocaleWindow specific message constants to LocaleWindow.cpp; Locale.h
is supposed to contain application wide constants.
* The drop logic is now in LocaleWindow.
* We now make sure that each base language can only be in the list once.
* Lots of cleanup, even though I mostly replaced spaghettie code with different
looking spaghettie code - still, I think things have slightly improved.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36727 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-07 21:38:40 +04:00
|
|
|
* Distributed under the terms of the MIT license.
|
|
|
|
*/
|
2009-05-01 23:23:59 +04:00
|
|
|
#ifndef _LOCALE_ROSTER_H_
|
|
|
|
#define _LOCALE_ROSTER_H_
|
|
|
|
|
2009-09-19 02:23:34 +04:00
|
|
|
|
2014-01-19 15:12:57 +04:00
|
|
|
#include <pthread.h>
|
|
|
|
|
2011-03-22 02:23:57 +03:00
|
|
|
#include <Entry.h>
|
2009-05-01 23:23:59 +04:00
|
|
|
#include <String.h>
|
|
|
|
|
2009-09-19 02:23:34 +04:00
|
|
|
|
2010-10-20 01:36:44 +04:00
|
|
|
class BBitmap;
|
2010-08-02 00:28:19 +04:00
|
|
|
class BCatalog;
|
2009-05-01 23:23:59 +04:00
|
|
|
class BCollator;
|
|
|
|
class BCountry;
|
2014-09-26 20:24:07 +04:00
|
|
|
class BDateFormat;
|
2010-10-24 16:57:55 +04:00
|
|
|
class BFormattingConventions;
|
2010-08-02 00:28:19 +04:00
|
|
|
class BLanguage;
|
|
|
|
class BLocale;
|
2009-11-10 16:44:22 +03:00
|
|
|
class BMessage;
|
2010-07-26 17:56:50 +04:00
|
|
|
class BTimeZone;
|
2009-05-01 23:23:59 +04:00
|
|
|
|
2010-07-20 19:47:16 +04:00
|
|
|
|
2012-11-26 04:18:57 +04:00
|
|
|
namespace BPrivate {
|
|
|
|
class LocaleRosterData;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-05-01 23:23:59 +04:00
|
|
|
enum {
|
2010-08-02 00:28:19 +04:00
|
|
|
B_LOCALE_CHANGED = '_LCC',
|
2009-05-01 23:23:59 +04:00
|
|
|
};
|
|
|
|
|
2009-09-19 02:23:34 +04:00
|
|
|
|
2009-05-02 01:56:16 +04:00
|
|
|
class BLocaleRoster {
|
2012-11-26 04:18:57 +04:00
|
|
|
|
2010-08-02 00:28:19 +04:00
|
|
|
public:
|
|
|
|
~BLocaleRoster();
|
2010-07-26 17:56:50 +04:00
|
|
|
|
2010-11-22 16:06:36 +03:00
|
|
|
static BLocaleRoster* Default();
|
|
|
|
|
2010-08-02 00:28:19 +04:00
|
|
|
status_t GetDefaultTimeZone(BTimeZone* timezone) const;
|
2009-05-02 01:56:16 +04:00
|
|
|
|
2010-08-02 00:28:19 +04:00
|
|
|
status_t GetLanguage(const char* languageCode,
|
|
|
|
BLanguage** _language) const;
|
2010-01-21 01:44:34 +03:00
|
|
|
|
2010-08-02 00:28:19 +04:00
|
|
|
status_t GetPreferredLanguages(BMessage* message) const;
|
2009-05-01 23:23:59 +04:00
|
|
|
|
2010-10-20 13:23:06 +04:00
|
|
|
status_t GetAvailableLanguages(BMessage* message) const;
|
2010-08-27 02:16:40 +04:00
|
|
|
status_t GetAvailableCountries(
|
|
|
|
BMessage* timeZones) const;
|
|
|
|
status_t GetAvailableTimeZones(
|
|
|
|
BMessage* timeZones) const;
|
2012-04-07 22:44:39 +04:00
|
|
|
status_t GetAvailableTimeZonesWithRegionInfo(
|
|
|
|
BMessage* timeZonesWithRegonInfo) const;
|
2010-08-27 02:16:40 +04:00
|
|
|
status_t GetAvailableTimeZonesForCountry(
|
|
|
|
BMessage* message,
|
|
|
|
const char* countryCode) const;
|
2010-07-22 16:47:00 +04:00
|
|
|
|
2010-10-20 01:36:44 +04:00
|
|
|
status_t GetFlagIconForCountry(BBitmap* flagIcon,
|
|
|
|
const char* countryCode);
|
2011-05-25 21:09:30 +04:00
|
|
|
status_t GetFlagIconForLanguage(BBitmap* flagIcon,
|
|
|
|
const char* languageCode);
|
2010-10-20 01:36:44 +04:00
|
|
|
|
2010-10-24 16:57:55 +04:00
|
|
|
status_t GetAvailableCatalogs(BMessage* message,
|
2010-08-02 00:28:19 +04:00
|
|
|
const char* sigPattern = NULL,
|
|
|
|
const char* langPattern = NULL,
|
|
|
|
int32 fingerprint = 0) const;
|
|
|
|
// the message contains...
|
2009-05-01 23:23:59 +04:00
|
|
|
|
2010-08-02 00:28:19 +04:00
|
|
|
status_t Refresh();
|
|
|
|
// Refresh the internal data from the
|
|
|
|
// settings file(s)
|
2010-07-20 15:38:34 +04:00
|
|
|
|
2010-08-02 00:28:19 +04:00
|
|
|
BCatalog* GetCatalog();
|
|
|
|
// Get the catalog for the calling image
|
|
|
|
// (that needs to link with liblocalestub.a)
|
2009-09-19 02:23:34 +04:00
|
|
|
|
2012-11-26 04:18:57 +04:00
|
|
|
const BLocale* GetDefaultLocale() const;
|
|
|
|
|
2011-03-11 22:52:15 +03:00
|
|
|
bool IsFilesystemTranslationPreferred() const;
|
|
|
|
|
2011-03-27 22:38:05 +04:00
|
|
|
status_t GetLocalizedFileName(BString& localizedFileName,
|
|
|
|
const entry_ref& ref,
|
2011-03-22 02:23:57 +03:00
|
|
|
bool traverse = false);
|
|
|
|
|
2010-08-02 00:28:19 +04:00
|
|
|
static const char* kCatLangAttr;
|
|
|
|
static const char* kCatSigAttr;
|
|
|
|
static const char* kCatFingerprintAttr;
|
2009-09-19 02:23:34 +04:00
|
|
|
|
2010-08-02 00:28:19 +04:00
|
|
|
static const char* kEmbeddedCatAttr;
|
|
|
|
static int32 kEmbeddedCatResId;
|
2009-05-01 23:23:59 +04:00
|
|
|
|
2012-11-26 04:18:57 +04:00
|
|
|
protected:
|
|
|
|
BLocaleRoster();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
BPrivate::LocaleRosterData* fData;
|
|
|
|
|
2010-08-02 00:28:19 +04:00
|
|
|
private:
|
|
|
|
static BCatalog* _GetCatalog(BCatalog* catalog,
|
2014-01-19 15:12:57 +04:00
|
|
|
int32* catalogInitStatus);
|
2011-03-27 22:38:05 +04:00
|
|
|
|
|
|
|
status_t _PrepareCatalogEntry(const entry_ref& ref,
|
|
|
|
BString& signature, BString& context,
|
|
|
|
BString& string, bool traverse);
|
2012-11-26 04:18:57 +04:00
|
|
|
|
2010-08-02 00:28:19 +04:00
|
|
|
};
|
2009-05-01 23:23:59 +04:00
|
|
|
|
2009-09-19 02:23:34 +04:00
|
|
|
|
2010-08-02 00:28:19 +04:00
|
|
|
#endif // _LOCALE_ROSTER_H_
|