Skip to content

Fr translation #260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"i18n": {
"locales": {
"en": { "translation": "src/ng-app/assets/locale/lang.en.xlf", "baseHref": "" },
"de": { "translation": "src/ng-app/assets/locale/lang.de.xlf", "baseHref": "" }
"de": { "translation": "src/ng-app/assets/locale/lang.de.xlf", "baseHref": "" },
"fr": { "translation": "src/ng-app/assets/locale/lang.fr.xlf", "baseHref": "" }
}
},
"schematics": {
Expand Down
3 changes: 2 additions & 1 deletion src/e-app/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ const tccConfigDir = path.join(os.homedir(), '.tcc');
const tccStandardConfigFile = path.join(tccConfigDir, 'user.conf');
const availableLanguages = [
'en',
'de'
'de',
'fr'
];
const translation = new NgTranslations();
let startTCCAccelerator;
Expand Down
4 changes: 4 additions & 0 deletions src/ng-app/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ import { CpuDashboardComponent } from './cpu-dashboard/cpu-dashboard.component';
import localeDe from '@angular/common/locales/de';
import localeDeExtra from '@angular/common/locales/extra/de';

import localeFr from '@angular/common/locales/fr';
import localeFrExtra from '@angular/common/locales/extra/fr';

import { OverlayModule } from '@angular/cdk/overlay';

import { GaugeModule } from 'angular-gauge';
Expand All @@ -86,6 +89,7 @@ import { DialogConfirmComponent } from './dialog-confirm/dialog-confirm.componen
import { ChargingSettingsComponent } from './charging-settings/charging-settings.component';

registerLocaleData(localeDe, 'de', localeDeExtra);
registerLocaleData(localeFr, 'fr', localeFrExtra);

declare const require;

Expand Down
2 changes: 1 addition & 1 deletion src/ng-app/app/main-gui/main-gui.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<div class="sidenav-bottom">
<mat-nav-list>
<mat-divider></mat-divider>
<mat-list-item routerLinkActive="true" (click)="buttonToggleLanguage()">
<mat-list-item routerLinkActive="true" (click)="buttonCycleLanguage()">
<content>
<mat-icon><svg viewBox="0 0 512 512">
<use href="./assets/images/icon_language.svg#Icon"></use>
Expand Down
21 changes: 21 additions & 0 deletions src/ng-app/app/main-gui/main-gui.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,35 @@ export class MainGuiComponent implements OnInit, OnDestroy {
return this.utils.getLanguageData(langId);
}

//old version with only two languages
/*
public buttonToggleLanguage() {
this.utils.changeLanguage(this.utils.getLanguagesMenuArray().find(lang => lang.id !== this.utils.getCurrentLanguageId()).id);
this.updateLanguageName();
}
*/

public buttonCycleLanguage():void {
let curLangIndex: number = this.utils.getLanguagesMenuArray().findIndex(lang => lang.id === this.utils.getCurrentLanguageId())
let newLangIndex: number = (curLangIndex + 1) % this.utils.getLanguagesMenuArray().length
let newLangID: string = this.utils.getLanguagesMenuArray()[newLangIndex].id
this.utils.changeLanguage(newLangID);
this.updateLanguageName();
}

//old version with only two languages
/*
public updateLanguageName(): void {
this.buttonLanguageLabel = this.utils.getLanguagesMenuArray().find(lang => lang.id !== this.utils.getCurrentLanguageId()).label;
}
*/

public updateLanguageName(): void {
let curLangIndex: number = this.utils.getLanguagesMenuArray().findIndex(lang => lang.id === this.utils.getCurrentLanguageId())
let nextLangIndex: number = (curLangIndex + 1) % this.utils.getLanguagesMenuArray().length
let nextLangLabel: string = this.utils.getLanguagesMenuArray()[nextLangIndex].label
this.buttonLanguageLabel = nextLangLabel;
}

public getStateInputs(): IStateInfo[] {
return this.state.getStateInputs();
Expand Down
3 changes: 2 additions & 1 deletion src/ng-app/app/utils.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ export class UtilsService {

private languagesMenuArray = [
{ id: 'en', label: 'English', img: 'english.svg' },
{ id: 'de', label: 'Deutsch', img: 'german.svg' }
{ id: 'de', label: 'Deutsch', img: 'german.svg' },
{ id: 'fr', label: 'Français', img: 'french.svg' }
];
private languageMap;

Expand Down
91 changes: 91 additions & 0 deletions src/ng-app/assets/images/french.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading