question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Refresh translation with params after param value changes

See original GitHub issue

Hi, I’m trying to know if its possible to reload a certain translation which holds a parameter when the param value changes.

json

{
    "HELLO": "hello {{value}}"
}

html <button (click)="change()">{{ 'HELLO' | translate:param }}</button>

component

constructor(private translate: TranslateService) {
     ...
}
param = {value: 'world'};

change(){
       this.param.value = 'earth';
       //this.translate.use(this.translate.currentLang);
       //this.translate.resetLang(this.translate.currentLang);
      //this.translate.reloadLang(this.translate.currentLang);
}

I’ve tryed to force the translation to re-translate again when clicking the button by calling the methods from the translate service commented above but it didn’t work. Is this something possible to do? Thanks in advance, the library is great!

I’m Using library version 9 since this is from an Angular 5 project

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:8

github_iconTop GitHub Comments

10reactions
Qocotzxincommented, Jul 4, 2018

@rmartin94 Did you find a solution? This is driving me crazy right now and it seems nobody is posting a good workaround

8reactions
cesar2064commented, Apr 10, 2019

I could refresh the params, but I had to replace the whole object with a new object, instead of replacing each property in the old params object.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is possible to reload component when url param changes in ...
I have route called 'partners' and when path is hitting 'partners/:slug' i'm listening for activatedRoute changes to update translated title.
Read more >
Reloading Components when change in Route Params
These values will be calculated for the first load of the component and they won't change unless you reload the page. Why could...
Read more >
How to change published parameter value after run time
I am running FME 2011. I would like to change the value of a published parameter during a translation (i.e. overide what was...
Read more >
Connection refresh for queries with parameters not giving ...
If you click the card for the connector it should expand and you can change the parameter value, before clicking the refresh button....
Read more >
Common Routing Tasks - Angular
The application name in the following example is routing-app . ... example uses a variable, name , and assigns it the value based...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found