akhil110 / ngtranslate2 Goto Github PK
View Code? Open in Web Editor NEWMultilingual web application using angular 2 and ng2-translate
Multilingual web application using angular 2 and ng2-translate
You had Home, Contact, About Component for all those you maintained single json file , for suppose our application is very big we need to maintain separate json files for individual component.
Home - i18n-en,fr json file.
Contact - i18n-en,fr json file
About - i18n-en,fr json file
In above cases, @akhil110 how could i do it ?
I have in app.module.ts:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app.routing.module';
import { TranslateModule, TranslateLoader } from 'ng2-translate';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
AppRoutingModule,
TranslateModule.forRoot()
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
and on my app.component.ts:
constructor(private authService: AuthService, private translate: TranslateService) {
translate.addLangs(["es", "en"]);
translate.setDefaultLang("es");
let browserLang = translate.getBrowserLang();
translate.use(browserLang.match(/es|en/) ? browserLang : "es");
}
But i've an error:
GET http://localhost:4200/i18n/es.json 404 (Not Found)
My i18n folder it's inside src/app.
Help me plz!! Thx
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.