如何将 ng-repeat 项作为值传递给 Angular 翻译?

How to pass a ng-repeat item as a value into Angular Translate?

显示比解释更容易。我正在尝试这样做...

<div ng-repeat="label in itemLists">
   <input id="{{label}}" type="checkbox">
   <label for="{{label}}">{{'food.items.{{label}}' | translate}}</label>
</div>

带有 {{label}} 的翻译是问题所在。如果我使用 food.items.cheese 它会起作用。

itemLists 的内部是

['lettuce', 'cheese', etc...]

食品是

{
            "lettuce": "Lettuce",
            "cheese": "American Cheese",
            etc...
        }

您不能在 {{}} 中包含 {{}}。
'food.items.' + label怎么样?