Kendo Globalization/Localization with angular-translate

Thread is closed for posting
1 posts, 0 answers
  1. D1CEB206-1CD8-4D32-ABC2-413EC2DA3F2C
    D1CEB206-1CD8-4D32-ABC2-413EC2DA3F2C avatar
    21 posts
    Member since:
    Feb 2014

    Posted 17 Sep 2014 Link to this post

    Requirements

    Telerik Product and Version

    Kendo 2014.2.903           

    Supported Browsers and Platforms

    All

    Components/Widgets used (JS frameworks, etc.)

    AngularJS, angular-translate.
    Kendo UI Grid, Calendar, DropDownList.

    PROJECT DESCRIPTION 
    The project demonstrates how change the kendo.culture and widget messages using angular-translate $languageProvider
    change: function() {
      /* The kendo.culture.xx-XX.js files can be pre-loaded in the <head> section of the document, but the kendo.messages.xx-XX.js file should be loaded on demand when the language is about to change */
       
      /* We are using the jQuery.getScript method to load the messages file and use the callback function to change the kendo culture, kendo messages and angular-translate language */
       
      $.getScript("http://cdn.kendostatic.com/2014.2.903/js/messages/kendo.messages." + $scope.lang + ".min.js", function() {
         
        /* $scope.$apply should be used in order to notify the $scope for language change */
        $scope.$apply(function() {
           
          $translate.use($scope.lang); /* change angular-translate language */
          kendo.culture($scope.lang); /* change kendo culture */
           
          /* we use dummy language option in order to force the Grid to rebind */
          $scope.mainGridOptions.language = $scope.lang;
           
          /* we change the calendar widget culture option in order to force the Calendar to rebind */
          $scope.calendarOptions.culture = $scope.lang;
        })
      });
Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.