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

add missing tokenRegex argument #120

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

add missing tokenRegex argument #120

wants to merge 1 commit into from

Conversation

fabianmieller
Copy link

No description provided.

Polyglot.transformPhrase = function transform(phrase, substitutions, locale) {
return transformPhrase(phrase, substitutions, locale);
Polyglot.transformPhrase = function transform(phrase, substitutions, locale, tokenRegex) {
return transformPhrase(phrase, substitutions, locale, tokenRegex);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was intentionally not provided - see #64 (comment)

@fabianmieller
Copy link
Author

fabianmieller commented Jul 23, 2018

@ljharb
I'm using a custom interpolations and when the onMissingKey case happens i want to use the Polyglot.transformPhrase function with the tokenRegEx parameter. Currently this is not possible and the default token regex is used and i can't pass the customized interpolation regex.

const polyglot = new Polyglot({

    interpolation: {
        prefix: '%',
        suffix: '%',
    }

    onMissingKey(key, interpolations, locale, tokenRegEx) {

        // ....

        return Polyglot.transformPhrase(key, interpolations, locale, tokenRegEx);
    }

});

@ljharb ljharb marked this pull request as draft November 29, 2023 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants