Skip to content
New issue

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

allow custom framework use args in refactor templates #1290

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DustarMao
Copy link

@DustarMao DustarMao commented Mar 17, 2025

now custom framework cannot use args in refactor templates.

with refactor template i18n.t('$1') in i18n-ally-custom-framework.yml,
when we extract text like `hello, ${'world'}`,
we will only get i18n.t("<keypath of 'hello, {0}'>"),
but we need i18n.t("<keypath of 'hello, {0}'>", ['world']),
here is no way to do this now.

but with this patch, and config below, it will works as we need

# i18n-ally-custom-framework.yml
refactorTemplates:
  - i18n.t('$1', $2)
  - i18n.t('$1')

notice: the first template with $2 only used with args not empty, so we need a template without $2 for fallback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant