Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular2 after upgrade Error encountered resolving symbol values statically

i had upgraded to the latest angular cli and now i get this error:

Error encountered resolving symbol values statically. Reference to a local (non-exported) symbol 'dictionary'. Consider exporting the symbol (position 12:7 in the original .ts file), resolving symbol TRANSLATION_PROVIDERS in C:/xampp/htdocs/milesofmusic/src/app/translate/translation.ts, resolving symbol AppModule in C:/xampp/htdocs/milesofmusic/src/app/app.module.ts, resolving symbol AppModule in C:/xampp/htdocs/milesofmusic/src/app/app.module.ts

the code it refers to is this:

// all traslations
const dictionary = {
    [LANG_EN_NAME]: LANG_EN_TRANS,
    [LANG_HE_NAME]: LANG_HE_TRANS,
};

// providers
export const TRANSLATION_PROVIDERS = [
    { provide: TRANSLATIONS, useValue: dictionary },
];

and in my app module i import import { TRANSLATION_PROVIDERS } from './translate/translation'; and have it in the providers array

how to fix it?

like image 364
Ron Avatar asked Mar 20 '26 20:03

Ron


1 Answers

const dictionary  = {
    [LANG_EN_NAME]: LANG_EN_TRANS,
    [LANG_FR_NAME]: LANG_FR_TRANS,

};

I am also getting the same error, so do one thing: directly write the language value instead of the brackets.

const dictionary  = {
    "en-US": LANG_EN_TRANS,
    "fr-FR": LANG_FR_TRANS,
};

Enjoy Happy Coding

like image 166
Rasal Shukla Avatar answered Mar 23 '26 15:03

Rasal Shukla



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!