20 ** |
20 ** |
21 ** If you have questions regarding the use of this file, please contact |
21 ** If you have questions regarding the use of this file, please contact |
22 ** Nokia at developer.feedback@nokia.com. |
22 ** Nokia at developer.feedback@nokia.com. |
23 ** |
23 ** |
24 ****************************************************************************/ |
24 ****************************************************************************/ |
|
25 #include "hbinputlanguage.h" |
25 #include "hbinpututils.h" |
26 #include "hbinpututils.h" |
26 #include "hbinputlanguage.h" |
|
27 |
27 |
28 /*! |
28 /*! |
29 \alpha |
29 \alpha |
30 \class HbInputLanguage |
30 \class HbInputLanguage |
31 \brief Holds Input language value. |
31 \brief Holds Input language value. |
32 |
32 |
33 When enumerating input languages, sometimes a single QLocale::Language value is not enough. For |
33 When enumerating input languages, sometimes a single QLocale::Language value is not enough. For |
34 example in case of Chinese. QLocale defines only one language constant for Chinese, QLocale::Chinese, |
34 example in case of Chinese. QLocale defines only one language constant for Chinese, QLocale::Chinese, |
35 but input framework supports three Chinese dialect. We need a secondary value for the dialect and |
35 but input framework supports three Chinese dialect. We need a secondary value for the dialect and |
36 we're using QLocale::Country values for that. In most cases, however, the variant field is not needed. |
36 we're using QLocale::Country values for that. In most cases, however, the variant field is not needed. |
37 QLocale itself has those two fields but using it would have been an overkill for this purpuse. |
37 QLocale itself has those two fields but using it would have been an overkill for this purpuse. |
38 This class also implements a set of language related convinience methods. |
38 This class also implements a set of language related convenience methods. |
39 */ |
39 */ |
40 |
40 |
41 // |
41 // |
42 // Localized language names. |
42 // Localized language names. |
43 // |
43 // |
44 const ushort HbLangNameEnglish[] = {'E','n','g','l','i','s','h',0}; |
44 const ushort HbLangNameEnglish[] = {'E', 'n', 'g', 'l', 'i', 's', 'h', 0}; |
45 const ushort HbLangNameLithuanian[] = {'L','i','e','t','u','v',0x0173,0}; |
45 const ushort HbLangNameLithuanian[] = {'L', 'i', 'e', 't', 'u', 'v', 0x0173, 0}; |
46 const ushort HbLangNameMalay[] = {'M','e','l','a','y','u',0}; |
46 const ushort HbLangNameMalay[] = {'M', 'e', 'l', 'a', 'y', 'u', 0}; |
47 const ushort HbLangNamePolish[] = {'P','o','l','s','k','i',0}; |
47 const ushort HbLangNamePolish[] = {'P', 'o', 'l', 's', 'k', 'i', 0}; |
48 const ushort HbLangNamePortuguese[] = {'P','o','r','t','u','g',0x00ea,'s',0}; |
48 const ushort HbLangNamePortuguese[] = {'P', 'o', 'r', 't', 'u', 'g', 0x00ea, 's', 0}; |
49 const ushort HbLangNameRomanian[] = {'R','o',0x00e2,'n',0x0103,0}; |
49 const ushort HbLangNameRomanian[] = {'R', 'o', 0x00e2, 'n', 0x0103, 0}; |
50 const ushort HbLangNameSerbian[] = {'S','r','p','s','k','i',0}; |
50 const ushort HbLangNameSerbian[] = {'S', 'r', 'p', 's', 'k', 'i', 0}; |
51 const ushort HbLangNameSlovak[] = {'S','l','o','v','e','n',0x010d,'i','n','a',0}; |
51 const ushort HbLangNameSlovak[] = {'S', 'l', 'o', 'v', 'e', 'n', 0x010d, 'i', 'n', 'a', 0}; |
52 const ushort HbLangNameSlovene[] = {'S','l','o','v','e','n',0x0161,0x010d,'i','n','a',0}; |
52 const ushort HbLangNameSlovene[] = {'S', 'l', 'o', 'v', 'e', 'n', 0x0161, 0x010d, 'i', 'n', 'a', 0}; |
53 const ushort HbLangNameSpanish[] = {'E','s','p','a',0x00f1,'o','l',0}; |
53 const ushort HbLangNameSpanish[] = {'E', 's', 'p', 'a', 0x00f1, 'o', 'l', 0}; |
54 const ushort HbLangNameSwedish[] = {'S','w','e','d','i','s','h',0}; |
54 const ushort HbLangNameSwedish[] = {'S', 'w', 'e', 'd', 'i', 's', 'h', 0}; |
55 const ushort HbLangNameTagalog[] = {'P','i','l','i','p','i','n','o',0}; |
55 const ushort HbLangNameTagalog[] = {'P', 'i', 'l', 'i', 'p', 'i', 'n', 'o', 0}; |
56 const ushort HbLangNameCzech[] = {0x010c,'e',0x0161,'t','i','n','a',0}; |
56 const ushort HbLangNameCzech[] = {0x010c, 'e', 0x0161, 't', 'i', 'n', 'a', 0}; |
57 const ushort HbLangNameDutch[] = {'N','e','d','e','r','l','a','n','d','s',0}; |
57 const ushort HbLangNameDutch[] = {'N', 'e', 'd', 'e', 'r', 'l', 'a', 'n', 'd', 's', 0}; |
58 const ushort HbLangNameTurkish[] = {'T',0x00fc,'r','k',0x00e7,'e',0}; |
58 const ushort HbLangNameTurkish[] = {'T', 0x00fc, 'r', 'k', 0x00e7, 'e', 0}; |
59 const ushort HbLangNameEstonian[] = {'E','e','s','t','i',0}; |
59 const ushort HbLangNameEstonian[] = {'E', 'e', 's', 't', 'i', 0}; |
60 const ushort HbLangNameFrench[] = {'F','r','a','n',0x00e7,'a','i','s',0}; |
60 const ushort HbLangNameFrench[] = {'F', 'r', 'a', 'n', 0x00e7, 'a', 'i', 's', 0}; |
61 const ushort HbLangNameGreek[] = {0x0395,0x03bb,0x03bb,0x03b7,0x03bd,0x03b9,0x03ba,0x03ac,0}; |
61 const ushort HbLangNameGreek[] = {0x0395, 0x03bb, 0x03bb, 0x03b7, 0x03bd, 0x03b9, 0x03ba, 0x03ac, 0}; |
62 const ushort HbLangNameIcelandic[] = {0x00cd,'s','l','e','n','s','k','a',0}; |
62 const ushort HbLangNameIcelandic[] = {0x00cd, 's', 'l', 'e', 'n', 's', 'k', 'a', 0}; |
63 const ushort HbLangNameIndonesian[] = {'I','n','d','o','n','e','s','i','a',0}; |
63 const ushort HbLangNameIndonesian[] = {'I', 'n', 'd', 'o', 'n', 'e', 's', 'i', 'a', 0}; |
64 const ushort HbLangNameItalian[] = {'I','t','a','l','i','a','n','o',0}; |
64 const ushort HbLangNameItalian[] = {'I', 't', 'a', 'l', 'i', 'a', 'n', 'o', 0}; |
65 const ushort HbLangNameLatvian[] = {'L','a','t','v','i','e',0x0161,'u',0}; |
65 const ushort HbLangNameLatvian[] = {'L', 'a', 't', 'v', 'i', 'e', 0x0161, 'u', 0}; |
66 const ushort HbLangNameCroatian[] = {'C','r','o','a','t','i','a','n',0}; |
66 const ushort HbLangNameCroatian[] = {'C', 'r', 'o', 'a', 't', 'i', 'a', 'n', 0}; |
67 const ushort HbLangNameGerman[] = {'D','e','u','t','c','h',0}; |
67 const ushort HbLangNameGerman[] = {'D', 'e', 'u', 't', 'c', 'h', 0}; |
68 const ushort HbLangNameHungarian[] = {'M','a','g','y','a','r',0}; |
68 const ushort HbLangNameHungarian[] = {'M', 'a', 'g', 'y', 'a', 'r', 0}; |
69 const ushort HbLangNameBulgarian[] = {0x0411,0x044a,0x043b,0x0433,0x0430,0x0440,0x0441,0x043a, 0x0438,0}; |
69 const ushort HbLangNameBulgarian[] = {0x0411, 0x044a, 0x043b, 0x0433, 0x0430, 0x0440, 0x0441, 0x043a, 0x0438, 0}; |
70 const ushort HbLangNameFinnish[] = {'S','u','o','m','i',0}; |
70 const ushort HbLangNameFinnish[] = {'S', 'u', 'o', 'm', 'i', 0}; |
71 const ushort HbLangNameRussian[] = {0x0420,0x0443,0x0441,0x0441,0x043a,0x0438,0x0439,0}; |
71 const ushort HbLangNameRussian[] = {0x0420, 0x0443, 0x0441, 0x0441, 0x043a, 0x0438, 0x0439, 0}; |
72 const ushort HbLangNameDanish[] = {'D','a','n','s','k',0}; |
72 const ushort HbLangNameDanish[] = {'D', 'a', 'n', 's', 'k', 0}; |
73 const ushort HbLangNameNorwegian[] = {'N','o','r','s','k',0}; |
73 const ushort HbLangNameNorwegian[] = {'N', 'o', 'r', 's', 'k', 0}; |
74 const ushort HbLangNameUkrainian[] = {0x0423, 0x043a, 0x0440, 0x0430, 0x0457, 0x043d, 0x0441, 0x044c, 0x043a, 0x0430,0}; |
74 const ushort HbLangNameUkrainian[] = {0x0423, 0x043a, 0x0440, 0x0430, 0x0457, 0x043d, 0x0441, 0x044c, 0x043a, 0x0430, 0}; |
75 const ushort HbLangNameArabic[] = {0x0627,0x0644,0x0639,0x0631,0x0628,0x064a,0x0629,0}; |
75 const ushort HbLangNameArabic[] = {0x0627, 0x0644, 0x0639, 0x0631, 0x0628, 0x064a, 0x0629, 0}; |
76 const ushort HbLangNameHebrew[] = {0x05e2,0x05d1,0x05e8,0x05d9,0x05ea,0}; |
76 const ushort HbLangNameHebrew[] = {0x05e2, 0x05d1, 0x05e8, 0x05d9, 0x05ea, 0}; |
77 const ushort HbLangNameThai[] = {0x0e20,0x0e32,0x0e29,0x0e32,0x0e44,0x0e17,0x0e22,0}; |
77 const ushort HbLangNameThai[] = {0x0e20, 0x0e32, 0x0e29, 0x0e32, 0x0e44, 0x0e17, 0x0e22, 0}; |
78 const ushort HbLangNameJapanese[] = {0x65e5,0x672c,0x8a9e,0}; |
78 const ushort HbLangNameJapanese[] = {0x65e5, 0x672c, 0x8a9e, 0}; |
79 const ushort HbLangNameVietnamese[] = {'T','i',0x00ea,0x0301,'n','g',' ','V','i',0x00ea,0x0323,'t',0}; |
79 const ushort HbLangNameVietnamese[] = {'T', 'i', 0x00ea, 0x0301, 'n', 'g', ' ', 'V', 'i', 0x00ea, 0x0323, 't', 0}; |
80 const ushort HbLangNameFarsi[] = {0x0641,0x0627,0x0631,0x0633,0x0649,0}; |
80 const ushort HbLangNameFarsi[] = {0x0641, 0x0627, 0x0631, 0x0633, 0x0649, 0}; |
81 const ushort HbLangNameHindi[] = {0x0939,0x093f,0x0928,0x0928,0x094d,0x0926,0x0940,0}; |
81 const ushort HbLangNameHindi[] = {0x0939, 0x093f, 0x0928, 0x0928, 0x094d, 0x0926, 0x0940, 0}; |
82 const ushort HbLangNameUrdu[] = {0x0627,0x0631,0x062f,0x0648,0}; |
82 const ushort HbLangNameUrdu[] = {0x0627, 0x0631, 0x062f, 0x0648, 0}; |
83 const ushort HbLangNameCatalan[] = {'C','a','t','a','l',0x00e0,0}; |
83 const ushort HbLangNameCatalan[] = {'C', 'a', 't', 'a', 'l', 0x00e0, 0}; |
84 const ushort HbLangNameGalician[] = {'G','a','l','e','g','o',0}; |
84 const ushort HbLangNameGalician[] = {'G', 'a', 'l', 'e', 'g', 'o', 0}; |
85 const ushort HbLangNameBasque[] = {'E','u','s','k','a','r','a',0}; |
85 const ushort HbLangNameBasque[] = {'E', 'u', 's', 'k', 'a', 'r', 'a', 0}; |
86 const ushort HbLangNameMarathi[] = {0x092e,0x0930,0x093e,0x0920,0x0940,0}; |
86 const ushort HbLangNameMarathi[] = {0x092e, 0x0930, 0x093e, 0x0920, 0x0940, 0}; |
87 const ushort HbLangNameChinesePrc[] = {0x7B80,0x4F53,0x4E2D,0x6587,0}; |
87 const ushort HbLangNameChinesePrc[] = {0x7B80, 0x4F53, 0x4E2D, 0x6587, 0}; |
88 const ushort HbLangNameChineseHongKong[] = {0x7E41,0x9AD4,0x4E2D,0x6587,0x0028,0x9999,0x6E2F,0x0029,0}; |
88 const ushort HbLangNameChineseHongKong[] = {0x7E41, 0x9AD4, 0x4E2D, 0x6587, 0x0028, 0x9999, 0x6E2F, 0x0029, 0}; |
89 const ushort HbLangNameChineseTaiwan[] = {0x7E41,0x9AD4,0x4E2D,0x6587,0x0028,0x53F0,0x7063,0x0029,0}; |
89 const ushort HbLangNameChineseTaiwan[] = {0x7E41, 0x9AD4, 0x4E2D, 0x6587, 0x0028, 0x53F0, 0x7063, 0x0029, 0}; |
90 const ushort HbLangNameKorean[] = {'K','o','r','e','a','n',0}; |
90 const ushort HbLangNameKorean[] = {'K', 'o', 'r', 'e', 'a', 'n', 0}; |
91 |
91 |
92 // |
92 // |
93 // Helper class for binding language names to QLocale constants. |
93 // Helper class for binding language names to QLocale constants. |
94 // |
94 // |
95 class HbLocNameBinding |
95 class HbLocNameBinding |
96 { |
96 { |
97 public: |
97 public: |
98 int mLanguage; |
98 int mLanguage; |
99 const ushort* mName; |
99 const ushort *mName; |
100 }; |
100 }; |
101 |
101 |
102 // |
102 // |
103 // This table binds QLocale language value to language name string. |
103 // This table binds QLocale language value to language name string. |
104 // |
104 // |
105 const HbLocNameBinding nameBindings[] = |
105 const HbLocNameBinding nameBindings[] = { |
106 { |
|
107 {QLocale::English, HbLangNameEnglish}, |
106 {QLocale::English, HbLangNameEnglish}, |
108 {QLocale::Lithuanian, HbLangNameLithuanian}, |
107 {QLocale::Lithuanian, HbLangNameLithuanian}, |
109 {QLocale::Malay, HbLangNameMalay}, |
108 {QLocale::Malay, HbLangNameMalay}, |
110 {QLocale::Polish, HbLangNamePolish}, |
109 {QLocale::Polish, HbLangNamePolish}, |
111 {QLocale::Portuguese, HbLangNamePortuguese}, |
110 {QLocale::Portuguese, HbLangNamePortuguese}, |