Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2 Error encountered resolving symbol values statically

Tags:

angular

I have simple TranslationModule in Angular2 from this example. Now after an angular-cli update I get the mentioned error but I don't know what I have to change here:

import {NgModule} from "@angular/core";
import {TranslatePipe} from "./translate.pipe";
import {TRANSLATION_PROVIDERS} from "./translations";
import {TranslateService} from "./translate.service";

@NgModule({
  declarations: [
    TranslatePipe
  ],
  providers: [
    TRANSLATION_PROVIDERS,
    TranslateService
  ],
  exports: [
    TranslatePipe
  ]
})
export class TranslateModule {
}

And the translation.ts

import {OpaqueToken} from '@angular/core';

// import translations
import {LANG_EN_US_NAME, LANG_EN_US_TRANS} from './lang-en_US';
import {LANG_DE_DE_NAME, LANG_DE_DE_TRANS} from './lang-de_DE';

// translation token
export const TRANSLATIONS = new OpaqueToken('translations');

// default language
export const DEFAULT_LANG = "en_US";

// all translations
export const dictionary = {
  [LANG_EN_US_NAME]: LANG_EN_US_TRANS,
  [LANG_DE_DE_NAME]: LANG_DE_DE_TRANS
};

// providers
export const TRANSLATION_PROVIDERS = [
  {provide: TRANSLATIONS, useValue: dictionary}
];
like image 568
Pascal Avatar asked Jan 30 '17 09:01

Pascal


1 Answers

Try to change the keys to static values like:

export const dictionary = {
  'en': LANG_EN_US_TRANS,
  'de': LANG_DE_DE_TRANS
};
like image 196
yurzui Avatar answered Sep 28 '22 15:09

yurzui