Skip to content

Commit

Permalink
feat: moved translations configuration to angular-integration-interface
Browse files Browse the repository at this point in the history
  • Loading branch information
markuczy committed Mar 11, 2024
1 parent 530c640 commit a5868b4
Show file tree
Hide file tree
Showing 15 changed files with 299 additions and 17 deletions.
32 changes: 29 additions & 3 deletions libs/angular-accelerator/src/lib/angular-accelerator.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import { CommonModule } from '@angular/common'
import { CUSTOM_ELEMENTS_SCHEMA, LOCALE_ID, NgModule } from '@angular/core'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { RouterModule } from '@angular/router'
import { MissingTranslationHandler, MissingTranslationHandlerParams, TranslateModule } from '@ngx-translate/core'
import {
MissingTranslationHandler,
MissingTranslationHandlerParams,
TranslateLoader,
TranslateModule,
} from '@ngx-translate/core'
import { PrimeNgModule } from './primeng.module'
import { ColumnGroupSelectionComponent } from './components/column-group-selection/column-group-selection.component'
import { CustomGroupColumnSelectorComponent } from './components/custom-group-column-selector/custom-group-column-selector.component'
Expand All @@ -21,7 +26,10 @@ import { DynamicPipe } from './pipes/dynamic.pipe'
import { RelativeDatePipe } from './pipes/relative-date.pipe'

import { IfPermissionDirective } from './directives/if-permission.directive'
import { UserService } from '@onecx/angular-integration-interface'
import { AppStateService, UserService } from '@onecx/angular-integration-interface'
import { HttpClient } from '@angular/common/http'
import { createTranslateLoader } from '@onecx/angular-integration-interface'
import { TranslationCacheService } from '@onecx/angular-integration-interface'

