ngx-translate / core

The internationalization (i18n) library for Angular
MIT License
4.53k stars 579 forks source link

unable to translate in angular 5 #889

Open Robert-Janagap opened 6 years ago

Robert-Janagap commented 6 years ago

app.module.ts import { TranslateModule, TranslateLoader } from '@ngx-translate/core'; import { TranslateHttpLoader } from '@ngx-translate/http-loader'; import { HttpClient, HttpClientModule } from '@angular/common/http';

// required for AOT compilation export function HttpLoaderFactory(http: HttpClient) { return new TranslateHttpLoader(http); }

imports: [
BrowserModule, ScrollToModule.forRoot(), NgbModule.forRoot(), ImageUploadModule.forRoot(), AppRoutingModule, FormsModule, RouterModule, PublicModule, SharedModule, PrivateModule, HttpClientModule, TranslateModule.forRoot({ loader: { provide: TranslateLoader, useFactory: HttpLoaderFactory, deps: [HttpClient] } }), HttpClientInMemoryWebApiModule.forRoot( InMemDataService, { delay: 60, passThruUnknownUrl: true, dataEncapsulation: false } ), CoreModule, ]

app.component.ts import { TranslateService } from '@ngx-translate/core';

export class AppComponent {

constructor(private translate: TranslateService) { translate.setDefaultLang('de'); translate.use('de'); }

}

home.component.html

demo.title

de.json { "demo": { "title": "This is a test title", } }

ansarikhurshid786 commented 6 years ago

what is the error. is there any error or warning log?

Robert-Janagap commented 6 years ago

Hi

No worries, it's already working

Thanks, Robert

On Mon, Sep 17, 2018, 6:55 PM Khurshid notifications@github.com wrote:

what is the error. is there any error or warning log?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ngx-translate/core/issues/889#issuecomment-421967391, or mute the thread https://github.com/notifications/unsubscribe-auth/AI1Pxw9jQ-yBqsE1cF4ZDKuWTFTJSU60ks5ub3-rgaJpZM4VMKhb .