Skip to content

How use locale_str in hybrid_group #9521

Closed Answered by riquedev
riquedev asked this question in Q&A
Discussion options

You must be logged in to vote

I found the problem, for some reason when the hybrid_group passes to the Translator it doesn't come with a context of "TranslationContextLocation.command_name".
In my code I observe these contexts to use in GetText (because my translations are in YML files), so it always ended up falling outside the conditionals, to correct I just added an else testing all possibilities, it's not the best way to do it but it worked...

from __future__ import annotations

import discord
from discord import app_commands
from discord.app_commands import TranslationContextLocation

from IsekaiTensei.discord_bot.utils.get_text import GetText


class IsekaiTranslator(app_commands.Translator):
    async def trans…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@Rapptz
Comment options

@riquedev
Comment options

Answer selected by riquedev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants