We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Translation of headertext with angular-translate

I'm using  angular-translate (https://github.com/angular-translate/angular-translate)  for internationalization and localization of my application but I'm not able to translate headertext for columns...

I've tried this :

$translate(['ROOM', 'CUSTNAME', 'DATE', 'CALLS', 'AMOUNT']).then(function (trans) {

$scope.cols = [

{ field: "ID", width: 150, visible: false },

{ field: "Extension", headerText: trans.ROOM, width: 180 },

{ field: "CustName", headerText: trans.CUSTNAME, width: 175 },

{ field: "Datetime", headerText: trans.DATE, width: 175},

{ field: "Calls", headerText: trans.CALLS, width: 180},

{ field: "Amount", headerText: trans.AMOUNT, width: 110 }

];

});

but simply the grid does not appear...

Can you please provide any clues? Can the angular-translate directives be used instead of trying to tranlate in the controller?

Thank you in advance


3 Replies

GV Gowthami V Syncfusion Team January 26, 2016 06:13 PM UTC

Hi Antonio,

We are unable to reproduce the issue and please provide us below details,

1.    If you got below script error,





Then refer to the below link for more information,

https://docs.angularjs.org/error/$injector/unpr?p0=$translateProvider%20%3C-%20$translate%20%3C-%20PhoneListCtrl

2.    Share the script error details from console if any other.

3.    Share the full code example that you have used to render the grid.

Regards,

Gowthami V.



UN Unknown Syncfusion Team January 27, 2016 08:46 AM UTC

Thank you for your answer. I've resolved this issue changing the way I translate the columns header.

Now I'm using the $filter service:

$scope.cols = [

{ field: "CheckoutID", width: 150, visible: false },

{ field: "Extension", headerText: $filter('translate')('ROOM'), width: 180 },

{ field: "CustName", headerText: $filter('translate')('CUSTOMERNAME'), width: 175 },

{ field: "DateTime", headerText: $filter('translate')('DATE'), width: 175, format: dateformat},

{ field: "Calls", headerText: $filter('translate')('CALLS'), width: 180, textAlign: "right", headertextAlign: "right" },

{ field: "Amount", headerText: $filter('translate')('AMOUNT'), width: 110, textAlign: "right", headertextAlign: "right", format: '{0:N2}' }

];



RU Ragavee U S Syncfusion Team January 28, 2016 03:49 AM UTC

Hi Antonio,

Thanks for your update.

We are happy that your issue is resolved.

Regards,
Ragavee U S.

Loader.
Up arrow icon