mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-30 16:40:55 +03:00
Added ability to select language in settings
Fixed locale support so that it actually works at runtime Removed unused library
This commit is contained in:
35
src/main.ts
35
src/main.ts
@@ -1,12 +1,12 @@
|
||||
import '@angular/localize/init';
|
||||
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
import { environment } from './environments/environment';
|
||||
|
||||
import { loadTranslations } from '@angular/localize';
|
||||
import { getTranslations } from '@soluling/angular';
|
||||
import '@angular/localize/init';
|
||||
import { getTranslations, ParsedTranslationBundle } from '@locl/core';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
@@ -14,14 +14,27 @@ if (environment.production) {
|
||||
|
||||
const locale = localStorage.getItem('locale');
|
||||
if (locale) {
|
||||
fetch(`./assets/i18n/messages.${locale}.json`).then(res => res.json()).then((resp) => {
|
||||
console.log(resp);
|
||||
loadTranslations(resp);
|
||||
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||
}, err => {
|
||||
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||
});
|
||||
getTranslations(`./assets/i18n/messages.${locale}.json`).then(
|
||||
(data: ParsedTranslationBundle) => {
|
||||
loadTranslations(data as any);
|
||||
import('./app/app.module').then(module => {
|
||||
platformBrowserDynamic()
|
||||
.bootstrapModule(module.AppModule)
|
||||
.catch(err => console.error(err));
|
||||
});
|
||||
}
|
||||
).catch(err => {
|
||||
import('./app/app.module').then(module => {
|
||||
platformBrowserDynamic()
|
||||
.bootstrapModule(module.AppModule)
|
||||
.catch(err2 => console.error(err2));
|
||||
});
|
||||
});
|
||||
} else {
|
||||
console.log('no locale');
|
||||
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||
import('./app/app.module').then(module => {
|
||||
platformBrowserDynamic()
|
||||
.bootstrapModule(module.AppModule)
|
||||
.catch(err => console.error(err));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user