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 extending a list of translation helpers for AST analysis #615

Closed
lolmaus opened this issue Apr 26, 2023 · 1 comment
Closed

Allow extending a list of translation helpers for AST analysis #615

lolmaus opened this issue Apr 26, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@lolmaus
Copy link
Collaborator

lolmaus commented Apr 26, 2023

In a project, I have implemented a t-error helper to standardize error handling:

Before:

{{#if (eq error.status 403)}}
  {{t "errors.forbidden"}}
{{else if (gte error.status 400}}
  {{t "errors.server-failure"}}
{{else}}
  {{t "my-component.error-message"}}
{{/if}}

After:

{{t-error error "my-component.error-message"}}

Unfortunately, this forces me to add all fallback keys to ember-intl-analyzer whitelist.

I would like to configure ember-intl-analyzer to recognize my t-error helper. I imagine something like this:

export default {
  whitelist: [
    /^[^.]+\.warnings\.[^.]+$/,
  ],
  helpers: ['t', 't-error'],
};

Is it something we want to support?

PS Please note this should not be sensitive to argument order.

CC @nickschot

@Mikek2252 Mikek2252 added the enhancement New feature or request label Feb 2, 2024
@Mikek2252
Copy link
Collaborator

This is now available to use in 4.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants