Skip to content

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