We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the t function to templateData so that we can use t inside the template itself
t
templateData
For example:
greeting: hello! main: i like trains. end: bye! text: |- ${t('greeting')} ${t('main')} ${t('end')}
The text was updated successfully, but these errors were encountered:
you can already add it yourself when needed.
bot.command('translaception', async ctx => { const result = ctx.i18n.t('whatever', {t: ctx.i18n.t}) await ctx.reply(result) })
For a more permanent solution add it via templateData on the I18n initialisation:
const i18n = new I18n({ … templateData: { translateWithLanguageArgument: (languageCode: string, resourceKey: string) => i18n.t(languageCode, resourceKey), translateWithUserLanguage: (resourceKey: string) => i18n.t((this as any).languageCode, resourceKey), uppercase: (value: string) => value.toUpperCase() } })
Sorry, something went wrong.
No branches or pull requests
Add the
t
function totemplateData
so that we can uset
inside the template itselfFor example:
The text was updated successfully, but these errors were encountered: