m-e-conroy / angular-dialog-service

A complete AngularJS service with controllers and templates for generating application modals and dialogs for use with Angular-UI-Bootstrap and Twitter Bootstrap
MIT License
618 stars 227 forks source link

Translations not working in 5.1.1 unless I manually include default-translations. #53

Closed katowulf closed 10 years ago

katowulf commented 10 years ago

Hello. Feel free to close this issue if this is intended behavior. If so, some guidance in the docs would be useful here.

I used bower install angular-dialog-service:

angular-dialog-service#5.1.1 app/bower_components/angular-dialog-service
├── angular#1.3.0-beta.17
├── angular-bootstrap#0.11.0
├── angular-sanitize#1.3.0-beta.17
├── angular-translate#2.1.0
└── bootstrap#3.1.1

But when I attempt to invoke dialogs.error() (or any of the other commands) the translations are not taking effect.

image

By running the debugger, I discovered that dialog.default-translations is not being invoked. I don't see that module listed as a dependency in dialogs.js. Is it my job to include that dependency? That seems odd as I don't see that in any of the active examples or docs, and also because I don't even need to include the translations lib (pascalprecht.translate) as that is included by dialogs.js.

Here's my repro in case that matters, which I don't think it does.

angular.module('app', [
   "ngCookies", "ngResource", "ngSanitize", "ui.bootstrap", "dialogs.main", "ui.router"
    // uncommenting this next line fixes the error
   // "dialogs.default-translations"
])
    .controller('testDialogs', function($scope, $rootScope, $timeout, dialogs) {
      $scope.launch = function() {
        dialogs.error();
      }
    })

Hope that helps!

Cheers,

m-e-conroy commented 10 years ago

At request by those already using Angular Translate in their applications I had to separate out the actual translations into its own module because it would automatically clobber translations already set for 'en-US' elsewhere in their application. if you look at the v5.1.0 #2 change on the repo's README, you'll see that you need to include the translation module or set the translations yourself somewhere if you're already using Angular-Translate. I'll add it as a dependency, so that its pulled down during a bower installation.

Sorry for the late reply I'm playing catch up after a long vacation and then having to catch up on work for my day job.

m-e-conroy commented 10 years ago

Actually I just looked at the bower.json file and the default translation module should be pulled down along with dialogs.min.css and dialogs.min.js

I can't add it as a dependency as this would interfere with applications already using translation elsewhere.

I'll have to make the instructions clearer.

katowulf commented 10 years ago

Cheers, and thanks for the great module, as well as the reply.

m-e-conroy commented 10 years ago

@katowulf Thanks, and I apologize for not getting back to you sooner.