Comments (6)
Thanks.
A PR fixing the regexp in PipeParser is welcome!
from ngx-translate-extract.
I'm not sure how to support both:
<button [attr]="'Hello World' | translate"></button>
... and ...
<button [style.background]="'lime'">{{ 'Hello World' | translate }}</button>
... at the same time. Any ideas?
This is the current regexp: https://github.com/biesbjerg/ng2-translate-extract/blob/master/src/parsers/pipe.parser.ts#L18
from ngx-translate-extract.
I cannot make a PR right now, unfortunately.
But this works for the test cases I copied from your pipe-test.
I've added >
to the 'except-group'.
https://regex101.com/r/wLb8us/2
from ngx-translate-extract.
Thanks!
Fixed in fcd37fd
from ngx-translate-extract.
This issue is still existing with services.
trans.get("You are expected at {{time}}", {time: moment.format('H:mm')}).subscribe(text => {
returns in:
"You are expected at {{time}}', {time: resDate.format('H:mm": "",
from ngx-translate-extract.
I can't reproduce. I added a test that is passing for me:
it('should extract strings with params', () => {
const contents = `
@Component({ })
export class AppComponent {
public constructor(protected trans: TranslateService) { }
public test() {
trans.get("You are expected at {{time}}", {time: moment.format('H:mm')}).subscribe();
}
}
`;
const keys = parser.extract(contents, componentFilename).keys();
expect(keys).to.deep.equal(['You are expected at {{time}}']);
});
Also, the first string you provided in your comment uses a different parameter value than the extracted one, which leads me to believe it is another string you are having problems extracting?
from ngx-translate-extract.
Related Issues (20)
- Array value erased when extract
- Extraneous path dependency?
- Angular 13 issue HOT 51
- Extract Parser error with Array.map & join
- Key 'constructor' is not parsed HOT 1
- Translations are not extracted from object in html template
- Not working with already interpolated strings and translateParams directive
- Dynamic string in translate instant
- Translation when using <ng-content>
- Allow translation files as inputs to prevent duplicate keys in an Angular workspace
- No updates in almost a year. Is this project dead? HOT 3
- my steps and how solve my error HOT 1
- Found 0 strings. HOT 1
- Getting Error while generating extracts- Ng Version -14.0.1 HOT 5
- [Question] Can we have html tags in translation strings? HOT 1
- Labels in html files preceded by variable are not found
- How can you sort by only adding new line at the bottom
- Is there a way to extract the default values from pipes
- Error generating with Angular 16 HOT 1
- Key in angular 17 new control flow get cleaned HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-translate-extract.