xref: /haiku/headers/os/locale/LocaleRoster.h (revision acf02fd2cf6b89c04f7ad403c583a73356221f2c)
196eaa02eSAxel Dörfler /*
2702526b1SAxel Dörfler  * Copyright 2003-2011, Haiku. All rights reserved.
396eaa02eSAxel Dörfler  * Distributed under the terms of the MIT license.
496eaa02eSAxel Dörfler  */
5c3ac87e8SOliver Tappe #ifndef _LOCALE_ROSTER_H_
6c3ac87e8SOliver Tappe #define _LOCALE_ROSTER_H_
7c3ac87e8SOliver Tappe 
875f15221SOliver Tappe 
9fed5e612SAdrien Destugues #include <pthread.h>
10fed5e612SAdrien Destugues 
1185366cb5SJonas Sundström #include <Entry.h>
12c3ac87e8SOliver Tappe #include <String.h>
13c3ac87e8SOliver Tappe 
1475f15221SOliver Tappe 
15d1d8fda6SOliver Tappe class BBitmap;
1638ac8defSOliver Tappe class BCatalog;
17c3ac87e8SOliver Tappe class BCollator;
18c3ac87e8SOliver Tappe class BCountry;
192a5e33a9SAdrien Destugues class BDateFormat;
206fd2f4a0SOliver Tappe class BFormattingConventions;
2138ac8defSOliver Tappe class BLanguage;
2238ac8defSOliver Tappe class BLocale;
23f9a80fecSAxel Dörfler class BMessage;
244ae5a452SAdrien Destugues class BTimeZone;
25c3ac87e8SOliver Tappe 
264b37c7f8SAdrien Destugues 
2752cdfde0SOliver Tappe namespace BPrivate {
28*acf02fd2SAugustin Cavalier 	struct LocaleRosterData;
2952cdfde0SOliver Tappe }
3052cdfde0SOliver Tappe 
3152cdfde0SOliver Tappe 
32c3ac87e8SOliver Tappe enum {
33c3ac87e8SOliver Tappe 	B_LOCALE_CHANGED = '_LCC',
34c3ac87e8SOliver Tappe };
35c3ac87e8SOliver Tappe 
3675f15221SOliver Tappe 
37723383c0SOliver Tappe class BLocaleRoster {
3852cdfde0SOliver Tappe 
39c3ac87e8SOliver Tappe public:
40c3ac87e8SOliver Tappe 								~BLocaleRoster();
41c3ac87e8SOliver Tappe 
4225dc253dSIngo Weinhold 	static	BLocaleRoster*		Default();
4325dc253dSIngo Weinhold 
4438ac8defSOliver Tappe 			status_t			GetDefaultTimeZone(BTimeZone* timezone) const;
454ae5a452SAdrien Destugues 
4638ac8defSOliver Tappe 			status_t			GetLanguage(const char* languageCode,
4738ac8defSOliver Tappe 									BLanguage** _language) const;
48c3ac87e8SOliver Tappe 
4938ac8defSOliver Tappe 			status_t			GetPreferredLanguages(BMessage* message) const;
505570fd11SAdrien Destugues 
516f43fabaSOliver Tappe 			status_t			GetAvailableLanguages(BMessage* message) const;
52c91aa9f4SOliver Tappe 			status_t			GetAvailableCountries(
53c91aa9f4SOliver Tappe 									BMessage* timeZones) const;
54c91aa9f4SOliver Tappe 			status_t			GetAvailableTimeZones(
55c91aa9f4SOliver Tappe 									BMessage* timeZones) const;
56635df643SOliver Tappe 			status_t			GetAvailableTimeZonesWithRegionInfo(
57635df643SOliver Tappe 									BMessage* timeZonesWithRegonInfo) const;
58c91aa9f4SOliver Tappe 			status_t			GetAvailableTimeZonesForCountry(
59c91aa9f4SOliver Tappe 									BMessage* message,
60c91aa9f4SOliver Tappe 									const char* countryCode) const;
61c3ac87e8SOliver Tappe 
62d1d8fda6SOliver Tappe 			status_t			GetFlagIconForCountry(BBitmap* flagIcon,
63d1d8fda6SOliver Tappe 									const char* countryCode);
64702526b1SAxel Dörfler 			status_t			GetFlagIconForLanguage(BBitmap* flagIcon,
65702526b1SAxel Dörfler 									const char* languageCode);
66d1d8fda6SOliver Tappe 
676fd2f4a0SOliver Tappe 			status_t			GetAvailableCatalogs(BMessage* message,
6838ac8defSOliver Tappe 									const char* sigPattern = NULL,
6938ac8defSOliver Tappe 									const char* langPattern = NULL,
7038ac8defSOliver Tappe 									int32 fingerprint = 0) const;
71c3ac87e8SOliver Tappe 									// the message contains...
72c3ac87e8SOliver Tappe 
7338ac8defSOliver Tappe 			status_t			Refresh();
7438ac8defSOliver Tappe 									// Refresh the internal data from the
7538ac8defSOliver Tappe 									// settings file(s)
7638ac8defSOliver Tappe 
77fe8d7c02SAdrien Destugues 			BCatalog*			GetCatalog();
7838ac8defSOliver Tappe 									// Get the catalog for the calling image
7938ac8defSOliver Tappe 									// (that needs to link with liblocalestub.a)
80fe8d7c02SAdrien Destugues 
8152cdfde0SOliver Tappe 			const BLocale*		GetDefaultLocale() const;
8252cdfde0SOliver Tappe 
8307cffb47SJonas Sundström 			bool				IsFilesystemTranslationPreferred() const;
8407cffb47SJonas Sundström 
85ee6a2e55SJonas Sundström 			status_t			GetLocalizedFileName(BString& localizedFileName,
86ee6a2e55SJonas Sundström 									const entry_ref& ref,
8785366cb5SJonas Sundström 									bool traverse = false);
8885366cb5SJonas Sundström 
89c3ac87e8SOliver Tappe 	static	const char*			kCatLangAttr;
90c3ac87e8SOliver Tappe 	static	const char*			kCatSigAttr;
91c3ac87e8SOliver Tappe 	static	const char*			kCatFingerprintAttr;
9275f15221SOliver Tappe 
93c3ac87e8SOliver Tappe 	static	const char*			kEmbeddedCatAttr;
94c3ac87e8SOliver Tappe 	static	int32				kEmbeddedCatResId;
95c3ac87e8SOliver Tappe 
9652cdfde0SOliver Tappe protected:
9752cdfde0SOliver Tappe 								BLocaleRoster();
9852cdfde0SOliver Tappe 
9952cdfde0SOliver Tappe protected:
10052cdfde0SOliver Tappe 			BPrivate::LocaleRosterData*	fData;
10152cdfde0SOliver Tappe 
102c3ac87e8SOliver Tappe private:
10338ac8defSOliver Tappe 	static	BCatalog*			_GetCatalog(BCatalog* catalog,
104fed5e612SAdrien Destugues 									int32* catalogInitStatus);
105ee6a2e55SJonas Sundström 
106ee6a2e55SJonas Sundström 			status_t			_PrepareCatalogEntry(const entry_ref& ref,
107ee6a2e55SJonas Sundström 									BString& signature, BString& context,
108ee6a2e55SJonas Sundström 									BString& string, bool traverse);
10952cdfde0SOliver Tappe 
110c3ac87e8SOliver Tappe };
111c3ac87e8SOliver Tappe 
11238ac8defSOliver Tappe 
11338ac8defSOliver Tappe #endif	// _LOCALE_ROSTER_H_
114