Skip to content
This repository was archived by the owner on Jan 29, 2024. It is now read-only.
This repository was archived by the owner on Jan 29, 2024. It is now read-only.

$translateMessageFormatInterpolationProvider injection error #1856

Open
@Feffy

Description

@Feffy

Subject of the issue

Since I added angular-translate-interpolation-messageformat to my app I have injection issues and I get the following error message:
Error: [$injector:unpr] http://errors.angularjs.org/1.6.2/$injector/unpr?p0=%24translateMessageFormatInterpolationProvider%20%3C-%20%24translateMessageFormatInterpolation%20%3C-%20%24translate

This does not show up everytime, it is actually quite random...

Your environment

  • version of angular-translate: 2.18.1
  • version of angular: 1.6.2
  • which browser and its version: Firefox 59.0.2

I also use requireJS for DI, here's my configuration:

app.js

define([
    ...
    'angular-translate',
    'angular-translate-interpolation-messageformat',
    'messageformat',
    ....
  ],
  function (...,  angularTranslate, angularTranslateInterpolation, messageformat, ...) {

    'use strict';

    var app = angular.module('myApp', [
       ...,
      'pascalprecht.translate',
      ...
    ]);
    app.config([..., '$translateProvider', function (..., $translateProvider) {
       $translateProvider
         .translations('fr', i18n.translationsFR)
         .translations('en', i18n.translationsEN)
         .preferredLanguage('fr')
         .useSanitizeValueStrategy('escapeParameters')
         .useMessageFormatInterpolation();
    }]);

main.js

var config = require.s.contexts._.config;

/* RequireJS config overriding */
config.paths['commons'] = './bower_components';
config.paths['myApp'] = './scripts';
config.paths['jquery'] = config.paths['commons'] + '/jquery/dist/jquery.min';
config.paths['jqueryui'] = config.paths['commons'] + '/jquery-ui/jquery-ui.min';
config.paths['angular'] = config.paths['commons'] + '/angular/angular.min';
config.paths['angular-translate'] = config.paths['commons'] + '/angular-translate/angular-translate.min';
config.paths['angular-translate-interpolation-messageformat'] = config.paths['commons'] + '/angular-translate-interpolation-messageformat/angular-translate-interpolation-messageformat';
config.paths['messageformat'] = config.paths['commons'] + '/messageformat/messageformat';


// = paths;
config.shim = {
  'jquery': {exports: 'jquery'},
  'jqueryui': {deps: ['jquery'], exports: 'jqueryui'},
  'angular': {deps: ['jquery'],exports: 'angular'},
  'messageformat': {exports:'messageformat'},
  'angular-translate': {deps: ['angular'], exports: 'angularTranslate'},
  'angular-translate-interpolation-messageformat' : {
    deps: ['angular-translate', 'messageformat'],
    exports: 'angularTranslateInterpolation'
  }
};

config.priority = ['jquery', 'angular', 'jqueryui'];
require.config(config);

require(['myApp/app', 'myApp/preferences'], function (app, preferences) {
  preferences.init();

  // Init angular application
  app.init();
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions