⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 i18n.h

📁 LINUX下发送邮件的库,测试很好用,有各种发送测试的例子
💻 H
字号:
/************************************************************************* *                                                                       * * This program is free software; you can redistribute it and/or modify  * * it under the terms of the GNU General Public License as published by  * * the Free Software Foundation; either version 2 of the License, or     * * (at your option) any later version.                                   * *                                                                       * *************************************************************************/#ifndef _I18N_H__#define _I18N_H__#include "global.h"#include "string.h"#include <locale.h>#include <libintl.h>#include <string>using namespace std;/** * This class provides static methods which can be used * to translate strings into the systems locale using a slightly * advanced technique in contrast to the gettext() method. * Take a look at "man 3 gettext" to get more information * on the gettext function. * * @author Timo Benk <t_benk@web.de> */class I18N{	public:		/**		 * Initialize the i18n subsystem.		 * Will be called by libsmtp++ when the library is loaded 		 * but must be called again if messages that belongs to 		 * another textdomain than "libsmtp++" should be translated.		 *		 * @param textdomain The textdomain that should be added.		 * @param locale_dir The directory that contains the message		 *                   files for this textdomain.		 */		static void init (const string &textdomain, const string &locale_dir);		/**		 * Translates the string msgid.		 * The string msgid will be translated using the		 * glibc gettext() function. Additionally the string		 * can include special substitution characters, which		 * will be substituted with the strings in the array 		 * params.		 * EG: "This is a test arg $0, and this is another one: $1"		 * $0 will be substituted by params[0], $1 will be substituted		 * by params[1], etc.		 *		 * @param textdomain The textdomain that should be used.		 * @param msgid      The msgid that should be translated.		 * @param params     The strings that should be inserted into		 *                   the translated message.		 * @param count      The size of the array params.		 * @returns          The translated string.		 */		static string i18n						( 						 	const string &textdomain, 							const string &msgid, 							string params[], 							unsigned int count 						);		/**		 * The same as the first method, just with only one		 * parameters.		 * Just for your convenience.		 *		 * @param textdomain The textdomain that should be used.		 * @param msgid      The msgid that should be translated.		 * @param param      Substitution string for $0.		 * @returns          The translated string.		 */		static string i18n						(						 	const string &textdomain, 							const string &msgid, 							const string &param 						);		/**		 * The same as the first method, just with only two		 * parameters.		 * Just for your convenience.		 *		 * @param textdomain The textdomain that should be used.		 * @param msgid      The msgid that should be translated.		 * @param param1     Substitution string for $0.		 * @param param2     Substitution string for $1.		 * @returns          The translated string.		 */		static string i18n						( 							const string &textdomain, 							const string &msgid, 							const string &param1, 							const string &param2 						);		/**		 * The same as the first method, just with only three		 * parameters.		 * Just for your convenience.		 *		 * @param textdomain The textdomain that should be used.		 * @param msgid      The msgid that should be translated.		 * @param param1     Substitution string for $0.		 * @param param2     Substitution string for $1.		 * @param param3     Substitution string for $2.		 * @returns          The translated string.		 */		static string i18n						( 							const string &textdomain, 							const string &msgid, 							const string &param1, 							const string &param2, 							const string &param3 						);		/**		 * The same as the first method, just with only four		 * parameters.		 * Just for your convenience.		 *		 * @param textdomain The textdomain that should be used.		 * @param msgid      The msgid that should be translated.		 * @param param1     Substitution string for $0.		 * @param param2     Substitution string for $1.		 * @param param3     Substitution string for $2.		 * @param param4     Substitution string for $3.		 * @returns          The translated string.		 */		static string i18n						(							const string &textdomain, 							const string &msgid, 							const string &param1, 							const string &param2, 							const string &param3, 							const string &param4 						);		/**		 * The same as the first method, just with only five		 * parameters.		 * Just for your convenience.		 *		 * @param textdomain The textdomain that should be used.		 * @param msgid      The msgid that should be translated.		 * @param param1     Substitution string for $0.		 * @param param2     Substitution string for $1.		 * @param param3     Substitution string for $2.		 * @param param4     Substitution string for $3.		 * @param param5     Substitution string for $4.		 * @returns          The translated string.		 */		static string i18n						( 							const string &textdomain, 							const string &msgid, 							const string &param1, 							const string &param2, 							const string &param3, 							const string &param4, 							const string &param5 						);		/**		 * The same as the first method, just with no		 * parameters.		 * Just for your convenience.		 *		 * @param textdomain The textdomain that should be used.		 * @param msgid      The msgid that should be translated.		 * @returns          The translated string.		 */		static string i18n (const string &textdomain, const string &msgid);};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -