How to use angular-l10n - 10 common examples

To help you get started, we’ve selected a few angular-l10n examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eclipsesource / jsonforms / packages / angular-material / example / app / app.module.ts View on Github external
import { DevToolsExtension, NgRedux } from '@angular-redux/store';
import { Actions, JsonFormsState, UISchemaTester } from '@jsonforms/core';
import { LocaleValidationModule, TranslationModule } from 'angular-l10n';
import { AppComponent } from './app.component';
import { JsonFormsAngularMaterialModule } from '../../src/module';

import { initialState, rootReducer } from './store';
import { ReduxComponent } from './redux.component';
import logger from 'redux-logger';

@NgModule({
  declarations: [AppComponent, ReduxComponent],
  imports: [
    BrowserModule,
    JsonFormsAngularMaterialModule,
    TranslationModule.forRoot({}),
    LocaleValidationModule.forRoot()
  ],
  bootstrap: [AppComponent],
  schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppModule {
  constructor(ngRedux: NgRedux, devTools: DevToolsExtension) {
    let enhancers: any[] = [];
    // ... add whatever other enhancers you want.

    // You probably only want to expose this tool in devMode.
    if (isDevMode() && devTools.isEnabled()) {
      enhancers = [...enhancers, devTools.enhancer()];
    }

    ngRedux.configureStore(rootReducer, initialState, [logger], enhancers);
github eclipsesource / jsonforms / packages / ionic / src / json-forms.module.ts View on Github external
// ListWithDetail components
    ListWithDetailControl,
    MasterPage,
    DetailPage,

    // other
    LabelRenderer
  ],
  imports: [
    IonicModule,
    IonicSelectableModule,
    JsonFormsModule,
    LocalizationModule,
    LocaleValidationModule.forRoot(),
    TranslationModule.forRoot(emptyL10NConfig)
  ],
  exports: [
    IonicModule,
    IonicSelectableModule,
    JsonFormsModule,
    LocalizationModule,
    LocaleValidationModule,
    TranslationModule
  ],
  entryComponents: [
    // controls
    BooleanCheckboxControlRenderer,
    BooleanToggleControlRenderer,
    StringControlRenderer,
    MultilineControlRenderer,
    NumberControlRenderer,
github citizenfx / fivem / ext / cfx-ui / src / app / app.module.ts View on Github external
import { Languages } from './languages';
import { ServerTagsService } from './servers/server-tags.service';

const localePrefix = (environment.web) ? 'https://servers.fivem.net/' : './';

const l10nConfig: L10nConfig = {
	locale: {
		languages: Languages.toList(),
		language: 'en'
	},
	translation: {
		//providers: [] // see AppModule constructor
					  // broke on Angular 8, here again
		providers: [
			{ type: ProviderType.Fallback, prefix: localePrefix + 'assets/languages/locale-en', fallbackLanguage: [] },
			{ type: ProviderType.Static, prefix: localePrefix + 'assets/languages/locale-' }
		]
	}
};

export function localStorageFactory() {
	return (typeof window !== 'undefined') ? window.localStorage : null;
}

export function metaFactory(): MetaLoader {
	return new MetaStaticLoader({
		pageTitlePositioning: PageTitlePositioning.PrependPageTitle,
		pageTitleSeparator: ' / ',
		applicationName: 'FiveM server list'
	});
}
github eclipsesource / jsonforms / packages / angular-material / example / app / app.module.ts View on Github external
import { Actions, JsonFormsState, UISchemaTester } from '@jsonforms/core';
import { LocaleValidationModule, TranslationModule } from 'angular-l10n';
import { AppComponent } from './app.component';
import { JsonFormsAngularMaterialModule } from '../../src/module';

import { initialState, rootReducer } from './store';
import { ReduxComponent } from './redux.component';
import logger from 'redux-logger';

@NgModule({
  declarations: [AppComponent, ReduxComponent],
  imports: [
    BrowserModule,
    JsonFormsAngularMaterialModule,
    TranslationModule.forRoot({}),
    LocaleValidationModule.forRoot()
  ],
  bootstrap: [AppComponent],
  schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppModule {
  constructor(ngRedux: NgRedux, devTools: DevToolsExtension) {
    let enhancers: any[] = [];
    // ... add whatever other enhancers you want.

    // You probably only want to expose this tool in devMode.
    if (isDevMode() && devTools.isEnabled()) {
      enhancers = [...enhancers, devTools.enhancer()];
    }

    ngRedux.configureStore(rootReducer, initialState, [logger], enhancers);
    const example = initialState.examples.data[0];
github eclipsesource / jsonforms / packages / ionic / src / json-forms.module.ts View on Github external
GroupLayoutRenderer,

    // ListWithDetail components
    ListWithDetailControl,
    MasterPage,
    DetailPage,

    // other
    LabelRenderer
  ],
  imports: [
    IonicModule,
    IonicSelectableModule,
    JsonFormsModule,
    LocalizationModule,
    LocaleValidationModule.forRoot(),
    TranslationModule.forRoot(emptyL10NConfig)
  ],
  exports: [
    IonicModule,
    IonicSelectableModule,
    JsonFormsModule,
    LocalizationModule,
    LocaleValidationModule,
    TranslationModule
  ],
  entryComponents: [
    // controls
    BooleanCheckboxControlRenderer,
    BooleanToggleControlRenderer,
    StringControlRenderer,
    MultilineControlRenderer,
github eclipsesource / jsonforms / packages / ionic / src / controls / number / number-control.ts View on Github external
mapAdditionalProps(props: ControlProps) {
    if (!isEmpty(props.schema)) {
      // TODO
      const defaultStep = isNumberControl(this.uischema, this.schema) ? 0.1 : 1;
      this.min = props.schema.minimum;
      this.max = props.schema.maximum;
      this.step = props.schema.multipleOf || defaultStep;
      // this doesn't seem to work reliably; an entered value will be formatted
      // the 1st time when blurring out, but it doesn't work the 2nd time
      // although the internal state seems correct
      this.locale = getLocale(this.ngRedux.getState());
      const pipe = new L10nDecimalPipe(this.localeService);
      this.localeService.setDefaultLocale(this.locale);
      if (this.locale) {
        this.displayValue = pipe.transform(props.data, this.locale);
      } else {
        this.displayValue = props.data;
      }
    }
  }
}
github citizenfx / fivem / ext / cfx-ui / src / app / app.module.ts View on Github external
import { Languages } from './languages';
import { ServerTagsService } from './servers/server-tags.service';

const localePrefix = (environment.web) ? 'https://servers.fivem.net/' : './';

const l10nConfig: L10nConfig = {
	locale: {
		languages: Languages.toList(),
		language: 'en'
	},
	translation: {
		//providers: [] // see AppModule constructor
					  // broke on Angular 8, here again
		providers: [
			{ type: ProviderType.Fallback, prefix: localePrefix + 'assets/languages/locale-en', fallbackLanguage: [] },
			{ type: ProviderType.Static, prefix: localePrefix + 'assets/languages/locale-' }
		]
	}
};

export function localStorageFactory() {
	return (typeof window !== 'undefined') ? window.localStorage : null;
}

export function metaFactory(): MetaLoader {
	return new MetaStaticLoader({
		pageTitlePositioning: PageTitlePositioning.PrependPageTitle,
		pageTitleSeparator: ' / ',
		applicationName: 'FiveM server list'
	});
}
github damienbod / AspNet5IdentityServerAngularImplicitFlow / src / AngularClientCode / angularApp / app / app.module.ts View on Github external
missingValue: 'No key'
    }
};

export function loadConfig(oidcConfigService: OidcConfigService) {
    console.log('APP_INITIALIZER STARTING');
    return () => oidcConfigService.load(`${window.location.origin}/api/ClientAppSettings`);
}

@NgModule({
    imports: [
        BrowserModule,
        FormsModule,
        routing,
        HttpClientModule,
        TranslationModule.forRoot(l10nConfig),
        DataEventRecordsModule,
        AuthModule.forRoot(),
    ],
    declarations: [
        AppComponent,
        ForbiddenComponent,
        HomeComponent,
        UnauthorizedComponent,
        SecureFilesComponent
    ],
    providers: [
        OidcConfigService,
        OidcSecurityService,
        {
            provide: APP_INITIALIZER,
            useFactory: loadConfig,
github damienbod / AspNet5IdentityServerAngularImplicitFlow / src / AngularClient / angularApp / app / app.module.ts View on Github external
missingValue: 'No key'
    }
};

export function loadConfig(oidcConfigService: OidcConfigService) {
    console.log('APP_INITIALIZER STARTING');
    return () => oidcConfigService.load(`${window.location.origin}/api/ClientAppSettings`);
}

@NgModule({
    imports: [
        BrowserModule,
        FormsModule,
        routing,
        HttpClientModule,
        TranslationModule.forRoot(l10nConfig),
        DataEventRecordsModule,
        AuthModule.forRoot(),
    ],
    declarations: [
        AppComponent,
        ForbiddenComponent,
        HomeComponent,
        UnauthorizedComponent,
        SecureFilesComponent
    ],
    providers: [
        OidcConfigService,
        OidcSecurityService,
        {
            provide: APP_INITIALIZER,
            useFactory: loadConfig,
github damienbod / AspNet5IdentityServerAngularImplicitFlow / src / AngularClient / angularApp / app / app.module.ts View on Github external
import { AuthorizationCanGuard } from './authorization.can.guard';

const l10nConfig: L10nConfig = {
    locale: {
        languages: [
            { code: 'en', dir: 'ltr' },
            { code: 'it', dir: 'ltr' },
            { code: 'fr', dir: 'ltr' },
            { code: 'de', dir: 'ltr' }
        ],
        language: 'en',
        storage: StorageStrategy.Cookie
    },
    translation: {
        providers: [
            { type: ProviderType.Static, prefix: './i18n/locale-' }
        ],
        caching: true,
        missingValue: 'No key'
    }
};

export function loadConfig(oidcConfigService: OidcConfigService) {
    console.log('APP_INITIALIZER STARTING');
    return () => oidcConfigService.load(`${window.location.origin}/api/ClientAppSettings`);
}

@NgModule({
    imports: [
        BrowserModule,
        FormsModule,
        routing,