2010-05-07 17:38:40 +00:00
|
|
|
/*
|
2011-05-25 17:09:30 +00:00
|
|
|
* Copyright 2003-2011, Haiku. All rights reserved.
|
2010-05-07 17:38:40 +00:00
|
|
|
* Distributed under the terms of the MIT license.
|
|
|
|
|
*/
|
2009-05-01 19:23:59 +00:00
|
|
|
#ifndef _LOCALE_ROSTER_H_
|
|
|
|
|
#define _LOCALE_ROSTER_H_
|
|
|
|
|
|
2009-09-18 22:23:34 +00:00
|
|
|
|
2014-01-19 12:12:57 +01:00
|
|
|
#include <pthread.h>
|
|
|
|
|
|
2011-03-21 23:23:57 +00:00
|
|
|
#include <Entry.h>
|
2009-05-01 19:23:59 +00:00
|
|
|
#include <String.h>
|
|
|
|
|
|
2009-09-18 22:23:34 +00:00
|
|
|
|
2010-10-19 21:36:44 +00:00
|
|
|
class BBitmap;
|
2010-08-01 20:28:19 +00:00
|
|
|
class BCatalog;
|
2009-05-01 19:23:59 +00:00
|
|
|
class BCollator;
|
|
|
|
|
class BCountry;
|
2014-09-26 18:24:07 +02:00
|
|
|
class BDateFormat;
|
2010-10-24 12:57:55 +00:00
|
|
|
class BFormattingConventions;
|
2010-08-01 20:28:19 +00:00
|
|
|
class BLanguage;
|
|
|
|
|
class BLocale;
|
2009-11-10 13:44:22 +00:00
|
|
|
class BMessage;
|
2010-07-26 13:56:50 +00:00
|
|
|
class BTimeZone;
|
2009-05-01 19:23:59 +00:00
|
|
|
|
2010-07-20 15:47:16 +00:00
|
|
|
|
2012-11-26 01:18:57 +01:00
|
|
|
namespace BPrivate {
|
2017-12-03 13:44:30 -05:00
|
|
|
struct LocaleRosterData;
|
2012-11-26 01:18:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-05-01 19:23:59 +00:00
|
|
|
enum {
|
2010-08-01 20:28:19 +00:00
|
|
|
B_LOCALE_CHANGED = '_LCC',
|
2009-05-01 19:23:59 +00:00
|
|
|
};
|
|
|
|
|
|
2009-09-18 22:23:34 +00:00
|
|
|
|
2009-05-01 21:56:16 +00:00
|
|
|
class BLocaleRoster {
|
2012-11-26 01:18:57 +01:00
|
|
|
|
2010-08-01 20:28:19 +00:00
|
|
|
public:
|
|
|
|
|
~BLocaleRoster();
|
2010-07-26 13:56:50 +00:00
|
|
|
|
2010-11-22 13:06:36 +00:00
|
|
|
static BLocaleRoster* Default();
|
|
|
|
|
|
2010-08-01 20:28:19 +00:00
|
|
|
status_t GetDefaultTimeZone(BTimeZone* timezone) const;
|
2009-05-01 21:56:16 +00:00
|
|
|
|
2010-08-01 20:28:19 +00:00
|
|
|
status_t GetLanguage(const char* languageCode,
|
|
|
|
|
BLanguage** _language) const;
|
2010-01-20 22:44:34 +00:00
|
|
|
|
2010-08-01 20:28:19 +00:00
|
|
|
status_t GetPreferredLanguages(BMessage* message) const;
|
2009-05-01 19:23:59 +00:00
|
|
|
|
2010-10-20 09:23:06 +00:00
|
|
|
status_t GetAvailableLanguages(BMessage* message) const;
|
2010-08-26 22:16:40 +00:00
|
|
|
status_t GetAvailableCountries(
|
|
|
|
|
BMessage* timeZones) const;
|
|
|
|
|
status_t GetAvailableTimeZones(
|
|
|
|
|
BMessage* timeZones) const;
|
2012-04-07 20:44:39 +02:00
|
|
|
status_t GetAvailableTimeZonesWithRegionInfo(
|
|
|
|
|
BMessage* timeZonesWithRegonInfo) const;
|
2010-08-26 22:16:40 +00:00
|
|
|
status_t GetAvailableTimeZonesForCountry(
|
|
|
|
|
BMessage* message,
|
|
|
|
|
const char* countryCode) const;
|
2010-07-22 12:47:00 +00:00
|
|
|
|
2010-10-19 21:36:44 +00:00
|
|
|
status_t GetFlagIconForCountry(BBitmap* flagIcon,
|
|
|
|
|
const char* countryCode);
|
2011-05-25 17:09:30 +00:00
|
|
|
status_t GetFlagIconForLanguage(BBitmap* flagIcon,
|
|
|
|
|
const char* languageCode);
|
2010-10-19 21:36:44 +00:00
|
|
|
|
2010-10-24 12:57:55 +00:00
|
|
|
status_t GetAvailableCatalogs(BMessage* message,
|
2010-08-01 20:28:19 +00:00
|
|
|
const char* sigPattern = NULL,
|
|
|
|
|
const char* langPattern = NULL,
|
|
|
|
|
int32 fingerprint = 0) const;
|
|
|
|
|
// the message contains...
|
2009-05-01 19:23:59 +00:00
|
|
|
|
2010-08-01 20:28:19 +00:00
|
|
|
status_t Refresh();
|
|
|
|
|
// Refresh the internal data from the
|
|
|
|
|
// settings file(s)
|
2010-07-20 11:38:34 +00:00
|
|
|
|
2010-08-01 20:28:19 +00:00
|
|
|
BCatalog* GetCatalog();
|
|
|
|
|
// Get the catalog for the calling image
|
|
|
|
|
// (that needs to link with liblocalestub.a)
|
2009-09-18 22:23:34 +00:00
|
|
|
|
2012-11-26 01:18:57 +01:00
|
|
|
const BLocale* GetDefaultLocale() const;
|
|
|
|
|
|
2011-03-11 19:52:15 +00:00
|
|
|
bool IsFilesystemTranslationPreferred() const;
|
|
|
|
|
|
2011-03-27 18:38:05 +00:00
|
|
|
status_t GetLocalizedFileName(BString& localizedFileName,
|
|
|
|
|
const entry_ref& ref,
|
2011-03-21 23:23:57 +00:00
|
|
|
bool traverse = false);
|
|
|
|
|
|
2010-08-01 20:28:19 +00:00
|
|
|
static const char* kCatLangAttr;
|
|
|
|
|
static const char* kCatSigAttr;
|
|
|
|
|
static const char* kCatFingerprintAttr;
|
2009-09-18 22:23:34 +00:00
|
|
|
|
2010-08-01 20:28:19 +00:00
|
|
|
static const char* kEmbeddedCatAttr;
|
|
|
|
|
static int32 kEmbeddedCatResId;
|
2009-05-01 19:23:59 +00:00
|
|
|
|
2012-11-26 01:18:57 +01:00
|
|
|
protected:
|
|
|
|
|
BLocaleRoster();
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
BPrivate::LocaleRosterData* fData;
|
|
|
|
|
|
2010-08-01 20:28:19 +00:00
|
|
|
private:
|
|
|
|
|
static BCatalog* _GetCatalog(BCatalog* catalog,
|
2014-01-19 12:12:57 +01:00
|
|
|
int32* catalogInitStatus);
|
2011-03-27 18:38:05 +00:00
|
|
|
|
|
|
|
|
status_t _PrepareCatalogEntry(const entry_ref& ref,
|
|
|
|
|
BString& signature, BString& context,
|
|
|
|
|
BString& string, bool traverse);
|
2012-11-26 01:18:57 +01:00
|
|
|
|
2010-08-01 20:28:19 +00:00
|
|
|
};
|
2009-05-01 19:23:59 +00:00
|
|
|
|
2009-09-18 22:23:34 +00:00
|
|
|
|
2010-08-01 20:28:19 +00:00
|
|
|
#endif // _LOCALE_ROSTER_H_
|