Comments (3)
Tip: If you still have to deal with the time until its loaded, you may have a look at $translate.onReady() or translate-cloak.
from angular-translate.
Hi @Agustin-Q
that's is interesting finding. The feature is really a couple of years old, but no one has issued this one. Unfortunately, the project more or less deprecated as angular (Angular JS 1.x) itself is deprecated also. Speaking of this, you are aware not using the latest versions?
However, you may look into it for a fix. Yes, it looks like the directive should resolve the well-known (static) defined value, but instead waiting for the async loaded one. On other hand, a service call to $translate(…)
should maybe resolve to the right one? Nevertheless, this would be a breaking change, so I would recommend a flag for this.
The directive is calling the service here with already a couple of flags.
angular-translate/src/directive/translate.js
Lines 294 to 299 in 1114534
... which invokes the service function here:
angular-translate/src/service/translate.js
Line 1124 in 1114534
In detail, these lines wait for the existing (async) load and could maybe modified not waiting for the load.
angular-translate/src/service/translate.js
Lines 1177 to 1204 in 1114534
In specific this line
angular-translate/src/service/translate.js
Line 1178 in 1114534
"finds" the existing promise.
Feel free providing the solution here or making up a PR.
Thank you.
from angular-translate.
Hi @knalli
Thanks for the detailed response I will look into a possible fix.
For the time being I think I can use the following workaround with forceAsyncReload
disabled:
app.run(["$translate", function($translate){
$translate.onReady(function(){
$translate.refresh($translate.use());
});
}]);
As I only need to load the async translations once.
Kind regards
from angular-translate.
Related Issues (20)
- Use templated string as key HOT 1
- bower repo doesn't have latest release tag HOT 3
- De-cloaking broken in 2.18.2 HOT 4
- Default interpolationParams allows access to function constructor HOT 1
- translate dynamic content loaded with ajax HOT 1
- How to use UI router with angular translate? HOT 1
- [email protected] support HOT 5
- translate-sanitize-strategy HOT 4
- “SameSite” attribute warning HOT 1
- Not changing languages on ng-click
- Cookie “NG_TRANSLATE_LANG_KEY” will be soon rejected because it has the “SameSite” attribute set to “None” or an invalid value, without the “secure” attribute. HOT 9
- Two Languages at same time HOT 1
- IOS cordova When i upgrade the AngularJs to 1.8.2 the words will be missed which was been translated. HOT 1
- Using AngularJS Filters with Pluralization via MessageFormat HOT 1
- $translatePartialLoader.doesnot allow ë à á characters HOT 4
- $translate.instant with angular expression HOT 1
- Partial loading can fail silently without any hints HOT 1
- $translateStaticFilesLoader should behave gracefully when one of translations cannot be loaded HOT 1
- Team awareness required: Future project state HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-translate.