-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
translate configuration implemented using @ngneat/transloco #13
- Loading branch information
Showing
7 changed files
with
314 additions
and
249 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,30 @@ | ||
<div class="h-screen flex justify-center items-center"> | ||
<h1 class="text-5xl font-bold"> | ||
This is | ||
<div class="absolute top-1 right-1 space-x-4"> | ||
<label for="language" class="text-white font-semibold">Translate in :</label> | ||
<select | ||
data-cy="language" | ||
name="language" | ||
id="language" | ||
class="p-2 outline-none" | ||
[(ngModel)]="selectedLanguage" | ||
(change)="onLanguageChange($event)" | ||
> | ||
<option data-cy="en" value="en">English 🇺🇸</option> | ||
<option data-cy="es" value="es">Spanish 🇪🇸</option> | ||
<option data-cy="bn" value="bn">বাংলা 🇧🇩</option> | ||
</select> | ||
</div> | ||
<div | ||
class="h-screen flex justify-center items-center bg-slate-800" | ||
*transloco="let translate" | ||
> | ||
<h1 | ||
class="text-5xl font-bold text-white shadow-md shadow-slate-900 rounded-md p-4" | ||
> | ||
{{ translate('title') }} | ||
<span | ||
class="bg-gradient-to-r text-transparent from-violet-600 to-red-600 bg-clip-text" | ||
>nixng</span | ||
> | ||
>nixng | ||
</span> | ||
🚀 | ||
</h1> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { TranslocoService } from '@ngneat/transloco'; | ||
|
||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './app.component.html', | ||
styleUrls: ['./app.component.scss'] | ||
}) | ||
export class AppComponent implements OnInit { | ||
selectedLanguage: 'en' | 'es' | 'bn' = 'bn'; | ||
|
||
constructor(private translocoService: TranslocoService) {} | ||
|
||
ngOnInit(): void {} | ||
|
||
onLanguageChange($event: Event) { | ||
this.selectedLanguage = $event.target['value']; | ||
this.translocoService.setActiveLang($event.target['value']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters