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.

Translate filter incorrectly assumes this===scope

See original GitHub issue

Subject of the issue

When using the translate filter with a string argument, the filter uses $parse to parse the string, then evaluates the expression against this, assuming this is the current scope. But that is an incorrect assumption since Angular 1.3, see this commit:

https://github.com/angular/angular.js/commit/8863b9d04c722b278fa93c5d66ad1e578ad6eb1f

Your environment

  • version of angular-translate: 2.9.0
  • version of angular: 1.5.0
  • which browser and its version: Chrome 53

Steps to reproduce

Example: https://plnkr.co/edit/vBoO2V?p=preview

(The example show the non-working string-parse case and contrasts with the working object case.)

Expected behaviour

Since it’s not possible to evaluate the parsed string against the scope, the filter should probably throw an exception.

Actual behaviour

The parsed string is evaluated against this, which is undefined, which means that scope variables are not resolved.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
provegardcommented, Oct 13, 2016

Sure, I’ll fix!

0reactions
knallicommented, Feb 12, 2017

5cb94cb

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google Translate
No information is available for this page.
Read more >
LogStash translate filter ignored - Stack Overflow
Im trying to add a simple translation filter to convert port number in application name: filter { mutate { add_field ...
Read more >
Translate filter plugin | Logstash Reference [8.5] - Elastic
A general search and replace tool that uses a configured hash and/or a file to determine replacement values. Currently supported are YAML, ...
Read more >
Function 'chi2test' has already been declared within this scope ...
a reasonable assumption regarding the population distribution of a random sample X. % with the desired significance level ALPHA.
Read more >
one common problem - Polish translation – Linguee
Many translated example sentences containing "one common problem" – Polish-English dictionary and search engine for Polish translations.
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