Git Product home page Git Product logo

Comments (6)

biesbjerg avatar biesbjerg commented on July 30, 2024

Thanks.

A PR fixing the regexp in PipeParser is welcome!

from ngx-translate-extract.

biesbjerg avatar biesbjerg commented on July 30, 2024

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.

pfoedermayr avatar pfoedermayr commented on July 30, 2024

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.

biesbjerg avatar biesbjerg commented on July 30, 2024

Thanks!

Fixed in fcd37fd

from ngx-translate-extract.

Woutwo avatar Woutwo commented on July 30, 2024

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.

biesbjerg avatar biesbjerg commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.