Skip to content

Commit

Permalink
Merge branch 'main' into nana-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
nana-boateng authored Dec 16, 2024
2 parents 086ea0e + 3fc3f81 commit 95a7037
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
35 changes: 29 additions & 6 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { TranslateService, TranslateModule } from '@ngx-translate/core';
import { Languages } from '../assets/i18n/localizations';
import { Subject, takeUntil } from 'rxjs';


@Component({
selector: 'dct-root',
template: `
Expand All @@ -24,10 +25,20 @@ import { Subject, takeUntil } from 'rxjs';
<dct-body class="body" />
} @else if (loading()) {
<div class="h-screen w-screen flex flex-col items-center my-auto">
<h1
class="my-auto text-4xl font-bold animate-pulse dark:text-light-on-primary"
>
{{ 'APP.LOADING' | translate }}
<h1 class="my-auto w-full font-bold dark:text-light-on-primary">
<label
class="flex flex-col items-center justify-center text-center"
>
<span class="animate-pulse text-5xl"> {{ 'APP.LOADING' | translate }} </span>
<progress
max="100"
[value]="progress()"
class="w-1/2 rounded-xl mx-auto my-5"
id="dataset-progress"
aria-label="Loading dataset..."
></progress>
</label>
</h1>
</div>
} @else if (error()) {
Expand Down Expand Up @@ -84,7 +95,7 @@ export class AppComponent implements OnInit, OnDestroy {
private destroy$ = new Subject<void>();

constructor() {
const lang = Languages.find((x) => x.id == navigator.language);
const lang = Languages.find((x) => x.id == navigator.language);
if (lang) {
this.setLang(lang.id);
} else {
Expand All @@ -104,7 +115,19 @@ export class AppComponent implements OnInit, OnDestroy {
(params['dfId'] as number);
const apiKey = params['key'] as string;
// If a dataset is in French then we automatically set the language to French
const language = params['dvLocale'] as string;
const language = params['locale'] as string;
const dvLocale = Languages.find(x=>x.dv == language);
if(dvLocale) {
localStorage.setItem('language',dvLocale.id);
setTimeout(()=>{ this.setLang(dvLocale.id) }, 500);
} else {
const lang = Languages.find(x=>x.id == navigator.language);
if(lang) {
this.setLang(lang.id);
} else {
this.setLang("en-CA");
}
}
// The identifier to specify the version of the dataset to load
const metadataID = params['metadataID'] as number;
if (callback) {
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/fr-CA.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"NOTHING_HERE_YET": "Rien ici pour le moment. Ajoutez une variable pour commencer à créer votre tableau. // Il y a aucune données pour le moment. Ajoutez une variable pour commencer à créer votre tableau. "
}
},

"COMMON": {
"ALL": "Tout",
"LOADING_DATASET": "Chargement du jeu de données",
Expand Down

0 comments on commit 95a7037

Please sign in to comment.