fulls1z3/ngx-meta

Make configurable callback exceptions

rafa-suagu opened this issue · 2 comments

I'm submitting a ... (check one with "x")

[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  <!-- Please check the repository for a similar issue or PR before submitting -->
[ ] Support request => <!-- Please check the repository for a similar issue or PR before submitting -->
[x] Feature request
[ ] Documentation issue or request

Current behavior
Currently only two metas has the "exception" status, 'og:locale' and 'og:locale:alternate'

Expected/desired behavior
Configure the callback exceptions.

What is the motivation / use case for changing the behavior?
It's impossible or undesired, suppose or predict the metas that the projects wants to exclude from callback function. In our case, we have for example 'og:type' or 'og:image' that doesn't need translation (thought the callback function).
The workaround for this situation in our case it's the next:

callback: (key: string) => /^[^a-z\s]+$/.test(key) ? translateService.get(key) : key

If you accept this suggestion and a PR is needed or wanted, I can do it.

@rafa-as sorry for the delay, had busy times. feel free to fire a PR and i'll approve.