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

Handle Variable Replacement with $translate Service #81

Open
rgant opened this issue Sep 7, 2016 · 0 comments
Open

Handle Variable Replacement with $translate Service #81

rgant opened this issue Sep 7, 2016 · 0 comments

Comments

@rgant
Copy link

rgant commented Sep 7, 2016

I have the following call to $translate in my app that isn't picked up by grunt-angular-translate:

$translate(['LOGIN.RECOVERY.FORM.MESSAGES.SUCCESS',
            'LOGIN.CREATE_NEW_PASSWORD.FORM.BUTTONS.CONFIRM'], {email: vm.email})

This is because the RegEx for matching these calls looks for a closing parenthesis immediately after the first parameter in the function call. But when using variable replacement feature you include a second parameter.

I suggest changing the final character in the RegExs to look for either a closing parenthesis or a comma.

From:

JavascriptServiceArraySimpleQuote: '\\$translate\\((?:\\s*(\\[\\s*(?:(?:\'(?:(?:\\.|[^.*\'\\\\])*)\')\\s*,*\\s*)+\\s*\\])\\s*)\\)',

To:

JavascriptServiceArraySimpleQuote: '\\$translate\\((?:\\s*(\\[\\s*(?:(?:\'(?:(?:\\.|[^.*\'\\\\])*)\')\\s*,*\\s*)+\\s*\\])\\s*)[,)]',

This would apply to all of the $translate patterns. If I have time later I will work up a pull request for this fix.

NKjoep added a commit to Onefootball/grunt-angular-translate that referenced this issue Jan 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant