Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Refresh a part of translation #1595

Open
teo89 opened this issue Sep 22, 2016 · 1 comment
Open

Refresh a part of translation #1595

teo89 opened this issue Sep 22, 2016 · 1 comment

Comments

@teo89
Copy link

teo89 commented Sep 22, 2016

Subject of the issue

I am using $translatePartialLoader and load translation with get function. But i saw that if i load a part for a first time and i want after that to reload to get current translations i can't do that. Even if i use
$translatePartialLoader.deletePart()
$translatePartialLoader.addPart(part);
$translate.refresh();
My get function never called again. I want to reload my part from database. How i can diactivate cache from translation? I have seen also #988 and i switch to master but nothing change.

Your environment

"angular-translate": "2.12.1"
"angular": "1.5.8"
in all browsers and latest versions

Steps to reproduce

load a part delete it and try to load it again from database

Expected behaviour

load as much times i want without caching

Actual behaviour

caches part even if i deleted and added again

@jmayday
Copy link

jmayday commented Jul 6, 2017

I know that this is old question but I just found it and have simple answer so maybe it's helpful for someone.

Code on your side was buggy as you should use overloaded deletePart which takes removeData boolean flag. It was present in angular-translate 2.12.1.

   * @param {boolean=} [removeData=false] An indicator if the loader has to remove a loaded
   * translation data physically. If the `removeData` if set to **false** the loaded data will not be
   * deleted physically and might be reused in the future to prevent an additional xhr requests.
$translatePartialLoader.deletePart(part, true)
$translatePartialLoader.addPart(part);
$translate.refresh();

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

No branches or pull requests

3 participants