2015-12-03 1 views
1

Je veux traduire mes éléments panés comme ceci:Traduire AngularJS Fil d'Ariane dans le stateprovider

url: moduls/1/question

Fil d'Ariane: Moduls -> Modul 1 -> Question

Le problème est la partie "Modul 1". Ma traduction en est

"MODUL_TAG": "Modul {{short}}" 

breadcrumbtemplate:

<ol class="navbar-nav list-unstyled"> 
    <li ng-repeat="step in steps" ng-class="{active: $last}" ng-switch="$last || !!step.abstract"> 
     <a ng-switch-when="false" href="{{step.ncyBreadcrumbLink}}" title="{{ step.ncyBreadcrumbLabel }}">{{step.ncyBreadcrumbLabel | translate:translationData }}</a> 
     <span ng-switch-when="true">{{step.ncyBreadcrumbLabel | translate:translationData }}</span> 
    </li> 
</ol> 

État:

.state('modul.show', { 
    url: "/{short}", 
    templateUrl: "partials/modul/show.html", 
    controller: "ModulShowCtrl", 
    ncyBreadcrumb: { 
     label: "MODUL_TAG" 
    } 
}) 

Le problème est que je ne sais pas où je dois placer les données-traduire.

Je l'ai essayé avec le ModulShowCtrl mais sans succès.

$scope.$parent.translationData = { 
    short: $stateParams.modulId 
}; 

Répondre

1

Vous devez traduire votre fil d'Ariane dans la définition de l'État, comme ceci:

.state('modul.show', { 
    url: "/{short}", 
    templateUrl: "partials/modul/show.html", 
    controller: "ModulShowCtrl", 
    ncyBreadcrumb: { 
     label: '{{ "MODUL_TAG" | translate }}' 
    } 
})