Home angularjs $ translate, instant. How to work with it? How to translate only...

$ translate, instant. How to work with it? How to translate only some word?

Author

Date

Category

In the controller there is $ scope which you want to output \ transmit in a certain language, despite the fact that language is currently selected by the user.
How to implement it? How to translate the piece I need (then a variable or something else) to the desired language?

read Hyde and found something about Instant (TranslationID, InterpolateParams, InterpoPolationID, Forcelanguage, Sanitizestrategy)

So far I can not understand how to use it.


Answer 1

$ translate.instant (translationid, interpolateparams, interpolationid, forcelanguage, sanitizestrategy);
  • translationid – what to translate

  • interpolateparams – the parameters that will be used in the translation template. For example, if the translation text is: count: {{count}} You can transfer the value to be used instead of Count and get “Count: 10”, or “Count: 20”

  • interpolationid – ID of a specific interpolator (if any)

  • forcelanguage – language to which change

  • sanitizestrategy is a view in which we give

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions