diff --git a/dsynth/package-lock.json b/dsynth/package-lock.json
index bc7991e..a60b181 100644
--- a/dsynth/package-lock.json
+++ b/dsynth/package-lock.json
@@ -1304,6 +1304,19 @@
}
}
},
+ "@ngx-translate/core": {
+ "version": "12.1.2",
+ "resolved": "https://registry.npmjs.org/@ngx-translate/core/-/core-12.1.2.tgz",
+ "integrity": "sha512-ZudJsqIxTKlLmPoqK8gJY3UpMGujR0Xm7HfXL6AR79yGRS23QqpjAhMfx4v5qUCcHMmQ9/78bW8QJLfp31c7vQ=="
+ },
+ "@ngx-translate/http-loader": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/@ngx-translate/http-loader/-/http-loader-4.0.0.tgz",
+ "integrity": "sha512-x8LumqydWD7eX9yQTAVeoCM9gFUIGVTUjZqbxdAUavAA3qVnk9wCQux7iHLPXpydl8vyQmLoPQR+fFU+DUDOMA==",
+ "requires": {
+ "tslib": "^1.9.0"
+ }
+ },
"@schematics/angular": {
"version": "9.0.6",
"resolved": "https://registry.npmjs.org/@schematics/angular/-/angular-9.0.6.tgz",
diff --git a/dsynth/package.json b/dsynth/package.json
index 5637995..9ee9fe7 100644
--- a/dsynth/package.json
+++ b/dsynth/package.json
@@ -21,6 +21,8 @@
"@angular/platform-browser": "~9.0.6",
"@angular/platform-browser-dynamic": "~9.0.6",
"@angular/router": "~9.0.6",
+ "@ngx-translate/core": "^12.1.2",
+ "@ngx-translate/http-loader": "^4.0.0",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
diff --git a/dsynth/src/app/app.component.css b/dsynth/src/app/app.component.css
deleted file mode 100644
index e69de29..0000000
diff --git a/dsynth/src/app/app.component.html b/dsynth/src/app/app.component.html
index fdb0503..4afcada 100644
--- a/dsynth/src/app/app.component.html
+++ b/dsynth/src/app/app.component.html
@@ -1,623 +1,16 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ title }} app is running!
-
-
-
-
-
-
-
Resources
-
Here are some links to help you get started:
-
-
-
-
-
Next Steps
-
What do you want to do next with your app?
-
-
-
-
-
-
-
-
New Component
-
-
-
-
-
-
Angular Material
-
-
-
-
-
-
Add PWA Support
-
-
-
-
-
-
Add Dependency
-
-
-
-
-
-
Run and Watch Tests
-
-
-
-
-
-
Build for Production
-
-
-
-
-
-
ng generate component xyz
-
ng add @angular/material
-
ng add @angular/pwa
-
ng add _____
-
ng test
-
ng build --prod
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ {{ "nav.test" | translate }}
diff --git a/dsynth/src/app/app.component.spec.ts b/dsynth/src/app/app.component.spec.ts
deleted file mode 100644
index 97c619d..0000000
--- a/dsynth/src/app/app.component.spec.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import {async, TestBed} from '@angular/core/testing';
-import {RouterTestingModule} from '@angular/router/testing';
-import {AppComponent} from './app.component';
-
-describe('AppComponent', () => {
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- imports: [
- RouterTestingModule
- ],
- declarations: [
- AppComponent
- ],
- }).compileComponents();
- }));
-
- it('should create the app', () => {
- const fixture = TestBed.createComponent(AppComponent);
- const app = fixture.componentInstance;
- expect(app).toBeTruthy();
- });
-
- it(`should have as title 'dsynth'`, () => {
- const fixture = TestBed.createComponent(AppComponent);
- const app = fixture.componentInstance;
- expect(app.title).toEqual('dsynth');
- });
-
- it('should render title', () => {
- const fixture = TestBed.createComponent(AppComponent);
- fixture.detectChanges();
- const compiled = fixture.nativeElement;
- expect(compiled.querySelector('.content span').textContent).toContain('dsynth app is running!');
- });
-});
diff --git a/dsynth/src/app/app.component.ts b/dsynth/src/app/app.component.ts
index 8340518..c813720 100644
--- a/dsynth/src/app/app.component.ts
+++ b/dsynth/src/app/app.component.ts
@@ -1,10 +1,31 @@
import {Component} from '@angular/core';
+import {TranslateService} from "@ngx-translate/core";
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
- styleUrls: ['./app.component.css']
+ styleUrls: []
})
export class AppComponent {
- title = 'dsynth';
+
+ constructor(private translate: TranslateService) {
+
+ translate.addLangs([
+ 'en',
+ 'fr',
+ 'ru'
+ ]);
+
+ translate.setDefaultLang('en');
+ }
+
+ langList: any[] = [
+ {lang: 'fr', display: 'Français'},
+ {lang: 'en', display: 'English'},
+ {lang: 'ru', display: 'Русский'},
+ ];
+
+ langChange(lang: any) {
+ this.translate.use(lang.lang);
+ }
}
diff --git a/dsynth/src/app/app.module.ts b/dsynth/src/app/app.module.ts
index 65d7f16..71f760c 100644
--- a/dsynth/src/app/app.module.ts
+++ b/dsynth/src/app/app.module.ts
@@ -4,6 +4,17 @@ import {NgModule} from '@angular/core';
import {AppRoutingModule} from './app-routing.module';
import {AppComponent} from './app.component';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
+import {MatToolbarModule} from "@angular/material/toolbar";
+import {MatMenuModule} from "@angular/material/menu";
+import {MatIconModule} from "@angular/material/icon";
+import {TranslateHttpLoader} from '@ngx-translate/http-loader';
+import {MatButtonModule} from "@angular/material/button";
+import {TranslateLoader, TranslateModule} from "@ngx-translate/core";
+import {HttpClient, HttpClientModule} from "@angular/common/http";
+
+export function createTranslateLoader(http: HttpClient) {
+ return new TranslateHttpLoader(http, './assets/i18n/', '.json');
+}
@NgModule({
declarations: [
@@ -12,7 +23,20 @@ import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
imports: [
BrowserModule,
AppRoutingModule,
- BrowserAnimationsModule
+ BrowserAnimationsModule,
+ MatToolbarModule,
+ MatMenuModule,
+ MatIconModule,
+ MatButtonModule,
+ HttpClientModule,
+ TranslateModule.forRoot({
+ loader: {
+ provide: TranslateLoader,
+ useFactory: (createTranslateLoader),
+ deps: [HttpClient]
+ }
+ }
+ ),
],
providers: [],
bootstrap: [AppComponent]
diff --git a/dsynth/src/assets/i18n/en.json b/dsynth/src/assets/i18n/en.json
new file mode 100644
index 0000000..5b6b7cc
--- /dev/null
+++ b/dsynth/src/assets/i18n/en.json
@@ -0,0 +1,5 @@
+{
+ "nav": {
+ "test": "Hello"
+ }
+}
diff --git a/dsynth/src/assets/i18n/fr.json b/dsynth/src/assets/i18n/fr.json
new file mode 100644
index 0000000..30dba7d
--- /dev/null
+++ b/dsynth/src/assets/i18n/fr.json
@@ -0,0 +1,5 @@
+{
+ "nav": {
+ "test": "Bonjour"
+ }
+}
diff --git a/dsynth/src/assets/i18n/ru.json b/dsynth/src/assets/i18n/ru.json
new file mode 100644
index 0000000..1eebfab
--- /dev/null
+++ b/dsynth/src/assets/i18n/ru.json
@@ -0,0 +1,5 @@
+{
+ "nav": {
+ "test": "privyet"
+ }
+}
diff --git a/dsynth/src/index.html b/dsynth/src/index.html
index 83a0d24..8868ffb 100644
--- a/dsynth/src/index.html
+++ b/dsynth/src/index.html
@@ -5,9 +5,12 @@
Dsynth
-
+
+
+
+