feat: anade app playground con catalogo de componentes
This commit is contained in:
62
apps/playground/src/app/app.config.ts
Normal file
62
apps/playground/src/app/app.config.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import {
|
||||
ApplicationConfig,
|
||||
inject,
|
||||
provideAppInitializer,
|
||||
provideBrowserGlobalErrorListeners,
|
||||
} from '@angular/core';
|
||||
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
||||
import { provideStore } from '@ngrx/store';
|
||||
import {
|
||||
TranslateLoader,
|
||||
TranslationObject,
|
||||
provideTranslateService,
|
||||
} from '@ngx-translate/core';
|
||||
import { Observable, of } from 'rxjs';
|
||||
|
||||
import { IconRegistryService, deviceConfigsReducer, featureKey } from '@pi/ui';
|
||||
|
||||
/**
|
||||
* Diccionario en línea: la librería resuelve los textos con `| translate`, y
|
||||
* montar el loader HTTP real exigiría ficheros de i18n que no forman parte de
|
||||
* la librería. Con las claves que faltan ngx-translate devuelve la propia
|
||||
* clave, que para un catálogo de componentes es suficiente.
|
||||
*/
|
||||
const TRANSLATIONS: TranslationObject = {
|
||||
common: {
|
||||
close: 'Cerrar',
|
||||
min: 'Mín',
|
||||
max: 'Máx',
|
||||
save: 'Guardar',
|
||||
reset: 'Borrar',
|
||||
validator: {
|
||||
requiredField: 'Este campo es obligatorio',
|
||||
onlyNumbers: 'Sólo se admiten números',
|
||||
enterValidEmail: 'Introduce un email válido',
|
||||
minimumPasswordCharacters: 'La contraseña es demasiado corta',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
class PlaygroundTranslateLoader implements TranslateLoader {
|
||||
getTranslation(): Observable<TranslationObject> {
|
||||
return of(TRANSLATIONS);
|
||||
}
|
||||
}
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
provideBrowserGlobalErrorListeners(),
|
||||
provideAnimationsAsync(),
|
||||
|
||||
// Los iconos son SVG registrados en el MatIconRegistry (assets/icons).
|
||||
provideAppInitializer(() => inject(IconRegistryService).init()),
|
||||
|
||||
provideTranslateService({
|
||||
fallbackLang: 'es',
|
||||
loader: { provide: TranslateLoader, useClass: PlaygroundTranslateLoader },
|
||||
}),
|
||||
|
||||
// data-table y background-image leen el tipo de dispositivo del store.
|
||||
provideStore({ [featureKey]: deviceConfigsReducer }),
|
||||
],
|
||||
};
|
||||
Reference in New Issue
Block a user