New upstream version 0.3.7
Boyuan Yang
4 years ago
2 | 2 | # This file is distributed under the same license as the PACKAGE package. |
3 | 3 | # |
4 | 4 | # Translators: |
5 | # Robert Antoni Buj Gelonch <rbuj@fedoraproject.org>, 2017-2018 | |
5 | 6 | # Walter Garcia-Fontes <walter.garcia@upf.edu>, 2016 |
6 | 7 | msgid "" |
7 | 8 | msgstr "" |
8 | 9 | "Project-Id-Version: fcitx\n" |
9 | 10 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" |
10 | "POT-Creation-Date: 2017-09-14 16:02-0700\n" | |
11 | "PO-Revision-Date: 2017-08-03 16:57+0000\n" | |
12 | "Last-Translator: Walter Garcia-Fontes <walter.garcia@upf.edu>\n" | |
11 | "POT-Creation-Date: 2019-11-03 12:27-0800\n" | |
12 | "PO-Revision-Date: 2018-06-13 07:07+0000\n" | |
13 | "Last-Translator: Robert Antoni Buj Gelonch <rbuj@fedoraproject.org>\n" | |
13 | 14 | "Language-Team: Catalan (http://www.transifex.com/fcitx/fcitx/language/ca/)\n" |
14 | 15 | "Language: ca\n" |
15 | 16 | "MIME-Version: 1.0\n" |
17 | 18 | "Content-Transfer-Encoding: 8bit\n" |
18 | 19 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" |
19 | 20 | |
20 | #: src/cloudpinyin.c:684 | |
21 | #: src/cloudpinyin.c:685 | |
21 | 22 | msgid " (via cloud)" |
22 | 23 | msgstr "(via el núvol)" |
23 | 24 | |
24 | 25 | #: src/fcitx-cloudpinyin.conf.in:4 |
25 | 26 | msgid "Add Cloud Pinyin Support to Pinyin Input Method" |
26 | msgstr "Afegeix suport de pinyin de núvol al mètode d'entrada pinying" | |
27 | msgstr "" | |
28 | "Afegeix la compatibilitat amb pinyin al núvol al mètode d'entrada pinying" | |
27 | 29 | |
28 | 30 | #: src/fcitx-cloudpinyin.desc:24 |
29 | 31 | msgid "Baidu" |
30 | 32 | msgstr "Baidu" |
31 | 33 | |
32 | #: src/cloudpinyin.c:619 src/fcitx-cloudpinyin.conf.in:3 | |
34 | #: src/cloudpinyin.c:620 src/fcitx-cloudpinyin.conf.in:3 | |
33 | 35 | msgid "Cloud Pinyin" |
34 | msgstr "Pinyin de núvol" | |
36 | msgstr "Pinyin al núvol" | |
35 | 37 | |
36 | 38 | #: src/fcitx-cloudpinyin.desc:5 |
37 | 39 | msgid "Cloud Pinyin Candidate Word Order" |
38 | msgstr "Ordre de paraules candidates del pinyin de núvol" | |
40 | msgstr "Ordre de les paraules candidates del pinyin al núvol" | |
39 | 41 | |
40 | 42 | #: src/fcitx-cloudpinyin.desc:21 |
41 | 43 | msgid "Cloud Pinyin Source" |
42 | msgstr "Font de pinyin de núvol" | |
44 | msgstr "Origen de pinyin al núvol" | |
45 | ||
46 | #: src/cloudpinyin.c:622 | |
47 | msgid "Cloud Pinyin is Disabled." | |
48 | msgstr "El pinyin al núvol està inhabilitat" | |
43 | 49 | |
44 | 50 | #: src/cloudpinyin.c:621 |
45 | msgid "Cloud Pinyin is Disabled." | |
46 | msgstr "El pinyin de núvol està desactivat" | |
47 | ||
48 | #: src/cloudpinyin.c:620 | |
49 | 51 | msgid "Cloud Pinyin is Enabled." |
50 | msgstr "El pinyin de núvol està activat." | |
52 | msgstr "El pinyin al núvol està habilitat." | |
51 | 53 | |
52 | 54 | #: src/fcitx-cloudpinyin.desc:1 src/fcitx-cloudpinyin.desc:7 |
53 | 55 | #: src/fcitx-cloudpinyin.desc:13 src/fcitx-cloudpinyin.desc:18 |
54 | 56 | #: src/fcitx-cloudpinyin.desc:26 src/fcitx-cloudpinyin.desc:32 |
55 | 57 | msgid "CloudPinyin" |
56 | msgstr "PinyinNúvol" | |
58 | msgstr "Pinyin al núvol" | |
57 | 59 | |
58 | 60 | #: src/fcitx-cloudpinyin.desc:30 |
59 | 61 | msgid "Disable Cloud Pinyin When you are using mobile can save your network" |
60 | 62 | msgstr "" |
61 | "Desactivar el pinyin de núvol quan esteu usant dades mòbil pot estalviar la " | |
63 | "Inhabilitar pinyin al núvol quan esteu utilitzant el mòbil pot estalviar la " | |
62 | 64 | "vostra xarxa" |
63 | 65 | |
64 | 66 | #: src/fcitx-cloudpinyin.desc:16 |
65 | 67 | msgid "Don't Show the 'via cloud' hint" |
66 | msgstr "No mostris la pista «via núvol»" | |
68 | msgstr "No mostris els suggerents «via núvol»" | |
67 | 69 | |
68 | 70 | #: src/fcitx-cloudpinyin.desc:35 |
69 | 71 | msgid "Enabled" |
70 | msgstr "Activat" | |
72 | msgstr "Habilitat" | |
71 | 73 | |
72 | 74 | #: src/fcitx-cloudpinyin.desc:23 |
73 | 75 | msgid "Google" |
75 | 77 | |
76 | 78 | #: src/fcitx-cloudpinyin.desc:11 |
77 | 79 | msgid "Minimum Length of Pinyin To Trigger Cloud Pinyin" |
78 | msgstr "Longitud mínima de pinyin per activar pinyin de núvol" | |
80 | msgstr "Longitud mínima de pinyin per activar pinyin al núvol" | |
79 | 81 | |
80 | 82 | #: src/fcitx-cloudpinyin.desc:29 |
81 | 83 | msgid "Toggle Cloud Pinyin enabled status" |
82 | msgstr "Commuta l'estat d'activació del pinyin de núvol" | |
84 | msgstr "Commuta l'estat d'activació del pinyin al núvol" |
2 | 2 | # This file is distributed under the same license as the PACKAGE package. |
3 | 3 | # |
4 | 4 | # Translators: |
5 | # TotalCaesar659 <x24cm5b8c54q6szxw@yandex.ru>, 2016 | |
5 | # TotalCaesar659 <x24cm5b8c54q6szxw@yandex.ru>, 2016-2017 | |
6 | 6 | msgid "" |
7 | 7 | msgstr "" |
8 | 8 | "Project-Id-Version: fcitx\n" |
9 | 9 | "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" |
10 | "POT-Creation-Date: 2017-09-14 16:02-0700\n" | |
11 | "PO-Revision-Date: 2017-08-03 16:57+0000\n" | |
10 | "POT-Creation-Date: 2017-11-28 00:03-0800\n" | |
11 | "PO-Revision-Date: 2017-11-27 15:15+0000\n" | |
12 | 12 | "Last-Translator: TotalCaesar659 <x24cm5b8c54q6szxw@yandex.ru>\n" |
13 | 13 | "Language-Team: Russian (http://www.transifex.com/fcitx/fcitx/language/ru/)\n" |
14 | 14 | "Language: ru\n" |
19 | 19 | "%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n" |
20 | 20 | "%100>=11 && n%100<=14)? 2 : 3);\n" |
21 | 21 | |
22 | #: src/cloudpinyin.c:684 | |
22 | #: src/cloudpinyin.c:685 | |
23 | 23 | msgid " (via cloud)" |
24 | 24 | msgstr "(через облако)" |
25 | 25 | |
26 | 26 | #: src/fcitx-cloudpinyin.conf.in:4 |
27 | 27 | msgid "Add Cloud Pinyin Support to Pinyin Input Method" |
28 | msgstr "Добавить поддержку облака пиньинь для метода ввода пиньинь" | |
28 | msgstr "Добавить поддержку Cloud Pinyin для метода ввода пиньинь" | |
29 | 29 | |
30 | 30 | #: src/fcitx-cloudpinyin.desc:24 |
31 | 31 | msgid "Baidu" |
32 | 32 | msgstr "Baidu" |
33 | 33 | |
34 | #: src/cloudpinyin.c:619 src/fcitx-cloudpinyin.conf.in:3 | |
34 | #: src/cloudpinyin.c:620 src/fcitx-cloudpinyin.conf.in:3 | |
35 | 35 | msgid "Cloud Pinyin" |
36 | msgstr "Облако пиньинь" | |
36 | msgstr "Cloud Pinyin" | |
37 | 37 | |
38 | 38 | #: src/fcitx-cloudpinyin.desc:5 |
39 | 39 | msgid "Cloud Pinyin Candidate Word Order" |
40 | msgstr "Порядок слов-кандидатов облака пиньинь" | |
40 | msgstr "Порядок слов-кандидатов Cloud Pinyin" | |
41 | 41 | |
42 | 42 | #: src/fcitx-cloudpinyin.desc:21 |
43 | 43 | msgid "Cloud Pinyin Source" |
44 | 44 | msgstr "Источник облака пиньинь" |
45 | 45 | |
46 | #: src/cloudpinyin.c:622 | |
47 | msgid "Cloud Pinyin is Disabled." | |
48 | msgstr "Cloud Pinyin отключен." | |
49 | ||
46 | 50 | #: src/cloudpinyin.c:621 |
47 | msgid "Cloud Pinyin is Disabled." | |
48 | msgstr "Облако пиньинь отключено." | |
49 | ||
50 | #: src/cloudpinyin.c:620 | |
51 | 51 | msgid "Cloud Pinyin is Enabled." |
52 | msgstr "Облако пиньинь включено." | |
52 | msgstr "Cloud Pinyin включен." | |
53 | 53 | |
54 | 54 | #: src/fcitx-cloudpinyin.desc:1 src/fcitx-cloudpinyin.desc:7 |
55 | 55 | #: src/fcitx-cloudpinyin.desc:13 src/fcitx-cloudpinyin.desc:18 |
689 | 689 | } |
690 | 690 | |
691 | 691 | #define LOADING_TIME_QUICK_THRESHOLD 300 |
692 | #define DUP_PLACE_HOLDER "\xe2\x98\xba" | |
692 | #define DUP_PLACE_HOLDER "\xe2\x98\x81" | |
693 | 693 | |
694 | 694 | void CloudPinyinFillCandidateWord(FcitxCloudPinyin* cloudpinyin, |
695 | 695 | const char* pinyin) |
7 | 7 | #include <ctype.h> |
8 | 8 | #include "cloudpinyin.h" |
9 | 9 | |
10 | static inline boolean ishex(char ch) | |
11 | { | |
12 | if ((ch >= '0' && ch <= '9') || (ch >='a' && ch <='f') || (ch >='A' && ch <='F')) | |
13 | return true; | |
14 | return false; | |
15 | } | |
16 | ||
17 | static inline unsigned char tohex(char ch) | |
18 | { | |
19 | if (ch >= '0' && ch <= '9') | |
20 | return ch - '0'; | |
21 | if (ch >='a' && ch <='f') | |
22 | return ch - 'a' + 10; | |
23 | if (ch >='A' && ch <='F') | |
24 | return ch - 'A' + 10; | |
25 | return 0; | |
26 | } | |
27 | ||
28 | void SogouParseKey(FcitxCloudPinyin* cloudpinyin, CurlQueue* queue) | |
29 | { | |
30 | char* str = fcitx_utils_trim(queue->str); | |
31 | const char* ime_patch_key = "ime_patch_key = \""; | |
32 | size_t len = strlen(str); | |
33 | if (len == SOGOU_KEY_LENGTH + strlen(ime_patch_key) + 1 | |
34 | && strncmp(str, ime_patch_key, strlen(ime_patch_key)) == 0 | |
35 | && str[len - 1] == '\"') { | |
36 | sscanf(str,"ime_patch_key = \"%s\"", cloudpinyin->key); | |
37 | cloudpinyin->initialized = true; | |
38 | cloudpinyin->key[SOGOU_KEY_LENGTH] = '\0'; | |
39 | } | |
40 | ||
41 | free(str); | |
42 | } | |
43 | ||
44 | char* MapSogouStringToHalf(const char* string) | |
45 | { | |
46 | const char* s = string; | |
47 | const char* sn; | |
48 | size_t len = strlen(string); | |
49 | char* half = fcitx_utils_malloc0(sizeof(char) * (len + 1)); | |
50 | char* halfp = half; | |
51 | int upperCount = 0; | |
52 | ||
53 | while (*s) { | |
54 | unsigned int chr = 0; | |
55 | ||
56 | sn = fcitx_utf8_get_char(s, &chr); | |
57 | ||
58 | /* from A to Z */ | |
59 | if ((chr >= 0xff21 && chr <= 0xff3a) || (chr >= 0xff41 && chr <= 0xff5a)) { | |
60 | *halfp = (char) (chr & 0xff) + 0x20; | |
61 | if (isupper(*halfp)) | |
62 | upperCount ++; | |
63 | halfp ++; | |
64 | } | |
65 | else { | |
66 | while(s < sn) { | |
67 | *halfp = *s; | |
68 | if (isupper(*halfp)) | |
69 | upperCount ++; | |
70 | s++; | |
71 | halfp++; | |
72 | } | |
73 | } | |
74 | ||
75 | s = sn; | |
76 | } | |
77 | if (*half && isupper(*half) && upperCount == 1) { | |
78 | *half = tolower(*half); | |
79 | } | |
80 | return half; | |
81 | } | |
82 | ||
83 | char* SogouParsePinyin(FcitxCloudPinyin* cloudpinyin, CurlQueue* queue) | |
84 | { | |
85 | char *start = NULL, *end = NULL; | |
86 | if ((start = strchr(queue->str, '"')) != NULL && (end = strstr(queue->str, "%EF%BC%9A")) != NULL) | |
87 | { | |
88 | start ++; | |
89 | if (start < end) | |
90 | { | |
91 | size_t length = end - start; | |
92 | int conv_length; | |
93 | char *unescapedstring = curl_easy_unescape(queue->curl, start, length, &conv_length); | |
94 | char *realstring = MapSogouStringToHalf(unescapedstring); | |
95 | curl_free(unescapedstring); | |
96 | return realstring; | |
97 | } | |
98 | } | |
99 | return NULL; | |
100 | } | |
101 | ||
102 | void QQParseKey(FcitxCloudPinyin* cloudpinyin, CurlQueue* queue) | |
103 | { | |
104 | char* str = fcitx_utils_trim(queue->str); | |
105 | const char* ime_patch_key = "{\"key\":\""; | |
106 | if (strncmp(str, ime_patch_key, strlen(ime_patch_key)) == 0) | |
107 | { | |
108 | if (sscanf(str,"{\"key\":\"%32s\",\"ret\":\"suc\"}", cloudpinyin->key) > 0) | |
109 | { | |
110 | cloudpinyin->initialized = true; | |
111 | cloudpinyin->key[QQ_KEY_LENGTH] = '\0'; | |
112 | } | |
113 | } | |
114 | ||
115 | free(str); | |
116 | } | |
117 | ||
118 | char* QQParsePinyin(FcitxCloudPinyin* cloudpinyin, CurlQueue* queue) | |
119 | { | |
120 | char *start = NULL, *end = NULL; | |
121 | if ((start = strstr(queue->str, "\"rs\":[\"")) != NULL) | |
122 | { | |
123 | start += strlen( "\"rs\":[\""); | |
124 | if ((end = strstr(start, "\"")) != NULL) | |
125 | { | |
126 | size_t length = end - start; | |
127 | char *realstring = fcitx_utils_malloc0(sizeof(char) * (length + 1)); | |
128 | strncpy(realstring, start, length); | |
129 | realstring[length] = '\0'; | |
130 | return realstring; | |
131 | } | |
132 | } | |
133 | return NULL; | |
134 | } | |
135 | ||
136 | 10 | char* GoogleParsePinyin(FcitxCloudPinyin* cloudpinyin, CurlQueue* queue) |
137 | 11 | { |
138 | 12 | char *start = NULL, *end = NULL; |
13 | if (!queue->str) { | |
14 | return NULL; | |
15 | } | |
139 | 16 | if ((start = strstr(queue->str, "\",[\"")) != NULL) |
140 | 17 | { |
141 | 18 | start += strlen( "\",[\""); |
145 | 22 | char *realstring = fcitx_utils_malloc0(sizeof(char) * (length + 1)); |
146 | 23 | strncpy(realstring, start, length); |
147 | 24 | realstring[length] = '\0'; |
148 | return realstring; | |
25 | if (fcitx_utf8_check_string(realstring)) { | |
26 | return realstring; | |
27 | } else { | |
28 | free(realstring); | |
29 | return NULL; | |
30 | } | |
149 | 31 | } |
150 | 32 | } |
151 | 33 | return NULL; |
154 | 36 | char* BaiduParsePinyin(FcitxCloudPinyin* cloudpinyin, CurlQueue* queue) |
155 | 37 | { |
156 | 38 | char *start = NULL, *end = NULL; |
157 | static iconv_t conv = 0; | |
158 | if (conv == 0) | |
159 | conv = iconv_open("utf-8", "utf-16be"); | |
160 | ||
161 | if (conv == (iconv_t)(-1)) | |
39 | if (!queue->str) { | |
162 | 40 | return NULL; |
163 | if ((start = strstr(queue->str, "[[[\"")) != NULL) | |
41 | } | |
42 | if ((start = strstr(queue->str, "[[\"")) != NULL) | |
164 | 43 | { |
165 | start += strlen( "[[[\""); | |
44 | start += strlen( "[[\""); | |
166 | 45 | if ((end = strstr(start, "\",")) != NULL) |
167 | 46 | { |
168 | 47 | size_t length = end - start; |
169 | if (length % 6 != 0 || length == 0) | |
170 | return NULL; | |
171 | ||
172 | size_t i = 0, j = 0; | |
173 | char* buf = fcitx_utils_malloc0((length / 6 + 1) * 2); | |
174 | while (i < length) | |
175 | { | |
176 | if (start[i] == '\\' && start[i+1] == 'u') | |
177 | { | |
178 | if (ishex(start[i+2]) && ishex(start[i+3]) && ishex(start[i+4]) && ishex(start[i+5])) | |
179 | { | |
180 | buf[j++] = (tohex(start[i+2]) << 4) | tohex(start[i+3]); | |
181 | buf[j++] = (tohex(start[i+4]) << 4) | tohex(start[i+5]); | |
182 | } | |
183 | else | |
184 | break; | |
185 | } | |
186 | ||
187 | i += 6; | |
188 | } | |
189 | ||
190 | if (i != length) | |
191 | { | |
192 | free(buf); | |
193 | return NULL; | |
194 | } | |
195 | buf[j++] = 0; | |
196 | buf[j++] = 0; | |
197 | size_t len = UTF8_MAX_LENGTH * (length / 6) * sizeof(char); | |
198 | char* realstring = fcitx_utils_malloc0(UTF8_MAX_LENGTH * (length / 6) * sizeof(char)); | |
199 | IconvStr p = buf; char *pp = realstring; | |
200 | iconv(conv, &p, &j, &pp, &len); | |
201 | ||
202 | free(buf); | |
203 | if (fcitx_utf8_check_string(realstring)) | |
48 | char *realstring = fcitx_utils_malloc0(sizeof(char) * (length + 1)); | |
49 | strncpy(realstring, start, length); | |
50 | realstring[length] = '\0'; | |
51 | if (fcitx_utf8_check_string(realstring)) { | |
204 | 52 | return realstring; |
205 | else | |
206 | { | |
53 | } else { | |
207 | 54 | free(realstring); |
208 | 55 | return NULL; |
209 | 56 | } |
0 | include_directories( | |
1 | ${PROJECT_SOURCE_DIR}/src | |
2 | ${PROJECT_BINARY_DIR} | |
3 | ${CMAKE_CURRENT_SOURCE_DIR} | |
4 | ${CURL_INCLUDE_DIRS} | |
5 | ${FCITX4_FCITX_INCLUDE_DIRS} | |
6 | ${FCITX4_FCITX_CONFIG_INCLUDE_DIRS} | |
7 | ${FCITX4_FCITX_UTILS_INCLUDE_DIRS} | |
8 | ${LIBINTL_INCLUDE_DIR} | |
9 | ${PTHREAD_INCLUDE_DIR} | |
10 | ) | |
11 | ||
12 | link_directories( | |
13 | ${CURL_LIBRARY_DIRS} | |
14 | ${FCITX4_FCITX_UTILS_LIBRARY_DIRS} | |
15 | ) | |
16 | ||
17 | add_executable(testhalf testhalf.c ../src/parse.c) | |
18 | ||
19 | target_link_libraries( testhalf | |
20 | ${PTHREAD_LIBRARIES} | |
21 | ${FCITX4_FCITX_UTILS_LIBRARIES} | |
22 | ${CURL_LIBRARIES} | |
23 | ${LIBINTL_LIBRARIES} | |
24 | ) | |
25 | ||
26 | add_test(testhalf testhalf)⏎ |
0 | #include "parse.h" | |
1 | ||
2 | #include <assert.h> | |
3 | ||
4 | int main(int argc, char* argv[]) | |
5 | { | |
6 | char* result = MapSogouStringToHalf("ABCD"); | |
7 | printf("%s\n", result); | |
8 | assert(strcmp(result, "ABCD") == 0); | |
9 | ||
10 | free(result); | |
11 | ||
12 | result = MapSogouStringToHalf("我a测b你CD的"); | |
13 | printf("%s\n", result); | |
14 | assert(strcmp(result, "我a测b你CD的") == 0); | |
15 | ||
16 | free(result); | |
17 | return 0; | |
18 | } |