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

'translateparams' directive in the example usage is not working. #355

Closed
manumqln opened this issue Dec 11, 2016 · 9 comments
Closed

'translateparams' directive in the example usage is not working. #355

manumqln opened this issue Dec 11, 2016 · 9 comments

Comments

@manumqln
Copy link

manumqln commented Dec 11, 2016

'translateparams' directive in the statement '<div [translate]="'HELLO'" [translateparams]="{param: 'world'}">' is not working. It seems like P should be in uppercase for 'translateparams'?

Even though the case is corrected to uppercase, the 'translate' directive does not seem to be working as expected. No error listed on the console. However 'innerHTML' directive is working fine for me.

Can anyone help? Is this a bug or my mistake?

@manumqln manumqln changed the title 'translateparams' directive in the statement '<div [translate]="'HELLO'" [translateparams]="{param: 'world'}"></div>' is not working. It seems like P should be uppercase for 'translateparams'? 'translateparams' directive in the statement is not working. Dec 11, 2016
@manumqln manumqln changed the title 'translateparams' directive in the statement is not working. 'translateparams' directive in the example usage is not working. Dec 11, 2016
@ocombe
Copy link
Collaborator

ocombe commented Dec 12, 2016

Hi, you're right it should be translateParams, not sure what happened in the readme, I fixed it.

How is it not working as expected (once you've set the correct translateParams)

@manumqln
Copy link
Author

If you assign the language key to the translate directive, it will not work. But if you use simpler method specified in the readme (specifying the language key inside the innerhtml of the element), it will work. I got the same issue in your plunker example too.

I am not sure if I am doing anything wrong here. Can you please check?

Thanks in advance

@ocombe
Copy link
Collaborator

ocombe commented Dec 12, 2016

The directive is quite new, so it's possible that it's still buggy in a few use cases that I didn't test correctly.
I'll check :)

@HereThereBeMonsters
Copy link

I just upgraded from 4.0 to 4.2 and I am trying out the directive.

I can confirm that, regardless if translateParams is present or not, this works:

<div translate >MY.TEXTKEY</div>

But this doesn't:

<div [translate]="MY.TEXTKEY"></div>

In the second case, there is no error in the console, but no text is displayed in the div.

@ilDon
Copy link

ilDon commented Dec 23, 2016

Same problem here with:

  • "@angular/common": "2.2.1",
  • "ng2-translate": "^5.0.0",

Before noticing this bug I had opened a SO question: http://stackoverflow.com/questions/41295910/ng2-translate-directive-not-working-while-pipe-is/41296133#41296133

@boughioul
Copy link

boughioul commented Jan 8, 2017

Hello same problem here, if you use this :
<div [translate]="'HELLO'" [translateParams]="{value: 'world'}"></div>
It doesn't work but if you put inner text they work
<div [translate]="'HELLO'" [translateParams]="{value: 'world'}">test</div>

@ocombe ocombe added this to the 6.0.0 milestone Feb 3, 2017
@desaroger
Copy link

Same problem here. Using:

  • "@angular/common": "^2.2.1"
  • "ng2-translate": "^5.0.0"

The @boughioul workaround makes it work.

@desaroger
Copy link

Thanks @ocombe! :D

@ocombe
Copy link
Collaborator

ocombe commented Mar 23, 2017

Fixed in 6.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants