angular-translate/grunt-angular-translate

Add support for custom interpolation symbols (angular templates)

pbellon opened this issue · 8 comments

For the moment only the {{ }} syntax is supported for angular templates. If user had set some custom symbols like [[ ]] it will not detect them.

<!-- will work --> 
<h1 translate="TEST"></h1>
<h1>{{ 'TEST' | translate }}</h1>
<!-- will not work -->
<h1>[[ 'TEST' | translate ]]</h1>

I'm ready to work on a pull-request to add this custom support.

I was thinking of an option in the i18nextract configuration:

i18nextract: {
  template: {
    startSymbol: "[[" // default value: {{
    endSymbol: "]]"   // default value: }} 
  }
}

@pbellon I would rename the property interpolation rather than template . And then something like

interpolation: {
    startDelimiter: '[[',
    endDelimiter: ']]'
}

My 2 cents.

More concise and clean, I'll keep this notation, thanks !
EDIT: I just saw the startDelimiter instead of startSymbol but I think I will stick to the $interpolateProvider configuration syntax.

Hey guys, @pbellon @PascalPrecht
Sorry about my latency answer but I never followed a lot my GitHub.
I'll try to implement it quickly.

@firehist how about letting this one open until you've implemented it? :)

@firehist Sounds great! Then please update the docs, by the way as soon as we have moved to the organization, the docs for grunt-angular-translate could be part of angular-translate docs :)

@PascalPrecht Cool.

Doc updated!