-
Notifications
You must be signed in to change notification settings - Fork 0
/
i18n.h
58 lines (38 loc) · 1.31 KB
/
i18n.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef __I18N_H__
#define __I18N_H__
/// \file i18n.h
/// Locale related functions
#include <string>
/// Description of current locale
class Locale
{
private:
std::wstring language;
std::wstring country;
std::wstring encoding;
public:
/// Load locale
Locale();
/// Copy constructor
Locale(const Locale &locale);
public:
/// Get current country.
const std::wstring& getCountry() const { return country; };
/// Get current language.
const std::wstring& getLanguage() const { return language; };
/// Get current encoding.
const std::wstring& getEncoding() const { return encoding; };
private:
void parseLocale(const std::wstring &name);
};
// split file name to file name, extension, language name and country
// for exmaple, "story_ru_RU.txt" shoud be splited to
// name="story", extension="txt", language="ru", country="RU"
void splitFileName(const std::wstring &fileName, std::wstring &name,
std::wstring &ext, std::wstring &lang, std::wstring &country);
// calculate relevance score between language, country and
// current locale
int getScore(const std::wstring &lang, const std::wstring &country,
const Locale &locale);
extern Locale locale;
#endif