1 /***************************************************************************
2 *  mgstring.h
3 *
4 *  Wed Sep  6 22:19:52 2006
5 *  Copyright  2006  liubin,China
6 *  Email multiget@gmail.com
7 ****************************************************************************/
8 
9 /*
10  *  This program is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License as published by
12  *  the Free Software Foundation; either version 2 of the License, or
13  *  (at your option) any later version.
14  *
15  *  This program is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU General Public License for more details.
19  *
20  *  You should have received a copy of the GNU General Public License
21  *  along with this program; if not, write to the Free Software
22  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23  */
24 
25 /*
26 	this file for all string in multiget
27 	I make this file for dynamic language change
28 	I am not sure if wxLocale can do that
29 	so I choose my way
30 */
31 
32 #ifndef _MGSTRING_H
33 #define _MGSTRING_H
34 
35 #include <string>
36 #include <wx/wx.h>
37 #include <wx/string.h>
38 #include "common.h"
39 
40 
41 
42 #define _NOL 	5   //number of language
43 #define _MAXNUM 262 //limit number of string, more than sizeof _MGSTRID
44 
45 enum _MGSTRID {  //every identical string have it's id
46     _S_APP_NAME,
47     _S_APP_DUPRUN,
48     _S_MENU_FILE,
49     _S_MENU_FILE_QUIT,
50     _S_MENU_TASK,
51     _S_MENU_TASK_NEW,
52     _S_MENU_TASK_START,
53     _S_MENU_TASK_PAUSE,
54     _S_MENU_TASK_DELETE,
55     _S_MENU_TASK_MOVEUP,
56     _S_MENU_TASK_MOVEDOWN,
57     _S_MENU_TASK_ADDTHREAD,
58     _S_MENU_TASK_SUBTHREAD,
59     _S_MENU_TASK_RELOAD,
60     _S_MENU_OPTION_CONFIG,
61     _S_MENU_OPTION_PROXYCONFIG,
62     _S_MENU_OPTION,
63     _S_MENU_OPTION_PROPERTY,
64     _S_MENU_HELP,
65     _S_MENU_HELP_ABOUT,
66     _S_FINISH,
67     _S_RUNNINGTASK,
68     _S_FAILEDTASK,
69     _S_FINISHTASK,
70     _S_PAUSETASK,
71     _S_SOFTWARE,
72     _S_PACKET,
73     _S_MUSIC,
74     _S_IMAGE,
75     _S_MOVIE,
76     _S_PUBLISH,
77     _S_PICTURE,
78     _S_UNKNOW,
79     _S_DELETED,
80     _S_FILENAME,
81     _S_SIZE	,
82     _S_PROGRESS,
83     _S_SPEED,
84     _S_LEFTTIME,
85     _S_RETRY,
86     _S_URL,
87     _S_INFORMATION,
88     _S_PIONEER	,
89     _S_FILEINFO,
90     _S_THREAD,
91     _S_DETAIL,
92     _S_VALUE,
93     _S_NAME,
94     _S_TASKID,
95     _S_TASKSTATUS,
96     _S_THREADNUM,
97     _S_AUTOCHECKMD5,
98     _S_ERRORTIME,
99     _S_RUNNING,
100     _S_WAITING,
101     _S_WRONG,
102     _S_SPEEDMODE ,
103     _S_OPTION,
104     _S_VERSION ,
105     _S_CANCEL,
106     _S_OK ,
107     _S_COPYRIGHT,
108     _S_ABOUT_MULTIGET,
109     _S_SYSCONFIG,
110 
111     _S_INFO_JOBRUNNING,
112     _S_INFO_RESOLVING,
113     _S_INFO_SERVERIP,
114     _S_INFO_SENDQUITFAIL,
115     _S_INFO_SENDTYPEAFAIL,
116     _S_INFO_SENDTYPEIFAIL,
117     _S_INFO_SENDRESTFAIL,
118     _S_INFO_INVALIDLINE,
119     _S_INFO_REFUSEUSER,
120     _S_INFO_NOPASSNEED,
121     _S_INFO_INVALIDUSERORPASS,
122     _S_INFO_CTRLCONNECTFAIL ,
123     _S_INFO_CREATEINGSOCKET,
124     _S_INFO_CONNECTFAIL,
125     _S_INFO_CONNECTOK,
126 
127     _S_NEW_CHOOSEPATH,
128     _S_NEW_INPUTTASKINFO,
129     _S_NEW_SAVETO,
130     _S_NEW_URL,
131     _S_NEW_MIRRORURL,
132     _S_NEW_RENAME,
133     _S_NEW_THREADNUM,
134     _S_NEW_RUNNOW,
135     _S_NEW_YES,
136     _S_NEW_NO,
137     _S_NEW_TASK,
138     _S_NEW_BASIC,
139     _S_NEW_PROXY,
140     _S_NEW_LOGIN,
141     _S_NEW_USER,
142     _S_NEW_PASS,
143     _S_NEW_NOSOCKSPROXY,
144     _S_NEW_NOFTPPROXY,
145     _S_NEW_NOHTTPPROXY,
146     _S_NEW_NONE,
147     _S_NEW_RETRY,
148     _S_NEW_RETRYWAIT,
149     _S_NEW_REFER,
150     _S_NEW_REFERADDR,
151 
152     _S_100_TONGJI,
153     _S_INFO_TASKFINISH,
154     _S_INFO_TASKFAIL,
155 
156     _S_INFO_WELCOME,
157     _S_INFO_FILEMOVEFAIL,
158     _S_INFO_TASKSTILLRUNNING,
159     _S_INFO_WARNNING,
160     _S_INFO_NOTSUPPORTURL,
161 
162     _S_TRAY_HIDERESTORE,
163     _S_TRAY_SHOWDROPWIN,
164     _S_TRAY_MONITERCLIP,
165     _S_TRAY_STARTALL,
166     _S_TRAY_STOPALL ,
167     _S_TRAY_NOLIMIT,
168 
169     //2006/08/25
170     _S_TASKLIST_DAY,
171     _S_TASKLIST_TIME,
172     _S_METER_TOPSPEED,
173     _S_ABOUT_ANNOUNCE,
174     _S_MENU_VIEW,
175     _S_MENU_VIEW_LANG,
176     _S_MENU_VIEW_TOOLBAR,
177     _S_MENU_VIEW_TOOLBAR_SIZE16,
178     _S_MENU_VIEW_TOOLBAR_SIZE24,
179     _S_MENU_VIEW_TOOLBAR_SIZE32,
180     _S_MENU_VIEW_STATUSBAR,
181     _S_STATUS_TOTALSPEED,
182     _S_STATUS_RUNNINGTASK,
183     _S_STATUS_WAITINGTASK,
184 
185     _S_PROXYDLG_ADMIN,
186     _S_PROXYDLG_ADDPROXY,
187     _S_PROXYDLG_DELPROXY,
188     _S_PROXYDLG_NAME,
189     _S_PROXYDLG_TYPE,
190     _S_PROXYDLG_SERVER,
191     _S_PROXYDLG_PORT,
192     _S_PROXYDLG_USER,
193     _S_PROXYDLG_PASS,
194 
195     _S_ADDPROXYDLG_PROXYNAME,
196     _S_ADDPROXYDLG_PROXYARGS,
197     _S_ADDPROXYDLG_SERVER,
198     _S_ADDPROXYDLG_PORT,
199     _S_ADDPROXYDLG_USER,
200     _S_ADDPROXYDLG_PASS,
201     _S_ADDPROXYDLG_PROXYTYPE,
202 
203     _S_MAINFRAME_DELETESELECT,
204     _S_MAINFRAME_DELETEWARNNING,
205 
206     _S_ABOUT_BUGREPORT,
207     _S_ABOUT_MAINPUBLISH,
208 
209     _S_DETAIL_SAVEPATH,
210     _S_DETAIL_SOCKSPROXY,
211     _S_DETAIL_FTPPROXY,
212     _S_DETAIL_HTTPPROXY,
213     _S_DETAIL_MD5,
214     _S_DETAIL_PAUSE,
215 	_S_DETAIL_NOM, //number of mirror
216     _S_LOG,
217     _S_MAINFRAME_RELOADWARNNING,
218     _S_MAINFRAME_RELOADDELETE,
219 
220     _S_CONFIGWIN_TASKARGS,
221     _S_CONFIGWIN_MAXRUNTASK,
222     _S_CONFIGWIN_DEFTHREAD,
223     _S_CONFIGWIN_DEFSAVEPATH,
224     _S_CONFIGWIN_NETARGS,
225     _S_CONFIGWIN_CONNECTTIMEOUT,
226     _S_CONFIGWIN_RWTIMEOUT,
227     _S_CONFIGWIN_MAXRETRY,
228     _S_CONFIGWIN_WAITRETRY,
229     _S_CONFIGWIN_OTHER,
230     _S_CONFIGWIN_ANONPASS,
231     _S_CONFIGWIN_SPEEDLIMIT,
232     _S_CONFIGWIN_NOLIMIT,
233     _S_CONFIGWIN_CLIPMONI,
234     _S_CONFIGWIN_IGNOREEXT,
235     _S_CONFIGWIN_ONLYEXT,
236     _S_CONFIGWIN_SOUND,
237     _S_CONFIGWIN_AUTOMD5,
238     _S_TIP_NEWTASK,
239     _S_TIP_RUNTASK,
240     _S_TIP_STOPTASK,
241     _S_TIP_DELETETASK,
242     _S_TIP_MOVEUPTASK,
243     _S_TIP_MOVEDOWNTASK,
244     _S_TIP_ADDTASKTHREAD,
245     _S_TIP_SUBTASKTHREAD,
246     _S_TIP_RELOADTASK,
247     _S_TIP_SYSCONFIG,
248     _S_TIP_PROXYADMIN,
249     _S_TIP_PROPERTY,
250 
251     _S_FILEMGR_TASKOBJ,
252     _S_FILEMGR_GETTEMPDIR,
253     _S_FILEMGR_TEMPDIR,
254     _S_FILEMGR_TEMPNAME,
255     _S_FILEMGR_INDEXNAME,
256     _S_FILEMGR_CHECKTEMP,
257     _S_FILEMGR_TEMPEXIST,
258     _S_FILEMGR_TEMPNOTEXIST,
259     _S_FILEMGR_CHECKINDEX,
260     _S_FILEMGR_INDEXEXIST,
261     _S_FILEMGR_INDEXNOTEXIST,
262     _S_FILEMGR_CHECKTEMPLENGTH,
263     _S_FILEMGR_LENGTHOK,
264     _S_FILEMGR_LENGTHFAIL,
265     _S_FILEMGR_CREATEFILE,
266     _S_FILEMGR_CREATOK,
267     _S_FILEMGR_REDIRECT,
268     _S_FILEMGR_URLOK,
269     _S_FILEMGR_URLTEMPFAIL,
270     _S_FILEMGR_URLFAIL,
271     _S_FILEMGR_NOTASK,
272     _S_FILEMGR_DATAOVERLOAD,
273     _S_FILEMGR_FILELENCONFIRM,
274     _S_FILEMGR_ERRORCLOSESOCK,
275     _S_FILEMGR_ENDFILELEN,
276 
277     _S_PROPERTYDLG_TITLE,
278 
279 	_S_SINGLETASK_JOBRUN,
280 	_S_SINGLETASK_ANALYSISURL,
281 	_S_SINGLETASK_NOTSUPPORTURL,
282 	_S_SINGLETASK_TASKURLOK,
283 	_S_SINGLETASK_URLISFTP,//"main url is ftp protocol"
284 	_S_SINGLETASK_USESOCKSPROXY,//"task will use socks proxy"
285 	_S_SINGLETASK_USEFTPPROXY,
286 	_S_SINGLETASK_USEHTTPPROXY,
287 	_S_SINGLETASK_GETFILEINFOERROR,
288 	_S_SINGLETASK_NOFILELENGTH,
289 	_S_SINGLETASK_NOTSUPPORTRESUME,
290 	_S_SINGLETASK_URLISHTTP,//"main url is http protocol"
291 
292 	_S_ANTS_CONNECTING,
293 	_S_ANTS_CONNECTFAIL,
294 	_S_ANTS_LOGINFAIL,
295 	_S_ANTS_ENTERPASVFAIL,
296 	_S_ANTS_DATACONNFAIL, //"data connection error."
297 	_S_ANTS_DATACONNOK,
298 	_S_ANTS_BINARYFAIL,//"enter binary mode fail"
299 	_S_ANTS_SETRESUMEFAIL, //"can't set resume point"
300 	_S_ANTS_FAILTOGETFILE, //"fail to get file."
301 	_S_ANTS_RECVFILEDATA, //"receiving file data from %lld ..."
302 	_S_ANTS_FINISHNORMAL, //"finish task piece normal, quit."
303 	_S_ANTS_WRITEERROR, //"Write file error."
304 	_S_ANTS_NETERROR, //"network error"
305 	_S_ANTS_CHANGEURL, //"change a url"
306 	_S_ANTS_WAITTORETRY, //"Wait %d seconds retry ..."
307 	_S_ANTS_NORETRY,
308 
309 	_S_THANKS_LANGUE,
310 	_S_THANKS_GUOHONGTAO,
311 	_S_THANKS_ABEL,
312 	_S_THANKS_CJACKER,
313 	_S_THANKS_MATTHE,
314 	_S_THANKS_ISJFK,
315 	_S_THANKS_BRYAN,
316 	_S_THANKS_MICHAEL_FRASE,
317 	_S_MENU_FILE_SAVECONFIG,
318 	_S_MENU_FILE_SAVETASK,
319 	_S_MENU_FILE_SAVEPROXY,
320 	_S_MENU_HELP_VISITHOME,
321 };
322 
323 
324 class CMgString
325 {
326 
327 public:
328     CMgString();
329     void SetLang( _MGLANG lang );
330     _MGLANG GetLang();
331 
332     std::string GetStr( _MGSTRID id );
333     wxString GetWxStr( _MGSTRID id );
334 
335 private:
336 
337     _MGLANG m_Lang;
338 
339     std::string m_SA[ _NOL ][ _MAXNUM ];
340 };
341 
342 #endif
343