diff --git a/meowth/__main__.py b/meowth/__main__.py index a1b1c60aa..af4ccf795 100644 --- a/meowth/__main__.py +++ b/meowth/__main__.py @@ -3491,7 +3491,7 @@ async def reset_board(ctx, *, user=None, type=None): if tgt_trainer: await ctx.send(_("{trainer}'s report stats have been cleared!").format(trainer=tgt_trainer.display_name)) return - await ctx.send("This server's report stats have been reset!") + await ctx.send(_("This server's report stats have been reset!")) @Meowth.command() @commands.has_permissions(manage_channels=True) @@ -4292,7 +4292,7 @@ async def _raid(message, content): if str(level) in guild_dict[message.guild.id]['configure_dict']['counters']['auto_levels']: try: ctrs_dict = await _get_generic_counters(message.guild, entered_raid, weather) - ctrsmsg = "Here are the best counters for the raid boss in currently known weather conditions! Update weather with **!weather**. If you know the moveset of the boss, you can react to this message with the matching emoji and I will update the counters." + ctrsmsg = _("Here are the best counters for the raid boss in currently known weather conditions! Update weather with **!weather**. If you know the moveset of the boss, you can react to this message with the matching emoji and I will update the counters.") ctrsmessage = await raid_channel.send(content=ctrsmsg,embed=ctrs_dict[0]['embed']) ctrsmessage_id = ctrsmessage.id await ctrsmessage.pin() @@ -4643,7 +4643,7 @@ async def _eggtoraid(entered_raid, raid_channel, author=None): else: invitemsgstr = _("Coordinate") invitemsgstr2 = "" - raidreportcontent = _('Meowth! The EX egg has hatched into a {pokemon} raid! Details: {location_details}. {invitemsgstr} coordinate in {raid_channel}').format(pokemon=entered_raid.capitalize(), location_details=egg_address, invitemsgstr=invitemsgstr,raid_channel=raid_channel.mention) + raidreportcontent = _('Meowth! The EX egg has hatched into a {pokemon} raid! Details: {location_details}. {invitemsgstr} in {raid_channel}').format(pokemon=entered_raid.capitalize(), location_details=egg_address, invitemsgstr=invitemsgstr,raid_channel=raid_channel.mention) raidmsg = _("Meowth! {pokemon} EX raid reported by {member} in {citychannel}! Details: {location_details}. Coordinate here{invitemsgstr2}!\n\nClick the question mark reaction to get help on the commands that work in here.\n\nThis channel will be deleted five minutes after the timer expires.").format(pokemon=entered_raid.capitalize(), member=raid_messageauthor.mention, citychannel=reportcitychannel.mention, location_details=egg_address, invitemsgstr2=invitemsgstr2) raid_channel_name = (entered_raid + '-') + sanitize_channel_name(egg_address) raid = discord.utils.get(raid_channel.guild.roles, name=entered_raid) @@ -4704,7 +4704,7 @@ async def _eggtoraid(entered_raid, raid_channel, author=None): egg_report = None if str(egglevel) in guild_dict[raid_channel.guild.id]['configure_dict']['counters']['auto_levels'] and not eggdetails.get('pokemon', None): ctrs_dict = await _get_generic_counters(raid_channel.guild, entered_raid, weather) - ctrsmsg = "Here are the best counters for the raid boss in currently known weather conditions! Update weather with **!weather**. If you know the moveset of the boss, you can react to this message with the matching emoji and I will update the counters." + ctrsmsg = _("Here are the best counters for the raid boss in currently known weather conditions! Update weather with **!weather**. If you know the moveset of the boss, you can react to this message with the matching emoji and I will update the counters.") ctrsmessage = await raid_channel.send(content=ctrsmsg,embed=ctrs_dict[0]['embed']) ctrsmessage_id = ctrsmessage.id await ctrsmessage.pin() @@ -5569,7 +5569,7 @@ async def recover(ctx): manual_timer = False else: topicsplit = topic.split('|') - localhatch = datetime.datetime.strptime(topicsplit[0][:(- 9)], 'Hatches on %B %d at %I:%M %p') + localhatch = datetime.datetime.strptime(topicsplit[0][:(- 9)], _('Hatches on %B %d at %I:%M %p')) utchatch = localhatch - datetime.timedelta(hours=guild_dict[guild.id]['configure_dict']['settings']['offset']) exp = utchatch.replace(year=now.year, tzinfo=datetime.timezone.utc).timestamp() manual_timer = True @@ -5606,7 +5606,7 @@ async def recover(ctx): manual_timer = False else: topicsplit = topic.split('|') - localhatch = datetime.datetime.strptime(topicsplit[0][:(- 9)], 'Hatches on %B %d at %I:%M %p') + localhatch = datetime.datetime.strptime(topicsplit[0][:(- 9)], _('Hatches on %B %d at %I:%M %p')) utchatch = localhatch - datetime.timedelta(hours=guild_dict[guild.id]['configure_dict']['settings']['offset']) exp = utchatch.replace(year=now.year, tzinfo=datetime.timezone.utc).timestamp() manual_timer = True @@ -5625,7 +5625,7 @@ async def recover(ctx): manual_timer = False else: topicsplit = topic.split('|') - localhatch = datetime.datetime.strptime(topicsplit[0][:(- 9)], 'Hatches on %B %d at %I:%M %p') + localhatch = datetime.datetime.strptime(topicsplit[0][:(- 9)], _('Hatches on %B %d at %I:%M %p')) utchatch = localhatch - datetime.timedelta(hours=guild_dict[guild.id]['configure_dict']['settings']['offset']) exp = utchatch.replace(year=now.year, tzinfo=datetime.timezone.utc).timestamp() manual_timer = True @@ -5843,7 +5843,7 @@ async def counters(ctx, *, args = None): except (discord.errors.NotFound, discord.errors.Forbidden, discord.errors.HTTPException): pass moveset = guild_dict[guild.id]['raidchannel_dict'][channel.id].get('moveset', 0) - movesetstr = guild_dict[guild.id]['raidchannel_dict'][channel.id]['ctrs_dict'].get(moveset,{}).get('moveset',"Unknown Moveset") + movesetstr = guild_dict[guild.id]['raidchannel_dict'][channel.id]['ctrs_dict'].get(moveset,{}).get('moveset',_("Unknown Moveset")) weather = guild_dict[guild.id]['raidchannel_dict'][channel.id].get('weather', None) else: pkmn = next((str(p) for p in get_raidlist() if not str(p).isdigit() and re.sub(rgx, '', str(p)) in re.sub(rgx, '', args.lower())), None) @@ -5879,7 +5879,7 @@ async def counters(ctx, *, args = None): return await _counters(ctx, pkmn, user, weather, "Unknown Moveset") -async def _counters(ctx, pkmn, user = None, weather = None, movesetstr = "Unknown Moveset"): +async def _counters(ctx, pkmn, user = None, weather = None, movesetstr = _("Unknown Moveset")): img_url = 'https://raw.githubusercontent.com/FoglyOgly/Meowth/discordpy-v1/images/pkmn/{0}_.png?cache=4'.format(str(get_number(pkmn)).zfill(3)) level = get_level(pkmn) if get_level(pkmn).isdigit() else "5" url = "https://fight.pokebattler.com/raids/defenders/{pkmn}/levels/RAID_LEVEL_{level}/attackers/".format(pkmn=pkmn.replace('-','_').upper(),level=level) @@ -5912,7 +5912,7 @@ async def _counters(ctx, pkmn, user = None, weather = None, movesetstr = "Unknow data = data['attackers'][0] raid_cp = data['cp'] atk_levels = '30' - if movesetstr == "Unknown Moveset": + if movesetstr == _("Unknown Moveset"): ctrs = data['randomMove']['defenders'][-6:] est = data['randomMove']['total']['estimator'] else: @@ -5925,7 +5925,7 @@ async def _counters(ctx, pkmn, user = None, weather = None, movesetstr = "Unknow est = moveset['total']['estimator'] break else: - movesetstr = "Unknown Moveset" + movesetstr = _("Unknown Moveset") ctrs = data['randomMove']['defenders'][-6:] est = data['randomMove']['total']['estimator'] def clean(txt): @@ -5961,7 +5961,7 @@ async def _get_generic_counters(guild, pkmn, weather=None): ctrs_dict = {} ctrs_index = 0 ctrs_dict[ctrs_index] = {} - ctrs_dict[ctrs_index]['moveset'] = "Unknown Moveset" + ctrs_dict[ctrs_index]['moveset'] = _("Unknown Moveset") ctrs_dict[ctrs_index]['emoji'] = '0\u20e3' img_url = 'https://raw.githubusercontent.com/FoglyOgly/Meowth/discordpy-v1/images/pkmn/{0}_.png?cache=4'.format(str(get_number(pkmn)).zfill(3)) level = get_level(pkmn) if get_level(pkmn).isdigit() else "5" @@ -5990,7 +5990,7 @@ async def _get_generic_counters(guild, pkmn, weather=None): ctrs = data['randomMove']['defenders'][-6:] def clean(txt): return txt.replace('_', ' ').title() - title = _('{pkmn} | {weather} | Unknown Moveset').format(pkmn=pkmn.title(),weather=weather_list[index].title()) + title = _('{pkmn} | {weather} | {movesetstr}').format(pkmn=pkmn.title(),weather=weather_list[index].title(),movesetstr=ctrs_dict[ctrs_index]['moveset'].title()) stats_msg = _("**CP:** {raid_cp}\n").format(raid_cp=raid_cp) stats_msg += _("**Weather:** {weather}\n").format(weather=clean(weather)) stats_msg += _("**Attacker Level:** {atk_levels}").format(atk_levels=atk_levels) @@ -6967,13 +6967,13 @@ def list_output(r): bulletpoint = '❔' else: bulletpoint = '🔹' - if " 0 interested!" not in await _interest(ctx, tag, team): + if _(" 0 interested!") not in await _interest(ctx, tag, team): listmsg += ('\n' + bulletpoint) + (await _interest(ctx, tag, team)) - if " 0 on the way!" not in await _otw(ctx, tag, team): + if _(" 0 on the way!") not in await _otw(ctx, tag, team): listmsg += ('\n' + bulletpoint) + (await _otw(ctx, tag, team)) - if " 0 waiting at the raid!" not in await _waiting(ctx, tag, team): + if _(" 0 waiting at the raid!") not in await _waiting(ctx, tag, team): listmsg += ('\n' + bulletpoint) + (await _waiting(ctx, tag, team)) - if " 0 in the lobby!" not in await _lobbylist(ctx, tag, team): + if _(" 0 in the lobby!") not in await _lobbylist(ctx, tag, team): listmsg += ('\n' + bulletpoint) + (await _lobbylist(ctx, tag, team)) if (len(listmsg.splitlines()) <= 1): listmsg += ('\n' + bulletpoint) + (_(" Nobody has updated their status yet!")) @@ -7322,7 +7322,7 @@ async def _researchlist(ctx): if questmsg: listmsg = _(' **Here\'s the current research reports for {channel}**\n{questmsg}').format(channel=ctx.message.channel.name.capitalize(),questmsg=questmsg) else: - listmsg = _(" There are no reported research reports. Report one with **!research**") + listmsg = _(" There are no reported research reports. Report one with **{prefix}research**").format(prefix=ctx.prefix) return listmsg @_list.command() diff --git a/meowth/errors.py b/meowth/errors.py index 46d97378a..2e5254463 100644 --- a/meowth/errors.py +++ b/meowth/errors.py @@ -382,7 +382,7 @@ async def on_command_error(ctx, error): await delete_error(ctx.message, error) elif isinstance(error, RegionExRaidChannelCheckFail): guild = ctx.guild - msg = _('Meowth! Please use **{prefix}{cmd_name}** in either a EX Raid channel or one of the following region channels:').format(cmd_name=ctx.invoked_with, prefix=prefix) + msg = _('Meowth! Please use **{prefix}{cmd_name}** in either a EX Raid channel or ').format(cmd_name=ctx.invoked_with, prefix=prefix) city_channels = bot.guild_dict[guild.id]['configure_dict']['exraid']['report_channels'] if len(city_channels) > 10: msg += _('a Region report channel.') @@ -399,7 +399,7 @@ async def on_command_error(ctx, error): await delete_error(ctx.message, error) elif isinstance(error, ExRaidChannelCheckFail): guild = ctx.guild - msg = _('Meowth! Please use **{prefix}{cmd_name}** in a EX Raid channel. Use **{prefix}list** in any of the following region channels to see active raids:').format(cmd_name=ctx.invoked_with, prefix=prefix) + msg = _('Meowth! Please use **{prefix}{cmd_name}** in a EX Raid channel. Use **{prefix}list** in ').format(cmd_name=ctx.invoked_with, prefix=prefix) city_channels = bot.guild_dict[guild.id]['configure_dict']['exraid']['report_channels'] if len(city_channels) > 10: msg += _('a Region report channel.') diff --git a/meowth/utils.py b/meowth/utils.py index e2c7659f3..e05cf9107 100644 --- a/meowth/utils.py +++ b/meowth/utils.py @@ -150,32 +150,32 @@ def sanitize_channel_name(name): async def get_raid_help(prefix, avatar, user=None): helpembed = discord.Embed(colour=discord.Colour.lighter_grey()) - helpembed.set_author(name="Raid Coordination Help", icon_url=avatar) + helpembed.set_author(name=_("Raid Coordination Help"), icon_url=avatar) helpembed.add_field( - name="Key", - value="<> denote required arguments, [] denote optional arguments", + name=_("Key"), + value=_("<> denote required arguments, [] denote optional arguments"), inline=False) helpembed.add_field( - name="Raid MGMT Commands", + name=_("Raid MGMT Commands"), value=( - f"`{prefix}raid `\n" - f"`{prefix}weather `\n" - f"`{prefix}timerset `\n" - f"`{prefix}starttime