1/*
2 * Copyright 2003-2011, Haiku. All rights reserved.
3 * Distributed under the terms of the MIT license.
4 */
5#ifndef _LOCALE_ROSTER_H_
6#define _LOCALE_ROSTER_H_
7
8
9#include <pthread.h>
10
11#include <Entry.h>
12#include <String.h>
13
14
15class BBitmap;
16class BCatalog;
17class BCollator;
18class BCountry;
19class BDateFormat;
20class BFormattingConventions;
21class BLanguage;
22class BLocale;
23class BMessage;
24class BTimeZone;
25
26
27namespace BPrivate {
28	struct LocaleRosterData;
29}
30
31
32enum {
33	B_LOCALE_CHANGED = '_LCC',
34};
35
36
37class BLocaleRoster {
38
39public:
40								~BLocaleRoster();
41
42	static	BLocaleRoster*		Default();
43
44			status_t			GetDefaultTimeZone(BTimeZone* timezone) const;
45
46			status_t			GetLanguage(const char* languageCode,
47									BLanguage** _language) const;
48
49			status_t			GetPreferredLanguages(BMessage* message) const;
50
51			status_t			GetAvailableLanguages(BMessage* message) const;
52			status_t			GetAvailableCountries(
53									BMessage* timeZones) const;
54			status_t			GetAvailableTimeZones(
55									BMessage* timeZones) const;
56			status_t			GetAvailableTimeZonesWithRegionInfo(
57									BMessage* timeZonesWithRegonInfo) const;
58			status_t			GetAvailableTimeZonesForCountry(
59									BMessage* message,
60									const char* countryCode) const;
61
62			status_t			GetFlagIconForCountry(BBitmap* flagIcon,
63									const char* countryCode);
64			status_t			GetFlagIconForLanguage(BBitmap* flagIcon,
65									const char* languageCode);
66
67			status_t			GetAvailableCatalogs(BMessage* message,
68									const char* sigPattern = NULL,
69									const char* langPattern = NULL,
70									int32 fingerprint = 0) const;
71									// the message contains...
72
73			status_t			Refresh();
74									// Refresh the internal data from the
75									// settings file(s)
76
77			BCatalog*			GetCatalog();
78									// Get the catalog for the calling image
79									// (that needs to link with liblocalestub.a)
80
81			const BLocale*		GetDefaultLocale() const;
82
83			bool				IsFilesystemTranslationPreferred() const;
84
85			status_t			GetLocalizedFileName(BString& localizedFileName,
86									const entry_ref& ref,
87									bool traverse = false);
88
89	static	const char*			kCatLangAttr;
90	static	const char*			kCatSigAttr;
91	static	const char*			kCatFingerprintAttr;
92
93	static	const char*			kEmbeddedCatAttr;
94	static	int32				kEmbeddedCatResId;
95
96protected:
97								BLocaleRoster();
98
99protected:
100			BPrivate::LocaleRosterData*	fData;
101
102private:
103	static	BCatalog*			_GetCatalog(BCatalog* catalog,
104									int32* catalogInitStatus);
105
106			status_t			_PrepareCatalogEntry(const entry_ref& ref,
107									BString& signature, BString& context,
108									BString& string, bool traverse);
109
110};
111
112
113#endif	// _LOCALE_ROSTER_H_
114