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

No translation on nested templates #217

Open
florea-g opened this issue Aug 30, 2016 · 8 comments
Open

No translation on nested templates #217

florea-g opened this issue Aug 30, 2016 · 8 comments

Comments

@florea-g
Copy link

The translation doesn't work on nested templates.
It is something i must do to make this work?

@ocombe
Copy link
Member

ocombe commented Aug 30, 2016

I'm sorry but you don't give enough details.
What nested templates ?

@florea-g
Copy link
Author

florea-g commented Aug 30, 2016

Like this:

@Component({
    selector: 'parent-template',
    template: '
     <p>{{'Title' | translate}}</p>
    <child-template></child-template>
    '
})

Everything in child template will be displayed like:
{{'Exemple' | translate}}--> this is displayed on the view and not the traduction

@ocombe
Copy link
Member

ocombe commented Aug 30, 2016

What's in child template ?

@florea-g
Copy link
Author

florea-g commented Aug 30, 2016

Something like this :

        <div class="ui-grid-row">
            <div class="ui-grid-col-4">
                <label for="Name">{{ 'MANAGE-BROKER.CoWorkerName' | translate }}</label>
            </div>
            <div class="ui-grid-col-8">
                <input pInputText name="Name" [(ngModel)]="newBrokercoworker.Name" />
            </div>
        </div>

@ocombe
Copy link
Member

ocombe commented Aug 30, 2016

So {{ 'MANAGE-BROKER.CoWorkerName' | translate }} isn't working but {{'Title' | translate}} is ?
Any chance you could make me a plunkr?

@florea-g
Copy link
Author

Yes that is correct.
I will try to make a plunker :)

@florea-g
Copy link
Author

Here is the plunker:
plunker
Apparently it works. I don't know whi it doesn't work for me maybe because i use template url.s or becase i am deelaying the component construct because some variables are not initialized. I don't know :(

@dhardtke
Copy link
Contributor

dhardtke commented Sep 7, 2016

I forked your plunker to reflect changes that are close to my configuration of angular 2 rc.6 and ng2-translate:
http://plnkr.co/edit/FLxhvZUH2jfvHr4ZAoga?p=preview

As you can see, the translations are not being loaded / applied in home.component.ts whereas if I put the constructor's code inside the HomeComponent everything works fine.

This is not practical since I have ng2-translate's initialization code inside my AppComponent and therefore I think it's a bug.

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

3 participants