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.
@PascalPrecht This feature is already implemented but you right I miss to update the doc! Damn :)
https://github.com/firehist/grunt-angular-translate/blob/master/tasks/angular-translate.js#L31
https://github.com/firehist/grunt-angular-translate/blob/master/test/fixtures/index.html#L13
https://github.com/firehist/grunt-angular-translate/blob/master/test/angular-translate_test.js#L39
@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!