Skip to content

add missing tokenRegex argument#120

Draft
fabianmieller wants to merge 1 commit into
airbnb:masterfrom
fabianmieller:patch-1
Draft

add missing tokenRegex argument#120
fabianmieller wants to merge 1 commit into
airbnb:masterfrom
fabianmieller:patch-1

Conversation

@fabianmieller

Copy link
Copy Markdown

No description provided.

Comment thread index.js
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
Copy Markdown
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

fabianmieller commented Jul 23, 2018

Copy link
Copy Markdown
Author

@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