mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-09 02:54:13 +00:00
fixed translation service issues
This commit is contained in:
@@ -1629,6 +1629,10 @@
|
||||
|
||||
"search.filters.entityType.JournalIssue": "Journal Issue",
|
||||
|
||||
"search.filters.entityType.JournalVolume": "Journal Volume",
|
||||
|
||||
"search.filters.entityType.OrgUnit": "Organizational Unit",
|
||||
|
||||
"search.filters.has_content_in_original_bundle.true": "Yes",
|
||||
|
||||
"search.filters.has_content_in_original_bundle.false": "No",
|
||||
|
@@ -14,6 +14,7 @@ import { SearchPageComponent } from './search-page.component';
|
||||
import { SidebarFilterService } from '../shared/sidebar/filter/sidebar-filter.service';
|
||||
import { SearchFilterService } from '../core/shared/search/search-filter.service';
|
||||
import { SearchConfigurationService } from '../core/shared/search/search-configuration.service';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
const components = [
|
||||
SearchPageComponent,
|
||||
@@ -28,7 +29,7 @@ const components = [
|
||||
CommonModule,
|
||||
SharedModule,
|
||||
CoreModule.forRoot(),
|
||||
StatisticsModule.forRoot(),
|
||||
StatisticsModule.forRoot()
|
||||
],
|
||||
declarations: components,
|
||||
providers: [
|
||||
|
@@ -8,7 +8,7 @@ import { RouterStateSerializer, StoreRouterConnectingModule } from '@ngrx/router
|
||||
import { MetaReducer, StoreModule, USER_PROVIDED_META_REDUCERS } from '@ngrx/store';
|
||||
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
|
||||
import { DYNAMIC_MATCHER_PROVIDERS } from '@ng-dynamic-forms/core';
|
||||
import { MissingTranslationHandler, TranslateModule } from '@ngx-translate/core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { ScrollToModule } from '@nicky-lenaers/ngx-scroll-to';
|
||||
|
||||
import { ENV_CONFIG, GLOBAL_CONFIG, GlobalConfig } from '../config';
|
||||
@@ -39,7 +39,6 @@ import { NotificationComponent } from './shared/notifications/notification/notif
|
||||
import { NotificationsBoardComponent } from './shared/notifications/notifications-board/notifications-board.component';
|
||||
import { SharedModule } from './shared/shared.module';
|
||||
import { BreadcrumbsComponent } from './breadcrumbs/breadcrumbs.component';
|
||||
import { MissingTranslationHelper } from './shared/translate/missing-translation.helper';
|
||||
|
||||
export function getConfig() {
|
||||
return ENV_CONFIG;
|
||||
@@ -62,6 +61,7 @@ const IMPORTS = [
|
||||
CoreModule.forRoot(),
|
||||
ScrollToModule.forRoot(),
|
||||
NgbModule,
|
||||
TranslateModule.forRoot(),
|
||||
EffectsModule.forRoot(appEffects),
|
||||
StoreModule.forRoot(appReducers),
|
||||
StoreRouterConnectingModule.forRoot(),
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<a class="badge badge-primary mr-1 mb-1 text-capitalize"
|
||||
[routerLink]="searchLink"
|
||||
[queryParams]="(removeParameters | async)" queryParamsHandling="merge">
|
||||
{{('search.filters.applied.' + key) | translate}}: {{'search.filters.' + key + '.' + value | translate: {default: normalizeFilterValue(value)} }}
|
||||
{{('search.filters.applied.' + key) | translate}}: {{'search.filters.' + filterName + '.' + value | translate: {default: normalizeFilterValue(value)} }}
|
||||
<span> ×</span>
|
||||
</a>
|
||||
|
@@ -22,6 +22,11 @@ export class SearchLabelComponent implements OnInit {
|
||||
searchLink: string;
|
||||
removeParameters: Observable<Params>;
|
||||
|
||||
/**
|
||||
* The name of the filter without the f. prefix
|
||||
*/
|
||||
filterName: string;
|
||||
|
||||
/**
|
||||
* Initialize the instance variable
|
||||
*/
|
||||
@@ -33,6 +38,7 @@ export class SearchLabelComponent implements OnInit {
|
||||
ngOnInit(): void {
|
||||
this.searchLink = this.getSearchLink();
|
||||
this.removeParameters = this.getRemoveParams();
|
||||
this.filterName = this.getFilterName();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,4 +80,8 @@ export class SearchLabelComponent implements OnInit {
|
||||
const pattern = /,authority*$/g;
|
||||
return value.replace(pattern, '');
|
||||
}
|
||||
|
||||
private getFilterName(): string {
|
||||
return this.key.startsWith('f.') ? this.key.substring(2) : this.key;
|
||||
}
|
||||
}
|
||||
|
@@ -206,11 +206,11 @@ const MODULES = [
|
||||
];
|
||||
|
||||
const ROOT_MODULES = [
|
||||
TooltipModule.forRoot(),
|
||||
TranslateModule.forRoot({
|
||||
TranslateModule.forChild({
|
||||
missingTranslationHandler: { provide: MissingTranslationHandler, useClass: MissingTranslationHelper },
|
||||
useDefaultLang: true
|
||||
})
|
||||
}),
|
||||
TooltipModule.forRoot(),
|
||||
];
|
||||
|
||||
const PIPES = [
|
||||
@@ -349,7 +349,9 @@ const COMPONENTS = [
|
||||
ExistingMetadataListElementComponent,
|
||||
ItemAdminSearchResultListElementComponent,
|
||||
CommunityAdminSearchResultListElementComponent,
|
||||
CollectionAdminSearchResultListElementComponent
|
||||
CollectionAdminSearchResultListElementComponent,
|
||||
PublicationSearchResultListElementComponent,
|
||||
ExistingMetadataListElementComponent
|
||||
];
|
||||
|
||||
const ENTRY_COMPONENTS = [
|
||||
@@ -415,7 +417,7 @@ const ENTRY_COMPONENTS = [
|
||||
ExternalSourceEntryImportModalComponent,
|
||||
ItemAdminSearchResultListElementComponent,
|
||||
CommunityAdminSearchResultListElementComponent,
|
||||
CollectionAdminSearchResultListElementComponent
|
||||
CollectionAdminSearchResultListElementComponent,
|
||||
];
|
||||
|
||||
const SHARED_ITEM_PAGE_COMPONENTS = [
|
||||
@@ -448,8 +450,8 @@ const DIRECTIVES = [
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
...ROOT_MODULES,
|
||||
...MODULES,
|
||||
...ROOT_MODULES
|
||||
],
|
||||
declarations: [
|
||||
...PIPES,
|
||||
@@ -457,8 +459,7 @@ const DIRECTIVES = [
|
||||
...DIRECTIVES,
|
||||
...ENTRY_COMPONENTS,
|
||||
...SHARED_ITEM_PAGE_COMPONENTS,
|
||||
PublicationSearchResultListElementComponent,
|
||||
ExistingMetadataListElementComponent
|
||||
|
||||
],
|
||||
providers: [
|
||||
...PROVIDERS
|
||||
|
@@ -2,7 +2,6 @@ import {MissingTranslationHandler, MissingTranslationHandlerParams} from '@ngx-t
|
||||
|
||||
export class MissingTranslationHelper implements MissingTranslationHandler {
|
||||
handle(params: MissingTranslationHandlerParams) {
|
||||
console.log('bla', params);
|
||||
if (params.interpolateParams) {
|
||||
return (params.interpolateParams as any).default || params.key;
|
||||
}
|
||||
|
Reference in New Issue
Block a user