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.
Unfortunately, activation email could not send to your email. Please try again.

Translation of headertext with angular-translate

Thread ID:

Created:

Updated:

Platform:

Replies:

121780 Jan 25,2016 09:42 AM Jan 27,2016 10:49 PM JavaScript 3
loading
Tags: ejGrid
Antonio Terron
Asked On January 25, 2016 09:42 AM

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


Gowthami V [Syncfusion]
Replied On January 26, 2016 01:13 PM

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.


Antonio Terron
Replied On January 27, 2016 03:46 AM

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}' }

];


Ragavee U S [Syncfusion]
Replied On January 27, 2016 10:49 PM

Hi Antonio,

Thanks for your update.

We are happy that your issue is resolved.

Regards,
Ragavee U S.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;