angular translate instant method does not work

前端 未结 2 1438
一个人的身影
一个人的身影 2021-01-14 16:13

We have a website with angular translate. It works perfectly. We have a variable that we want to fixate with a certain language key. Let\'s say the site\'s language has \'en

2条回答
  •  一整个雨季
    2021-01-14 16:37

    It seems like you don't use the method correctly, or probably just misunderstood it.

    $translate.instant('ID') expects the translation id as first parameter and interpolation params as second parameter. It then translate the id synchronously instead of asynchronously (which is what $translate() does).

    What you want is explicitly translating a translation id in a certain locale no matter what language key is currently used. This is currently not supported yet.

    Hope that makes things clear.

提交回复
热议问题