1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-08-13 16:53:50 -04:00

I18N: Added all command descriptions to the strings ressource

This commit is contained in:
Sebastian Kaspari 2010-09-05 16:05:51 +02:00
parent 943b4635dc
commit 72301331f2
25 changed files with 121 additions and 57 deletions

View File

@ -25,6 +25,8 @@ import org.yaaic.irc.IRCService;
import org.yaaic.model.Conversation;
import org.yaaic.model.Server;
import android.content.Context;
/**
* Base class for commands
*
@ -53,9 +55,10 @@ public abstract class BaseHandler
/**
* Get the description for this command
*
* @param context The current context. Needed for getting string resources
* @return
*/
public abstract String getDescription();
public abstract String getDescription(Context context);
/**
* Merge params to a string

View File

@ -22,6 +22,7 @@ package org.yaaic.command.handler;
import java.util.Collection;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.exception.CommandException;
import org.yaaic.irc.IRCService;
@ -30,6 +31,7 @@ import org.yaaic.model.Conversation;
import org.yaaic.model.Message;
import org.yaaic.model.Server;
import android.content.Context;
import android.content.Intent;
/**
@ -69,7 +71,7 @@ public class AMsgHandler extends BaseHandler
}
}
} else {
throw new CommandException("Invalid number of params");
throw new CommandException(service.getString(R.string.invalid_number_of_params));
}
}
@ -86,8 +88,8 @@ public class AMsgHandler extends BaseHandler
* Description of /amsg
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "Send a message to all channels";
return context.getString(R.string.command_desc_amsg);
}
}

View File

@ -20,12 +20,15 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic.command.handler;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.exception.CommandException;
import org.yaaic.irc.IRCService;
import org.yaaic.model.Conversation;
import org.yaaic.model.Server;
import android.content.Context;
/**
* Command: /away [<reason>]
*
@ -48,9 +51,9 @@ public class AwayHandler extends BaseHandler
* Get description of /away
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "Sets you away";
return context.getString(R.string.command_desc_away);
}
/**

View File

@ -20,6 +20,7 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic.command.handler;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.exception.CommandException;
import org.yaaic.irc.IRCService;
@ -27,6 +28,7 @@ import org.yaaic.model.Broadcast;
import org.yaaic.model.Conversation;
import org.yaaic.model.Server;
import android.content.Context;
import android.content.Intent;
/**
@ -78,8 +80,8 @@ public class CloseHandler extends BaseHandler
* Description of /close
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "Closes the current window";
return context.getString(R.string.command_desc_close);
}
}

View File

@ -22,6 +22,7 @@ package org.yaaic.command.handler;
import java.io.File;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.exception.CommandException;
import org.yaaic.irc.IRCService;
@ -30,6 +31,8 @@ import org.yaaic.model.Conversation;
import org.yaaic.model.Message;
import org.yaaic.model.Server;
import android.content.Context;
/**
* Command: /dcc SEND <nickname> <file>
*
@ -81,8 +84,8 @@ public class DCCHandler extends BaseHandler
* Description of /dcc
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "Send a file to a user";
return context.getString(R.string.command_desc_dcc);
}
}

View File

@ -20,21 +20,24 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic.command.handler;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.exception.CommandException;
import org.yaaic.irc.IRCService;
import org.yaaic.model.Conversation;
import org.yaaic.model.Server;
import android.content.Context;
/**
* Command: /voice <nickname>
* Command: /deop <nickname>
*
* @author Sebastian Kaspari <sebastian@yaaic.org>
*/
public class DeopHandler extends BaseHandler
{
/**
* Execute /voice
* Execute /deop
*/
@Override
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
@ -51,20 +54,20 @@ public class DeopHandler extends BaseHandler
}
/**
* Usage of /voice
* Usage of /deop
*/
@Override
public String getUsage()
{
return "/voice <nickname>";
return "/deop <nickname>";
}
/**
* Description of /voice
* Description of /deop
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "Give a user voice status";
return context.getString(R.string.command_desc_deop);
}
}

View File

@ -20,12 +20,15 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic.command.handler;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.exception.CommandException;
import org.yaaic.irc.IRCService;
import org.yaaic.model.Conversation;
import org.yaaic.model.Server;
import android.content.Context;
/**
* Command: /devoice <nickname>
*
@ -63,8 +66,8 @@ public class DevoiceHandler extends BaseHandler
* Description of /devoice
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "Remove voice status from a user";
return context.getString(R.string.command_desc_devoice);
}
}

View File

@ -20,6 +20,7 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic.command.handler;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.exception.CommandException;
import org.yaaic.irc.IRCService;
@ -28,6 +29,7 @@ import org.yaaic.model.Conversation;
import org.yaaic.model.Message;
import org.yaaic.model.Server;
import android.content.Context;
import android.content.Intent;
/**
@ -71,8 +73,8 @@ public class EchoHandler extends BaseHandler
* Description of /echo
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "Print text to window";
return context.getString(R.string.command_desc_echo);
}
}

View File

@ -23,6 +23,7 @@ package org.yaaic.command.handler;
import java.util.HashMap;
import java.util.Set;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.command.CommandParser;
import org.yaaic.exception.CommandException;
@ -32,6 +33,7 @@ import org.yaaic.model.Conversation;
import org.yaaic.model.Message;
import org.yaaic.model.Server;
import android.content.Context;
import android.content.Intent;
/**
@ -83,7 +85,7 @@ public class HelpHandler extends BaseHandler
break;
}
}
commandList.append("/" + command.toString() + alias + " - "+commands.get(command).getDescription() + "\n");
commandList.append("/" + command.toString() + alias + " - "+commands.get(command).getDescription(service) + "\n");
}
Message message = new Message(commandList.toString());
@ -114,7 +116,7 @@ public class HelpHandler extends BaseHandler
HashMap<String, BaseHandler> commands = cp.getCommands();
if (commands.containsKey(command)) {
Message message = new Message("Help of /" + command + "\n" + commands.get(command).getUsage() + "\n" + commands.get(command).getDescription() + "\n");
Message message = new Message("Help of /" + command + "\n" + commands.get(command).getUsage() + "\n" + commands.get(command).getDescription(service) + "\n");
message.setColor(Message.COLOR_YELLOW);
conversation.addMessage(message);
@ -143,8 +145,8 @@ public class HelpHandler extends BaseHandler
* Description of /help
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "Lists all available commands";
return context.getString(R.string.command_desc_help);
}
}

View File

@ -20,12 +20,15 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic.command.handler;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.exception.CommandException;
import org.yaaic.irc.IRCService;
import org.yaaic.model.Conversation;
import org.yaaic.model.Server;
import android.content.Context;
/**
* Command: /join <channel> [<key>]
*
@ -61,8 +64,8 @@ public class JoinHandler extends BaseHandler
* Description of /join
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "Join a channel";
return context.getString(R.string.command_desc_join);
}
}

View File

@ -20,12 +20,15 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic.command.handler;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.exception.CommandException;
import org.yaaic.irc.IRCService;
import org.yaaic.model.Conversation;
import org.yaaic.model.Server;
import android.content.Context;
/**
* Command: /kick <nickname>
*
@ -65,8 +68,8 @@ public class KickHandler extends BaseHandler
* Description of /kick
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "Kicks a user";
return context.getString(R.string.command_desc_kick);
}
}

View File

@ -29,6 +29,7 @@ import org.yaaic.model.Conversation;
import org.yaaic.model.Message;
import org.yaaic.model.Server;
import android.content.Context;
import android.content.Intent;
/**
@ -82,8 +83,8 @@ public class MeHandler extends BaseHandler
* Description of /me
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "Perform an action";
return context.getString(R.string.command_desc_me);
}
}

View File

@ -20,12 +20,15 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic.command.handler;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.exception.CommandException;
import org.yaaic.irc.IRCService;
import org.yaaic.model.Conversation;
import org.yaaic.model.Server;
import android.content.Context;
/**
* Command: /mode <channel> <mode>
*
@ -63,8 +66,8 @@ public class ModeHandler extends BaseHandler
* Description of /mode
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "Change channel modes";
return context.getString(R.string.command_desc_mode);
}
}

View File

@ -20,6 +20,7 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic.command.handler;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.exception.CommandException;
import org.yaaic.irc.IRCService;
@ -28,6 +29,7 @@ import org.yaaic.model.Conversation;
import org.yaaic.model.Message;
import org.yaaic.model.Server;
import android.content.Context;
import android.content.Intent;
/**
@ -81,8 +83,8 @@ public class MsgHandler extends BaseHandler
* Description of /msg
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "Send a message to a channel or user";
return context.getString(R.string.command_desc_msg);
}
}

View File

@ -21,6 +21,7 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
package org.yaaic.command.handler;
import org.jibble.pircbot.User;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.exception.CommandException;
import org.yaaic.irc.IRCService;
@ -29,6 +30,7 @@ import org.yaaic.model.Conversation;
import org.yaaic.model.Message;
import org.yaaic.model.Server;
import android.content.Context;
import android.content.Intent;
/**
@ -84,8 +86,8 @@ public class NamesHandler extends BaseHandler
* Description of /names
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "lists all users in channel";
return context.getString(R.string.command_desc_names);
}
}

View File

@ -20,12 +20,15 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic.command.handler;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.exception.CommandException;
import org.yaaic.irc.IRCService;
import org.yaaic.model.Conversation;
import org.yaaic.model.Server;
import android.content.Context;
/**
* Command: /nick <nickname>
*
@ -59,8 +62,8 @@ public class NickHandler extends BaseHandler
* Description of /nick
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "change own nickname";
return context.getString(R.string.command_desc_nick);
}
}

View File

@ -29,6 +29,7 @@ import org.yaaic.model.Conversation;
import org.yaaic.model.Message;
import org.yaaic.model.Server;
import android.content.Context;
import android.content.Intent;
/**
@ -79,8 +80,8 @@ public class NoticeHandler extends BaseHandler
* Description of /notice
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "Send a notice to an other user";
return context.getString(R.string.command_desc_notice);
}
}

View File

@ -20,12 +20,15 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic.command.handler;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.exception.CommandException;
import org.yaaic.irc.IRCService;
import org.yaaic.model.Conversation;
import org.yaaic.model.Server;
import android.content.Context;
/**
* Command: /deop <nickname>
*
@ -63,8 +66,8 @@ public class OpHandler extends BaseHandler
* Description of /deop
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "Give a user operator status";
return context.getString(R.string.command_desc_op);
}
}

View File

@ -20,12 +20,15 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic.command.handler;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.exception.CommandException;
import org.yaaic.irc.IRCService;
import org.yaaic.model.Conversation;
import org.yaaic.model.Server;
import android.content.Context;
/**
* Command: /part [<channel>]
*
@ -67,8 +70,8 @@ public class PartHandler extends BaseHandler
* Description of /part
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "leave the current channel";
return context.getString(R.string.command_desc_part);
}
}

View File

@ -20,6 +20,7 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic.command.handler;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.exception.CommandException;
import org.yaaic.irc.IRCService;
@ -28,6 +29,7 @@ import org.yaaic.model.Conversation;
import org.yaaic.model.Query;
import org.yaaic.model.Server;
import android.content.Context;
import android.content.Intent;
/**
@ -84,8 +86,8 @@ public class QueryHandler extends BaseHandler
* Description of /query
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "opens a private chat with a user";
return context.getString(R.string.command_desc_query);
}
}

View File

@ -20,12 +20,15 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic.command.handler;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.exception.CommandException;
import org.yaaic.irc.IRCService;
import org.yaaic.model.Conversation;
import org.yaaic.model.Server;
import android.content.Context;
/**
* Command: /quit [<reason>]
*
@ -59,8 +62,8 @@ public class QuitHandler extends BaseHandler
* Description of /quit
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "disconnect from server";
return context.getString(R.string.command_desc_quit);
}
}

View File

@ -20,12 +20,15 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic.command.handler;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.exception.CommandException;
import org.yaaic.irc.IRCService;
import org.yaaic.model.Conversation;
import org.yaaic.model.Server;
import android.content.Context;
/**
* Command: /raw <line>
*
@ -62,8 +65,8 @@ public class RawHandler extends BaseHandler
* Description of /raw
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "Send a raw line to the server";
return context.getString(R.string.command_desc_raw);
}
}

View File

@ -20,6 +20,7 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic.command.handler;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.exception.CommandException;
import org.yaaic.irc.IRCService;
@ -27,6 +28,8 @@ import org.yaaic.model.Channel;
import org.yaaic.model.Conversation;
import org.yaaic.model.Server;
import android.content.Context;
/**
* Command: /topic [<topic>]
*
@ -70,8 +73,8 @@ public class TopicHandler extends BaseHandler
* Description of /topic
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "show or change the current topic";
return context.getString(R.string.command_desc_topic);
}
}

View File

@ -20,12 +20,15 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic.command.handler;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.exception.CommandException;
import org.yaaic.irc.IRCService;
import org.yaaic.model.Conversation;
import org.yaaic.model.Server;
import android.content.Context;
/**
* Command: /voice <nickname>
*
@ -63,8 +66,8 @@ public class VoiceHandler extends BaseHandler
* Description of /voice
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "Give a user voice status";
return context.getString(R.string.command_desc_voice);
}
}

View File

@ -20,12 +20,15 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yaaic.command.handler;
import org.yaaic.R;
import org.yaaic.command.BaseHandler;
import org.yaaic.exception.CommandException;
import org.yaaic.irc.IRCService;
import org.yaaic.model.Conversation;
import org.yaaic.model.Server;
import android.content.Context;
/**
* Command: /whois <nickname>
*
@ -52,9 +55,9 @@ public class WhoisHandler extends BaseHandler
* Get description of /whois
*/
@Override
public String getDescription()
public String getDescription(Context context)
{
return "Get information about a user";
return context.getString(R.string.command_desc_whois);
}
/**