export class AngularAcceleratorMissingTranslationHandler implements MissingTranslationHandler {
handle(params: MissingTranslationHandlerParams) {
Expand All @@ -31,7 +39,25 @@ export class AngularAcceleratorMissingTranslationHandler implements MissingTrans
}

@NgModule({
imports: [CommonModule, PrimeNgModule, TranslateModule.forRoot(), FormsModule, RouterModule, ReactiveFormsModule],
imports: [
CommonModule,
PrimeNgModule,
TranslateModule.forRoot({
isolate: true,
loader: {
provide: TranslateLoader,
useFactory: createTranslateLoader,
deps: [HttpClient, AppStateService, TranslationCacheService],
},
missingTranslationHandler: {
provide: MissingTranslationHandler,
useClass: AngularAcceleratorMissingTranslationHandler,
},
}),
FormsModule,
RouterModule,
ReactiveFormsModule,
],
declarations: [
ColumnGroupSelectionComponent,
CustomGroupColumnSelectorComponent,
Expand Down
7 changes: 7 additions & 0 deletions libs/angular-integration-interface/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
// services
export * from './lib/services/app-state.service'
export * from './lib/services/user.service'
export * from './lib/services/translation-cache.service'

// utils
export * from './lib/utils/async-translate-loader.utils'
export * from './lib/utils/caching-translate-loader.utils'
export * from './lib/utils/create-translate-loader.utils'
export * from './lib/utils/translate.combined.loader'
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { HttpClient } from '@angular/common/http'
import { HttpClientTestingModule } from '@angular/common/http/testing'
import { TestBed } from '@angular/core/testing'
import { of } from 'rxjs'
import { TranslationCacheService } from '../../services/translation-cache.service'
import { TranslationCacheService } from '../services/translation-cache.service'
import { CachingTranslateLoader } from './caching-translate-loader.utils'

describe('CachingTranslateLoader', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { HttpClient } from '@angular/common/http'
import { TranslateLoader } from '@ngx-translate/core'
import { TranslateHttpLoader } from '@ngx-translate/http-loader'
import { Observable } from 'rxjs'
import { TranslationCacheService } from '../../services/translation-cache.service'
import { TranslationCacheService } from '../services/translation-cache.service'

export class CachingTranslateLoader implements TranslateLoader {
private translateLoader = new TranslateHttpLoader(this.http, this.prefix, this.suffix)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Observable, of } from 'rxjs'
import { MfeInfo } from '@onecx/integration-interface'
import { TestBed } from '@angular/core/testing'
import { EnvironmentInjector } from '@angular/core'
import { TranslationCacheService } from '../../services/translation-cache.service'
import { TranslationCacheService } from '../services/translation-cache.service'

describe('CreateTranslateLoader', () => {
const origAddEventListener = window.addEventListener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { HttpClient } from '@angular/common/http'
import { inject } from '@angular/core'
import { TranslateLoader } from '@ngx-translate/core'
import { combineLatest, filter, map, tap } from 'rxjs'
import { AppStateService } from '@onecx/angular-integration-interface'
import { TranslationCacheService } from '../../services/translation-cache.service'
import { AppStateService } from '../services/app-state.service'
import { TranslationCacheService } from '../services/translation-cache.service'
import { AsyncTranslateLoader } from './async-translate-loader.utils'
import { CachingTranslateLoader } from './caching-translate-loader.utils'
import { TranslateCombinedLoader } from './translate.combined.loader'
Expand Down
2 changes: 1 addition & 1 deletion libs/keycloak-auth/src/lib/keycloak-auth.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core'
import { ConfigurationService, CONFIG_KEY, IAuthService } from '@onecx/portal-integration-angular'
import { AppStateService } from '@onecx/angular-accelerator'
import { AppStateService } from '@onecx/angular-integration-interface'
import { KeycloakEventType, KeycloakOptions, KeycloakService } from 'keycloak-angular'
import { KeycloakConfig } from 'keycloak-js'

Expand Down
128 changes: 128 additions & 0 deletions libs/portal-integration-angular/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,133 @@
"OCX_BUTTON_DIALOG": {
"CONFIRM": "Bestätigen",
"CANCEL": "Absagen"
},
"OCX_CUSTOM_GROUP_COLUMN_SELECTOR": {
"DROPDOWN_LABEL": "Spalten",
"OPEN_BUTTON_DETAIL": "Dialog zur Auswahl einer benutzerdefinierten Gruppe öffnen",
"ACTIVE_COLUMNS_LABEL": "Aktive Spalten",
"INACTIVE_COLUMNS_LABEL": "Inaktive Spalten",
"SAVE_BUTTON_LABEL": "Speichern",
"CANCEL_BUTTON_LABEL": "Abbrechen",
"DIALOG_TITLE": "Spalten für benutzerdefinierte Gruppe auswählen",
"CONFIGURE_ACTION_COLUMN": {
"TITLE": "Aktionsspalte konfigurieren",
"FREEZE": "Aktionsspalte immer anzeigen",
"POSITION": "Position der Aktionsspalte",
"YES": "Ja",
"NO": "Nein",
"LEFT": "Links",
"RIGHT": "Rechts"
},
"ARIA_LABELS": {
"UP": "Spalte nach oben verschieben",
"TOP": "Spalte an den Anfang verschieben",
"DOWN": "Spalte nach unten verschieben",
"BOTTOM": "Spalte ans Ende verschieben",
"RIGHT": "Spalte als inaktiv setzen",
"ALL_RIGHT": "Alle Spalten als inaktiv setzen",
"LEFT": "Spalte als aktiv setzen",
"ALL_LEFT": "Alle Spalten als aktiv setzen",
"CLOSE": "Dialog schließen"
}
},
"OCX_SEARCH_CONFIG": {
"PLACEHOLDER": "Bitte geben Sie den Namen der Suchkonfiguration an.",
"SAVE_COLUMNS_OPTION": "Möchten Sie die angezeigten Spalten speichern?",
"SAVE_INPUT_FIELDS_OPTION": "Möchten Sie die Werte aus den Suchfeldern speichern?"
},
"OCX_LIST_GRID_SORT": {
"DROPDOWN": {
"PLACEHOLDER": "Sortierung auswählen",
"TITLE": "Sortieren nach"
},
"TOGGLE_BUTTON": {
"ASCENDING_TITLE": "Aufsteigend",
"DESCENDING_TITLE": "Absteigend",
"DEFAULT_TITLE": "Standard"
},
"SORTING_BUTTON_ARIA_LABEL": "{{direction}} sortieren"
},
"OCX_DATA_TABLE": {
"EMPTY_RESULT": "Keine Daten gefunden.",
"EMPTY_FILTER_MESSAGE": "Keine Filter gefunden.",
"ACTIONS_COLUMN_NAME": "Aktionen",
"FILTER_TITLE": "Filter",
"FILTER_ARIA_LABEL": "Filter {{column}}",
"EDITED": "Bearbeitet",
"SHOWING": "{{first}} - {{last}} von {{totalRecords}}",
"SHOWING_WITH_TOTAL_ON_SERVER": "{{first}} - {{last}} von {{totalRecords}} ({{totalRecordsOnServer}})",
"ALL": "Alle",
"ACTIONS": {
"VIEW": "Anzeigen",
"EDIT": "Bearbeiten",
"DELETE": "Löschen"
},
"TOGGLE_BUTTON": {
"ASCENDING_TITLE": "Aufsteigend",
"DESCENDING_TITLE": "Absteigend",
"DEFAULT_TITLE": "Standard",
"ARIA_LABEL": "{{column}} {{direction}} sortieren"
}
},
"OCX_DATA_LIST_GRID": {
"EMPTY_RESULT": "Keine Daten gefunden.",
"MENU": {
"VIEW": "Anzeigen",
"EDIT": "Bearbeiten",
"DELETE": "Löschen"
},
"MORE_ACTIONS": "Weitere Aktionen"
},
"OCX_DATA_LAYOUT_SELECTION": {
"LAYOUT": {
"LIST": "Liste",
"GRID": "Raster",
"TABLE": "Tabelle"
}
},
"OCX_INTERACTIVE_DATA_VIEW": {
"DEFAULT_GROUP": "Standardgruppe",
"CUSTOM_GROUP": "Benutzerdefinierte Gruppe",
"NO_GROUP_SELECTED": "Keine Gruppe ausgewählt"
},
"OCX_SEARCH_HEADER": {
"TOGGLE_BUTTON": {
"SIMPLE": {
"TEXT": "Einfach",
"DETAIL": "Zu einfachen Suchkriterien wechseln"
},
"ADVANCED": {
"TEXT": "Erweitert",
"DETAIL": "Zu erweiterten Suchkriterien wechseln"
}
},
"OCX_SEARCH_CONFIG": {
"DROPDOWN_DEFAULT": "Gespeicherte Suchvorlage auswählen"
},
"HEADER": "Suche",
"RESET_BUTTON": {
"TEXT": "Zurücksetzen",
"DETAIL": "Suchkriterien zurücksetzen"
},
"SEARCH_BUTTON": {
"TEXT": "Suchen",
"DETAIL": "Suche starten"
},
"EXPORT": "Alle Ereignisse exportieren"
},
"OCX_PAGE_HEADER": {
"MORE_ACTIONS": "Weitere Aktionen",
"HOME_DEFAULT_ARIA_LABEL": "Zur Startseite navigieren",
"HOME_ARIA_LABEL": "Zu {{page}} navigieren"
},
"OCX_DIAGRAM": {
"SUM": "Gesamtanzahl",
"NO_DATA": "Es sind keine Daten vorhanden",
"SWITCH_DIAGRAM_TYPE": {
"PIE": "Zu Tortendiagramm wechseln",
"HORIZONTAL_BAR": "Zu horizontalem Balkendiagramm wechseln",
"VERTICAL_BAR": "Zu vertikalem Balkendiagramm wechseln"
}
}
}
128 changes: 128 additions & 0 deletions libs/portal-integration-angular/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,133 @@
"OCX_BUTTON_DIALOG": {
"CONFIRM": "Confirm",
"CANCEL": "Cancel"
},
"OCX_CUSTOM_GROUP_COLUMN_SELECTOR": {
"DROPDOWN_LABEL": "Columns",
"OPEN_BUTTON_DETAIL": "Open custom group selection dialog",
"ACTIVE_COLUMNS_LABEL": "Active columns",
"INACTIVE_COLUMNS_LABEL": "Inactive columns",
"SAVE_BUTTON_LABEL": "Save",
"CANCEL_BUTTON_LABEL": "Cancel",
"DIALOG_TITLE": "Custom group column selection",
"CONFIGURE_ACTION_COLUMN": {
"TITLE": "Configure action column",
"FREEZE": "Always show action column",
"POSITION": "Position of action column",
"YES": "Yes",
"NO": "No",
"LEFT": "Left",
"RIGHT": "Right"
},
"ARIA_LABELS": {
"UP": "Move column up",
"TOP": "Move column to the top",
"DOWN": "Move column down",
"BOTTOM": "Move column to the bottom",
"RIGHT": "Set column as inactive",
"ALL_RIGHT": "Set all columns as inactive",
"LEFT": "Set column as active",
"ALL_LEFT": "Set all columns as active",
"CLOSE": "Close dialog"
}
},
"OCX_SEARCH_CONFIG": {
"PLACEHOLDER": "Please enter the name of the search configuration",
"SAVE_COLUMNS_OPTION": "Do you want to save the shown columns?",
"SAVE_INPUT_FIELDS_OPTION": "Do you want to save the input values from the input fields?"
},
"OCX_LIST_GRID_SORT": {
"DROPDOWN": {
"PLACEHOLDER": "Select sorting",
"TITLE": "Sort by"
},
"TOGGLE_BUTTON": {
"ASCENDING_TITLE": "Ascending",
"DESCENDING_TITLE": "Descending",
"DEFAULT_TITLE": "Default"
},
"SORTING_BUTTON_ARIA_LABEL": "Toggle sorting direction to {{direction}}"
},
"OCX_DATA_TABLE": {
"EMPTY_RESULT": "No data found.",
"EMPTY_FILTER_MESSAGE": "No filters found.",
"ACTIONS_COLUMN_NAME": "Actions",
"FILTER_TITLE": "Filter",
"FILTER_ARIA_LABEL": "Filter {{column}}",
"EDITED": "Edited",
"SHOWING": "{{first}} - {{last}} of {{totalRecords}}",
"SHOWING_WITH_TOTAL_ON_SERVER": "{{first}} - {{last}} of {{totalRecords}} ({{totalRecordsOnServer}})",
"ALL": "All",
"ACTIONS": {
"VIEW": "View",
"EDIT": "Edit",
"DELETE": "Delete"
},
"TOGGLE_BUTTON": {
"ASCENDING_TITLE": "Ascending",
"DESCENDING_TITLE": "Descending",
"DEFAULT_TITLE": "Default",
"ARIA_LABEL": "Toggle {{column}} sorting direction to {{direction}}"
}
},
"OCX_DATA_LIST_GRID": {
"EMPTY_RESULT": "No data found.",
"MENU": {
"VIEW": "View",
"EDIT": "Edit",
"DELETE": "Delete"
},
"MORE_ACTIONS": "More actions"
},
"OCX_DATA_LAYOUT_SELECTION": {
"LAYOUT": {
"LIST": "List",
"GRID": "Grid",
"TABLE": "Table"
}
},
"OCX_INTERACTIVE_DATA_VIEW": {
"DEFAULT_GROUP": "Default group",
"CUSTOM_GROUP": "Custom group",
"NO_GROUP_SELECTED": "No group selected"
},
"OCX_SEARCH_HEADER": {
"TOGGLE_BUTTON": {
"SIMPLE": {
"TEXT": "Simple",
"DETAIL": "Switch to simple search criteria"
},
"ADVANCED": {
"TEXT": "Advanced",
"DETAIL": "Switch to advanced search criteria"
}
},
"OCX_SEARCH_CONFIG": {
"DROPDOWN_DEFAULT": "Pick predefined template"
},
"HEADER": "Search",
"RESET_BUTTON": {
"TEXT": "Reset",
"DETAIL": "Reset search criteria"
},
"SEARCH_BUTTON": {
"TEXT": "Search",
"DETAIL": "Start search"
},
"EXPORT": "Export all events"
},
"OCX_PAGE_HEADER": {
"MORE_ACTIONS": "More actions",
"HOME_DEFAULT_ARIA_LABEL": "Go to home page",
"HOME_ARIA_LABEL": "Go to {{page}} home page"
},
"OCX_DIAGRAM": {
"SUM": "Total",
"NO_DATA": "There is no data available",
"SWITCH_DIAGRAM_TYPE": {
"PIE": "Switch to pie chart",
"HORIZONTAL_BAR": "Switch to horizontal bar chart",
"VERTICAL_BAR": "Switch to vertical bar chart"
}
}
}
Loading

0 comments on commit a5868b4

Please sign in to comment.