summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/extern.h4
-rw-r--r--include/language.h202
-rw-r--r--include/services.h1
-rwxr-xr-xlanguage/update.sh2
-rw-r--r--modules/core/cs_suspend.cpp2
-rw-r--r--modules/core/ms_main.cpp6
-rw-r--r--modules/core/ms_read.cpp2
-rw-r--r--modules/core/ns_resetpass.cpp6
-rw-r--r--modules/core/ns_sendpass.cpp6
-rw-r--r--modules/extra/os_defcon.cpp4
-rw-r--r--src/botserv.cpp6
-rw-r--r--src/language.cpp2
-rw-r--r--src/misc.cpp45
-rw-r--r--src/regchannel.cpp4
14 files changed, 147 insertions, 145 deletions
diff --git a/include/extern.h b/include/extern.h
index 97bc39d5a..8aa5428a7 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -158,9 +158,9 @@ E int toupper(char);
E int tolower(char);
E time_t dotime(const Anope::string &s);
-E Anope::string duration(time_t seconds);
+E Anope::string duration(const time_t &seconds, NickCore *nc = NULL);
E Anope::string expire_left(NickCore *nc, time_t expires);
-E Anope::string do_strftime(const time_t &t);
+E Anope::string do_strftime(const time_t &t, NickCore *nc = NULL, bool short_output = false);
E bool doValidHost(const Anope::string &host, int type);
E bool isValidHost(const Anope::string &host, int type);
diff --git a/include/language.h b/include/language.h
index 8afd360de..e8d69aaf0 100644
--- a/include/language.h
+++ b/include/language.h
@@ -6,105 +6,107 @@
* Please read COPYING and README for further details.
*/
-#define MORE_INFO "\002%s%s HELP %s\002 for more information."
-#define BAD_USERHOST_MASK "Mask must be in the form \037user\037@\037host\037."
-#define BAD_EXPIRY_TIME "Invalid expiry time."
-#define USERHOST_MASK_TOO_WIDE "%s coverage is too wide; Please use a more specific mask."
-#define READ_ONLY_MODE "Services are in read-only mode!"
-#define PASSWORD_INCORRECT "Password incorrect."
-#define ACCESS_DENIED "Access denied."
-#define MORE_OBSCURE_PASSWORD "Please try again with a more obscure password. Passwords should be at least five characters long, should not be something easily guessed (e.g. your real name or your nick), and cannot contain the space or tab characters."
-#define PASSWORD_TOO_LONG "Your password is too long. Please try again with a shorter password."
-#define NICK_NOT_REGISTERED "Your nick isn't registered."
-#define NICK_X_NOT_REGISTERED "Nick \002%s\002 isn't registered."
-#define NICK_X_NOT_IN_USE "Nick \002%s\002 isn't currently in use."
-#define NICK_X_NOT_ON_CHAN "\002%s\002 is not currently on channel %s."
-#define NICK_X_SUSPENDED "Nick %s is currently suspended."
-#define CHAN_X_SUSPENDED "Channel %s is currently suspended."
-#define CHAN_X_NOT_REGISTERED "Channel \002%s\002 isn't registered."
-#define CHAN_X_NOT_IN_USE "Channel \002%s\002 doesn't exist."
-#define NICK_IDENTIFY_REQUIRED "Password authentication required for that command.\n" \
- "Retry after typing \002%s%s IDENTIFY \037password\037\002."
-#define MAIL_X_INVALID "\002%s\002 is not a valid e-mail address."
-#define NO_REASON "No reason"
-#define UNKNOWN "<unknown>"
-#define NO_EXPIRE "does not expire"
-#define END_OF_ANY_LIST "End of \002%s\002 list."
-#define LIST_INCORRECT_RANGE "Incorrect range specified. The correct syntax is \002#\037from\037-\037to\037\002."
-#define UNKNOWN_OPTION "Unknown option \002%s\002.\n" \
- "Type %s%s HELP %s for more information."
-#define NICK_IS_REGISTERED "This nick is owned by someone else. Please choose another.\n" \
- "(If this is your nick, type \002%s%s IDENTIFY \037password\037\002.)"
-#define NICK_IS_SECURE "This nickname is registered and protected. If it is your\n" \
+#define MORE_INFO gtl("\002%s%s HELP %s\002 for more information.")
+#define BAD_USERHOST_MASK gtl("Mask must be in the form \037user\037@\037host\037.")
+#define BAD_EXPIRY_TIME gtl("Invalid expiry time.")
+#define USERHOST_MASK_TOO_WIDE gtl("%s coverage is too wide; Please use a more specific mask.")
+#define READ_ONLY_MODE gtl("Services are in read-only mode!")
+#define PASSWORD_INCORRECT gtl("Password incorrect.")
+#define ACCESS_DENIED gtl("Access denied.")
+#define MORE_OBSCURE_PASSWORD gtl("Please try again with a more obscure password. Passwords should be at least\n \
+ five characters long, should not be something easily guessed\n \
+ (e.g. your real name or your nick), and cannot contain the space or tab characters.")
+#define PASSWORD_TOO_LONG gtl("Your password is too long. Please try again with a shorter password.")
+#define NICK_NOT_REGISTERED gtl("Your nick isn't registered.")
+#define NICK_X_NOT_REGISTERED gtl("Nick \002%s\002 isn't registered.")
+#define NICK_X_NOT_IN_USE gtl("Nick \002%s\002 isn't currently in use.")
+#define NICK_X_NOT_ON_CHAN gtl("\002%s\002 is not currently on channel %s.")
+#define NICK_X_SUSPENDED gtl("Nick %s is currently suspended.")
+#define CHAN_X_SUSPENDED gtl("Channel %s is currently suspended.")
+#define CHAN_X_NOT_REGISTERED gtl("Channel \002%s\002 isn't registered.")
+#define CHAN_X_NOT_IN_USE gtl("Channel \002%s\002 doesn't exist.")
+#define NICK_IDENTIFY_REQUIRED gtl("Password authentication required for that command.\n" \
+ "Retry after typing \002%s%s IDENTIFY \037password\037\002.")
+#define MAIL_X_INVALID gtl("\002%s\002 is not a valid e-mail address.")
+#define NO_REASON gtl("No reason")
+#define UNKNOWN gtl("<unknown>")
+#define NO_EXPIRE gtl("does not expire")
+#define END_OF_ANY_LIST gtl("End of \002%s\002 list.")
+#define LIST_INCORRECT_RANGE gtl("Incorrect range specified. The correct syntax is \002#\037from\037-\037to\037\002.")
+#define UNKNOWN_OPTION gtl("Unknown option \002%s\002.\n" \
+ "Type %s%s HELP %s for more information.")
+#define NICK_IS_REGISTERED gtl("This nick is owned by someone else. Please choose another.\n" \
+ "(If this is your nick, type \002%s%s IDENTIFY \037password\037\002.)")
+#define NICK_IS_SECURE gtl("This nickname is registered and protected. If it is your\n" \
"nick, type \002%s%s IDENTIFY \037password\037\002. Otherwise,\n" \
- "please choose a different nick."
-#define FORCENICKCHANGE_NOW "This nickname has been registered; you may not use it."
-#define NICK_CANNOT_BE_REGISTERED "Nickname \002%s\002 may not be registered."
-#define NICK_ALREADY_REGISTERED "Nickname \002%s\002 is already registered!"
-#define NICK_SET_SYNTAX "SET \037option\037 \037parameters\037"
-#define NICK_SET_DISABLED "Sorry, nickname option setting is temporarily disabled."
-#define NICK_SET_UNKNOWN_OPTION "Unknown SET option \002%s%s\002."
-#define NICK_SET_DISPLAY_CHANGED "The new display is now \002%s\002."
-#define NICK_SASET_SYNTAX "SASET \037nickname\037 \037option\037 \037parameters\037"
-#define NICK_SASET_DISPLAY_INVALID "The new display for \002%s\002 MUST be a nickname of the nickname group!"
-#define NICK_SASET_PASSWORD_FAILED "Sorry, couldn't change password for \002%s\002."
-#define NICK_SASET_PASSWORD_CHANGED "Password for \002%s\002 changed."
-#define NICK_SASET_PASSWORD_CHANGED_TO "Password for \002%s\002 changed to \002%s\002."
-#define NICK_INFO_OPTIONS " Options: %s"
-#define NICK_LIST_SYNTAX "LIST \037pattern\037"
-#define LIST_HEADER "List of entries matching \002%s\002:"
-#define NICK_RECOVERED "User claiming your nick has been killed.\n" \
- "\002%s%s RELEASE %s\002 to get it back before %s timeout."
-#define NICK_REQUESTED "This nick has already been requested, please check your e-mail address for the pass code"
-#define NICK_CONFIRM_INVALID "Invalid passcode has been entered, please check the e-mail again, and retry"
-#define CHAN_NOT_ALLOWED_TO_JOIN "You are not permitted to be on this channel."
-#define CHAN_X_INVALID "Channel %s is not a valid channel."
-#define CHAN_REACHED_CHANNEL_LIMIT "Sorry, you have already reached your limit of \002%d\002 channels."
-#define CHAN_EXCEEDED_CHANNEL_LIMIT "Sorry, you have already exceeded your limit of \002%d\002 channels."
-#define CHAN_SYMBOL_REQUIRED "Please use the symbol of \002#\002 when attempting to register"
-#define CHAN_SASET_SYNTAX "SASET \002channel\002 \037option\037 \037parameters\037"
-#define CHAN_SET_SYNTAX "SET \037channel\037 \037option\037 \037parameters\037"
-#define CHAN_SET_DISABLED "Sorry, channel option setting is temporarily disabled."
-#define CHAN_SETTING_CHANGED "%s for %s set to %s."
-#define CHAN_SETTING_UNSET "%s for %s unset."
-#define CHAN_SET_MLOCK_DEPRECATED "MLOCK is deprecated. Use \002%s%s HELP MODE\002 instead."
-#define CHAN_ACCESS_LEVEL_RANGE "Access level must be between %d and %d inclusive."
-#define CHAN_ACCESS_LIST_HEADER "Access list for %s:\n" \
- " Num Lev Mask"
-#define CHAN_ACCESS_VIEW_XOP_FORMAT " %3d %s %s\n" \
- " by %s, last seen %s"
-#define CHAN_ACCESS_VIEW_AXS_FORMAT " %3d %4d %s\n" \
- " by %s, last seen %s"
-#define CHAN_AKICK_VIEW_FORMAT "%3d %s (by %s on %s)\n" \
- " %s"
-#define CHAN_INFO_HEADER "Information for channel \002%s\002:"
-#define CHAN_EXCEPTED "\002%s\002 matches an except on %s and cannot be banned until the except have been removed."
-#define CHAN_LIST_ENTRY "%3d %s\n" \
- " Added by %s on %s"
-#define MEMO_NEW_X_MEMO_ARRIVED "There is a new memo on channel %s.\n" \
- "Type \002%s%s READ %s %d\002 to read it."
-#define MEMO_NEW_MEMO_ARRIVED "You have a new memo from %s.\n" \
- "Type \002%s%s READ %d\002 to read it."
-#define MEMO_HAVE_NO_MEMOS "You have no memos."
-#define MEMO_X_HAS_NO_MEMOS "%s has no memos."
-#define MEMO_SEND_SYNTAX "SEND {\037nick\037 | \037channel\037} \037memo-text\037"
-#define MEMO_SEND_DISABLED "Sorry, memo sending is temporarily disabled."
-#define MEMO_HAVE_NO_NEW_MEMOS "You have no new memos."
-#define MEMO_X_HAS_NO_NEW_MEMOS "%s has no new memos."
-#define BOT_DOES_NOT_EXIST "Bot \002%s\002 does not exist."
-#define BOT_NOT_ASSIGNED "You must assign a bot to the channel before using this command.\n" \
- "Type %s%s HELP ASSIGN for more information."
-#define BOT_NOT_ON_CHANNEL "Bot is not on channel \002%s\002."
-#define BOT_ASSIGN_READONLY "Sorry, bot assignment is temporarily disabled."
-#define ENABLED "Enabled"
-#define DISABLED "Disabled"
-#define OPER_LIST_FORMAT " %3d %-32s %s"
-#define OPER_VIEW_FORMAT "%3d %s (by %s on %s; %s)\n" \
- " %s"
-#define HOST_SET_ERROR "A vhost must be in the format of a valid hostmask."
-#define HOST_SET_IDENT_ERROR "A vhost ident must be in the format of a valid ident"
-#define HOST_SET_TOOLONG "Error! The vhost is too long, please use a host shorter than %d characters."
-#define HOST_SET_IDENTTOOLONG "Error! The Ident is too long, please use an ident shorter than %d characters."
-#define HOST_NOT_ASSIGNED "Please contact an Operator to get a vhost assigned to this nick."
-#define HOST_NO_VIDENT "Your IRCD does not support vIdent's, if this is incorrect, please report this as a possible bug"
+ "please choose a different nick.")
+#define FORCENICKCHANGE_NOW gtl("This nickname has been registered; you may not use it.")
+#define NICK_CANNOT_BE_REGISTERED gtl("Nickname \002%s\002 may not be registered.")
+#define NICK_ALREADY_REGISTERED gtl("Nickname \002%s\002 is already registered!")
+#define NICK_SET_SYNTAX gtl("SET \037option\037 \037parameters\037")
+#define NICK_SET_DISABLED gtl("Sorry, nickname option setting is temporarily disabled.")
+#define NICK_SET_UNKNOWN_OPTION gtl("Unknown SET option \002%s%s\002.")
+#define NICK_SET_DISPLAY_CHANGED gtl("The new display is now \002%s\002.")
+#define NICK_SASET_SYNTAX gtl("SASET \037nickname\037 \037option\037 \037parameters\037")
+#define NICK_SASET_DISPLAY_INVALID gtl("The new display for \002%s\002 MUST be a nickname of the nickname group!")
+#define NICK_SASET_PASSWORD_FAILED gtl("Sorry, couldn't change password for \002%s\002.")
+#define NICK_SASET_PASSWORD_CHANGED gtl("Password for \002%s\002 changed.")
+#define NICK_SASET_PASSWORD_CHANGED_TO gtl("Password for \002%s\002 changed to \002%s\002.")
+#define NICK_INFO_OPTIONS gtl(" Options: %s")
+#define NICK_LIST_SYNTAX gtl("LIST \037pattern\037")
+#define LIST_HEADER gtl("List of entries matching \002%s\002:")
+#define NICK_RECOVERED gtl("User claiming your nick has been killed.\n" \
+ "\002%s%s RELEASE %s\002 to get it back before %s timeout.")
+#define NICK_REQUESTED gtl("This nick has already been requested, please check your e-mail address for the pass code")
+#define NICK_CONFIRM_INVALID gtl("Invalid passcode has been entered, please check the e-mail again, and retry")
+#define CHAN_NOT_ALLOWED_TO_JOIN gtl("You are not permitted to be on this channel.")
+#define CHAN_X_INVALID gtl("Channel %s is not a valid channel.")
+#define CHAN_REACHED_CHANNEL_LIMIT gtl("Sorry, you have already reached your limit of \002%d\002 channels.")
+#define CHAN_EXCEEDED_CHANNEL_LIMIT gtl("Sorry, you have already exceeded your limit of \002%d\002 channels.")
+#define CHAN_SYMBOL_REQUIRED gtl("Please use the symbol of \002#\002 when attempting to register")
+#define CHAN_SASET_SYNTAX gtl("SASET \002channel\002 \037option\037 \037parameters\037")
+#define CHAN_SET_SYNTAX gtl("SET \037channel\037 \037option\037 \037parameters\037")
+#define CHAN_SET_DISABLED gtl("Sorry, channel option setting is temporarily disabled.")
+#define CHAN_SETTING_CHANGED gtl("%s for %s set to %s.")
+#define CHAN_SETTING_UNSET gtl("%s for %s unset.")
+#define CHAN_SET_MLOCK_DEPRECATED gtl("MLOCK is deprecated. Use \002%s%s HELP MODE\002 instead.")
+#define CHAN_ACCESS_LEVEL_RANGE gtl("Access level must be between %d and %d inclusive.")
+#define CHAN_ACCESS_LIST_HEADER gtl("Access list for %s:\n" \
+ " Num Lev Mask")
+#define CHAN_ACCESS_VIEW_XOP_FORMAT gtl(" %3d %s %s\n" \
+ " by %s, last seen %s")
+#define CHAN_ACCESS_VIEW_AXS_FORMAT gtl(" %3d %4d %s\n" \
+ " by %s, last seen %s")
+#define CHAN_AKICK_VIEW_FORMAT gtl("%3d %s (by %s on %s)\n" \
+ " %s")
+#define CHAN_INFO_HEADER gtl("Information for channel \002%s\002:")
+#define CHAN_EXCEPTED gtl("\002%s\002 matches an except on %s and cannot be banned until the except have been removed.")
+#define CHAN_LIST_ENTRY gtl("%3d %s\n" \
+ " Added by %s on %s")
+#define MEMO_NEW_X_MEMO_ARRIVED gtl("There is a new memo on channel %s.\n" \
+ "Type \002%s%s READ %s %d\002 to read it.")
+#define MEMO_NEW_MEMO_ARRIVED gtl("You have a new memo from %s.\n" \
+ "Type \002%s%s READ %d\002 to read it.")
+#define MEMO_HAVE_NO_MEMOS gtl("You have no memos.")
+#define MEMO_X_HAS_NO_MEMOS gtl("%s has no memos.")
+#define MEMO_SEND_SYNTAX gtl("SEND {\037nick\037 | \037channel\037} \037memo-text\037")
+#define MEMO_SEND_DISABLED gtl("Sorry, memo sending is temporarily disabled.")
+#define MEMO_HAVE_NO_NEW_MEMOS gtl("You have no new memos.")
+#define MEMO_X_HAS_NO_NEW_MEMOS gtl("%s has no new memos.")
+#define BOT_DOES_NOT_EXIST gtl("Bot \002%s\002 does not exist.")
+#define BOT_NOT_ASSIGNED gtl("You must assign a bot to the channel before using this command.\n" \
+ "Type %s%s HELP ASSIGN for more information.")
+#define BOT_NOT_ON_CHANNEL gtl("Bot is not on channel \002%s\002.")
+#define BOT_ASSIGN_READONLY gtl("Sorry, bot assignment is temporarily disabled.")
+#define ENABLED gtl("Enabled")
+#define DISABLED gtl("Disabled")
+#define OPER_LIST_FORMAT gtl(" %3d %-32s %s")
+#define OPER_VIEW_FORMAT gtl("%3d %s (by %s on %s; %s)\n" \
+ " %s")
+#define HOST_SET_ERROR gtl("A vhost must be in the format of a valid hostmask.")
+#define HOST_SET_IDENT_ERROR gtl("A vhost ident must be in the format of a valid ident")
+#define HOST_SET_TOOLONG gtl("Error! The vhost is too long, please use a host shorter than %d characters.")
+#define HOST_SET_IDENTTOOLONG gtl("Error! The Ident is too long, please use an ident shorter than %d characters.")
+#define HOST_NOT_ASSIGNED gtl("Please contact an Operator to get a vhost assigned to this nick.")
+#define HOST_NO_VIDENT gtl("Your IRCD does not support vIdent's, if this is incorrect, please report this as a possible bug")
diff --git a/include/services.h b/include/services.h
index 539d0e06c..f16c87791 100644
--- a/include/services.h
+++ b/include/services.h
@@ -49,6 +49,7 @@
#else
# define _(x) x
#endif
+# define gtl(x) x
#ifndef _WIN32
# include <unistd.h>
diff --git a/language/update.sh b/language/update.sh
index cbd17f8f3..8ebda609e 100755
--- a/language/update.sh
+++ b/language/update.sh
@@ -7,7 +7,7 @@ cd ..
FILES=`find ./ -name *.cpp -o -name *.h | grep -v /modules/extra/`
for f in $FILES
do
- xgettext -C -s -d Anope -j -o language/anope.pot --from-code=utf-8 --keyword=_ $f
+ xgettext -C -s -d Anope -j -o language/anope.pot --from-code=utf-8 --keyword --keyword=_ --keyword=gtl $f
done
cd -
diff --git a/modules/core/cs_suspend.cpp b/modules/core/cs_suspend.cpp
index 1836da858..32d75bbeb 100644
--- a/modules/core/cs_suspend.cpp
+++ b/modules/core/cs_suspend.cpp
@@ -54,7 +54,7 @@ class CommandCSSuspend : public Command
if (uc->user->HasMode(UMODE_OPER))
continue;
- c->Kick(NULL, uc->user, "%s", !reason.empty() ? reason.c_str() : GetString(uc->user->Account(), "This channel has been suspended.").c_str());
+ c->Kick(NULL, uc->user, "%s", !reason.empty() ? reason.c_str() : GetString(uc->user->Account(), gtl("This channel has been suspended.")).c_str());
}
}
diff --git a/modules/core/ms_main.cpp b/modules/core/ms_main.cpp
index 393c2b89e..c2933254c 100644
--- a/modules/core/ms_main.cpp
+++ b/modules/core/ms_main.cpp
@@ -17,16 +17,16 @@
static BotInfo *MemoServ = NULL;
static bool SendMemoMail(NickCore *nc, MemoInfo *mi, Memo *m)
{
- Anope::string message = Anope::printf(GetString(nc,
+ Anope::string message = Anope::printf(GetString(nc, gtl(
"Hi %s\n"
" \n"
"You've just received a new memo from %s. This is memo number %d.\n"
" \n"
"Memo text:\n"
" \n"
- "%s").c_str(), nc->display.c_str(), m->sender.c_str(), mi->GetIndex(m), m->text.c_str());
+ "%s")).c_str(), nc->display.c_str(), m->sender.c_str(), mi->GetIndex(m), m->text.c_str());
- return Mail(nc, GetString(nc, _("New memo")), message);
+ return Mail(nc, GetString(nc, gtl("New memo")), message);
}
class MyMemoServService : public MemoServService
diff --git a/modules/core/ms_read.cpp b/modules/core/ms_read.cpp
index e8868abe2..706906be4 100644
--- a/modules/core/ms_read.cpp
+++ b/modules/core/ms_read.cpp
@@ -33,7 +33,7 @@ void rsend_notify(CommandSource &source, MemoInfo *mi, Memo *m, const Anope::str
/* Text of the memo varies if the recepient was a
nick or channel */
- Anope::string text = Anope::printf(GetString(na->nc, _("\002[auto-memo]\002 The memo you sent to %s has been viewed.")).c_str(), targ.c_str());
+ Anope::string text = Anope::printf(GetString(na->nc, gtl("\002[auto-memo]\002 The memo you sent to %s has been viewed.")).c_str(), targ.c_str());
/* Send notification */
memoserv->Send(source.u->nick, m->sender, text, true);
diff --git a/modules/core/ns_resetpass.cpp b/modules/core/ns_resetpass.cpp
index d84f12e24..903e136fb 100644
--- a/modules/core/ns_resetpass.cpp
+++ b/modules/core/ns_resetpass.cpp
@@ -138,8 +138,8 @@ static bool SendResetEmail(User *u, NickAlias *na)
for (idx = 0; idx < 20; ++idx)
passcode += chars[1 + static_cast<int>((static_cast<float>(max - min)) * getrandom16() / 65536.0) + min];
- Anope::string subject = Anope::printf(GetString(na->nc, "Reset password request for %s").c_str(), na->nick.c_str());
- Anope::string message = Anope::printf(GetString(na->nc,
+ Anope::string subject = Anope::printf(GetString(na->nc, gtl("Reset password request for %s")).c_str(), na->nick.c_str());
+ Anope::string message = Anope::printf(GetString(na->nc, gtl(
"Hi,\n"
" \n"
"You have requested to have the password for %s reset.\n"
@@ -147,7 +147,7 @@ static bool SendResetEmail(User *u, NickAlias *na)
" \n"
"If you don't know why this mail was sent to you, please ignore it silently.\n"
" \n"
- "%s administrators.").c_str(), na->nick.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->s_NickServ.c_str(), na->nick.c_str(), passcode.c_str(), Config->NetworkName.c_str());
+ "%s administrators.")).c_str(), na->nick.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->s_NickServ.c_str(), na->nick.c_str(), passcode.c_str(), Config->NetworkName.c_str());
na->nc->Extend("ns_resetpass_code", new ExtensibleItemRegular<Anope::string>(passcode));
na->nc->Extend("ns_resetpass_time", new ExtensibleItemRegular<time_t>(Anope::CurTime));
diff --git a/modules/core/ns_sendpass.cpp b/modules/core/ns_sendpass.cpp
index 47e8d6a82..e9ef06d59 100644
--- a/modules/core/ns_sendpass.cpp
+++ b/modules/core/ns_sendpass.cpp
@@ -98,8 +98,8 @@ static bool SendPassMail(User *u, NickAlias *na, const Anope::string &pass)
{
char subject[BUFSIZE], message[BUFSIZE];
- snprintf(subject, sizeof(subject), GetString(na->nc, "Nickname password (%s)").c_str(), na->nick.c_str());
- snprintf(message, sizeof(message), GetString(na->nc,
+ snprintf(subject, sizeof(subject), GetString(na->nc, gtl("Nickname password (%s)")).c_str(), na->nick.c_str());
+ snprintf(message, sizeof(message), GetString(na->nc, gtl(
"Hi,\n"
" \n"
"You have requested to receive the password of nickname %s by e-mail.\n"
@@ -107,7 +107,7 @@ static bool SendPassMail(User *u, NickAlias *na, const Anope::string &pass)
" \n"
"If you don't know why this mail was sent to you, please ignore it silently.\n"
" \n"
- "%s administrators.").c_str(), na->nick.c_str(), pass.c_str(), Config->NetworkName.c_str());
+ "%s administrators.")).c_str(), na->nick.c_str(), pass.c_str(), Config->NetworkName.c_str());
return Mail(u, na->nc, nickserv->Bot(), subject, message);
}
diff --git a/modules/extra/os_defcon.cpp b/modules/extra/os_defcon.cpp
index eed8724fe..a23a1a4a8 100644
--- a/modules/extra/os_defcon.cpp
+++ b/modules/extra/os_defcon.cpp
@@ -119,14 +119,14 @@ class DefConTimeout : public CallBack
DConfig.defaultlevel = level;
FOREACH_MOD(I_OnDefconLevel, OnDefconLevel(level));
Log(operserv->Bot(), "operserv/defcon") << "Defcon level timeout, returning to level " << level;
- ircdproto->SendGlobops(operserv->Bot(), GetString(NULL, _("\002%s\002 Changed the DEFCON level to \002%d\002")).c_str(), Config->s_OperServ.c_str(), level);
+ ircdproto->SendGlobops(operserv->Bot(), GetString(NULL, gtl("\002%s\002 Changed the DEFCON level to \002%d\002")).c_str(), Config->s_OperServ.c_str(), level);
if (DConfig.globalondefcon)
{
if (!DConfig.offmessage.empty())
global->SendGlobal(global->Bot(), "", DConfig.offmessage);
else
- global->SendGlobal(global->Bot(), "", Anope::printf(GetString(NULL, _("The Defcon Level is now at Level: \002%d\002")).c_str(), DConfig.defaultlevel));
+ global->SendGlobal(global->Bot(), "", Anope::printf(GetString(NULL, gtl("The Defcon Level is now at Level: \002%d\002")).c_str(), DConfig.defaultlevel));
if (!DConfig.message.empty())
global->SendGlobal(global->Bot(), "", DConfig.message);
diff --git a/src/botserv.cpp b/src/botserv.cpp
index 45d30b395..48b355f24 100644
--- a/src/botserv.cpp
+++ b/src/botserv.cpp
@@ -51,7 +51,7 @@ void bot_raw_ban(User *requester, ChannelInfo *ci, User *u, const Anope::string
if (ModeManager::FindUserModeByName(UMODE_PROTECTED) && u->IsProtected() && requester != u)
{
- ircdproto->SendPrivmsg(ci->bi, ci->name, "%s", GetString(requester->Account(), _(ACCESS_DENIED)).c_str());
+ ircdproto->SendPrivmsg(ci->bi, ci->name, "%s", GetString(requester->Account(), ACCESS_DENIED).c_str());
return;
}
@@ -62,7 +62,7 @@ void bot_raw_ban(User *requester, ChannelInfo *ci, User *u, const Anope::string
if (matches_list(ci->c, u, CMODE_EXCEPT))
{
- ircdproto->SendPrivmsg(ci->bi, ci->name, "%s", GetString(requester->Account(), _("User matches channel except.")).c_str());
+ ircdproto->SendPrivmsg(ci->bi, ci->name, "%s", GetString(requester->Account(), gtl("User matches channel except.")).c_str());
return;
}
@@ -93,7 +93,7 @@ void bot_raw_kick(User *requester, ChannelInfo *ci, User *u, const Anope::string
if (ModeManager::FindUserModeByName(UMODE_PROTECTED) && u->IsProtected() && requester != u)
{
- ircdproto->SendPrivmsg(ci->bi, ci->name, "%s", GetString(requester->Account(), _(ACCESS_DENIED)).c_str());
+ ircdproto->SendPrivmsg(ci->bi, ci->name, "%s", GetString(requester->Account(), ACCESS_DENIED).c_str());
return;
}
diff --git a/src/language.cpp b/src/language.cpp
index 250415e9f..4f235ac9a 100644
--- a/src/language.cpp
+++ b/src/language.cpp
@@ -36,7 +36,7 @@ void InitLanguages()
const Anope::string GetString(NickCore *nc, const char *string)
{
- return GetString("anope", nc ? nc->language : "", string);
+ return GetString("anope", nc ? Config->NSDefLanguage : "", string);
}
const Anope::string GetString(const Anope::string &domain, const Anope::string &lang, const char *string)
diff --git a/src/misc.cpp b/src/misc.cpp
index 966af359e..897335b00 100644
--- a/src/misc.cpp
+++ b/src/misc.cpp
@@ -203,52 +203,51 @@ time_t dotime(const Anope::string &s)
* @param seconds time in seconds
* @return buffer
*/
-Anope::string duration(time_t seconds)
+Anope::string duration(const time_t &t, NickCore *nc)
{
/* We first calculate everything */
- time_t days = seconds / 86400;
- seconds -= (days * 86400);
- time_t hours = seconds / 3600;
- seconds -= (hours * 3600);
- time_t minutes = seconds / 60;
-
- Anope::string buffer;
+ time_t days = (t / 86400);
+ time_t hours = (t / 3600) % 24;
+ time_t minutes = (t / 60) % 60;
+ time_t seconds = (t) % 60;
if (!days && !hours && !minutes)
- buffer = stringify(seconds) + " second" + (seconds != 1 ? "s" : "");
+ return stringify(seconds) + " " + (seconds != 1 ? GetString(nc, gtl("seconds")) : GetString(nc, gtl("second")));
else
{
bool need_comma = false;
+ Anope::string buffer;
if (days)
{
- buffer = stringify(days) + " day" + (days != 1 ? "s" : "");
+ buffer = stringify(days) + " " + (days != 1 ? GetString(nc, gtl("days")) : GetString(nc, gtl("day")));
need_comma = true;
}
if (hours)
{
buffer += need_comma ? ", " : "";
- buffer += stringify(hours) + " hour" + (hours != 1 ? "s" : "");
+ buffer += stringify(hours) + " " + (hours != 1 ? GetString(nc, gtl("hours")) : GetString(nc, gtl("hour")));
need_comma = true;
}
if (minutes)
{
buffer += need_comma ? ", " : "";
- buffer += stringify(minutes) + " minute" + (minutes != 1 ? "s" : "");
+ buffer += stringify(minutes) + " " + (minutes != 1 ? GetString(nc, gtl("minutes")) : GetString(nc, gtl("minute")));
}
+ return buffer;
}
-
- return buffer;
}
-Anope::string do_strftime(const time_t &t)
+Anope::string do_strftime(const time_t &t, NickCore *nc, bool short_output)
{
tm tm = *localtime(&t);
char buf[BUFSIZE];
- strftime(buf, sizeof(buf), "%b %d %H:%M:%S %Y %Z", &tm);
+ strftime(buf, sizeof(buf), GetString(nc, gtl("%b %d %H:%M:%S %Y %Z")).c_str(), &tm);
+ if (short_output)
+ return buf;
if (t < Anope::CurTime)
- return Anope::string(buf) + " (" + duration(Anope::CurTime - t) + " ago)";
+ return Anope::string(buf) + " " + Anope::printf(GetString(nc, gtl("(%s ago)")).c_str(), duration(Anope::CurTime - t).c_str(), nc);
else
- return Anope::string(buf) + " (" + duration(t - Anope::CurTime) + " from now)";
+ return Anope::string(buf) + " " + Anope::printf(GetString(nc, gtl("(%s from now)")).c_str(), duration(t - Anope::CurTime).c_str(), nc);
}
/*************************************************************************/
@@ -262,9 +261,9 @@ Anope::string do_strftime(const time_t &t)
Anope::string expire_left(NickCore *nc, time_t expires)
{
if (!expires)
- return GetString(nc, _(NO_EXPIRE));
+ return GetString(nc, gtl(NO_EXPIRE));
else if (expires <= Anope::CurTime)
- return GetString(nc, _("expires at next database update"));
+ return GetString(nc, gtl("expires at next database update"));
else
{
char buf[256];
@@ -273,21 +272,21 @@ Anope::string expire_left(NickCore *nc, time_t expires)
if (diff >= 86400)
{
int days = diff / 86400;
- snprintf(buf, sizeof(buf), GetString(nc, days == 1 ? _("expires in %d day") : _("expires in %d days")).c_str(), days);
+ snprintf(buf, sizeof(buf), GetString(nc, days == 1 ? gtl("expires in %d day") : gtl("expires in %d days")).c_str(), days);
}
else
{
if (diff <= 3600)
{
int minutes = diff / 60;
- snprintf(buf, sizeof(buf), GetString(nc, minutes == 1 ? _("expires in %d minute") : _("expires in %d minutes")).c_str(), minutes);
+ snprintf(buf, sizeof(buf), GetString(nc, minutes == 1 ? gtl("expires in %d minute") : gtl("expires in %d minutes")).c_str(), minutes);
}
else
{
int hours = diff / 3600, minutes;
diff -= hours * 3600;
minutes = diff / 60;
- snprintf(buf, sizeof(buf), GetString(nc, hours == 1 && minutes == 1 ? _("expires in %d hour, %d minute") : (hours == 1 && minutes != 1 ? _("expires in %d hour, %d minutes") : (hours != 1 && minutes == 1 ? _("expires in %d hours, %d minute") : _("expires in %d hours, %d minutes")))).c_str(), hours, minutes);
+ snprintf(buf, sizeof(buf), GetString(nc, hours == 1 && minutes == 1 ? gtl("expires in %d hour, %d minute") : (hours == 1 && minutes != 1 ? gtl("expires in %d hour, %d minutes") : (hours != 1 && minutes == 1 ? gtl("expires in %d hours, %d minute") : gtl("expires in %d hours, %d minutes")))).c_str(), hours, minutes);
}
}
diff --git a/src/regchannel.cpp b/src/regchannel.cpp
index be2746edf..b76c85b64 100644
--- a/src/regchannel.cpp
+++ b/src/regchannel.cpp
@@ -793,7 +793,7 @@ bool ChannelInfo::CheckKick(User *user)
if (!user->HasMode(UMODE_OPER) && this->HasFlag(CI_SUSPENDED))
{
get_idealban(this, user, mask);
- reason = GetString(user->Account(), _("This channel may not be used."));
+ reason = GetString(user->Account(), gtl("This channel may not be used."));
set_modes = true;
do_kick = true;
}
@@ -837,7 +837,7 @@ bool ChannelInfo::CheckKick(User *user)
if (!do_kick && check_access(user, this, CA_NOJOIN))
{
get_idealban(this, user, mask);
- reason = GetString(user->Account(), _(CHAN_NOT_ALLOWED_TO_JOIN));
+ reason = GetString(user->Account(), CHAN_NOT_ALLOWED_TO_JOIN);
do_kick = true;
}