feat: add strings dictionary for english
This commit is contained in:
@@ -1,12 +1,17 @@
|
|||||||
import { ApplicationConfig, provideBrowserGlobalErrorListeners, provideZoneChangeDetection } from '@angular/core';
|
import { ApplicationConfig, InjectionToken, provideBrowserGlobalErrorListeners, provideZoneChangeDetection } from '@angular/core';
|
||||||
import { provideRouter } from '@angular/router';
|
import { provideRouter } from '@angular/router';
|
||||||
|
|
||||||
import { routes } from './app.routes';
|
import { routes } from './app.routes';
|
||||||
|
import { strings } from './strings';
|
||||||
|
|
||||||
|
const STRINGS_TOKEN = 'strings';
|
||||||
|
export const STRINGS_INJECTOR = new InjectionToken<typeof strings>(STRINGS_TOKEN);
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
export const appConfig: ApplicationConfig = {
|
||||||
providers: [
|
providers: [
|
||||||
provideBrowserGlobalErrorListeners(),
|
provideBrowserGlobalErrorListeners(),
|
||||||
provideZoneChangeDetection({ eventCoalescing: true }),
|
provideZoneChangeDetection({ eventCoalescing: true }),
|
||||||
provideRouter(routes)
|
provideRouter(routes),
|
||||||
|
{provide: STRINGS_INJECTOR, useValue: strings}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|||||||
13
src/app/strings.ts
Normal file
13
src/app/strings.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
export const strings = Object.freeze({
|
||||||
|
add: 'add',
|
||||||
|
addContact: 'add a contact',
|
||||||
|
allFieldRequired: 'all fields are required',
|
||||||
|
company: 'company',
|
||||||
|
contactList: 'contact list',
|
||||||
|
name: 'name',
|
||||||
|
phone: 'phone',
|
||||||
|
errorMessageRequired: 'This field is required.',
|
||||||
|
errorMessageMaxLength: (maxLen: number) => `Must be ${maxLen} characters or fewer.`,
|
||||||
|
errorMessageMinLength: (minLen: number) => `Must be at least ${minLen} characters long.`,
|
||||||
|
errorMessagePhonePattern: `Valid format: + (optional) plus 12 to 15 digits`,
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user