-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: display ontology labels in prefffered language (DEV-3739) #1651
fix: display ontology labels in prefffered language (DEV-3739) #1651
Conversation
matTooltipShowDelay="750" | ||
[matTooltipPosition]="'above'" | ||
[matTooltipDisabled]="tooltipDisabled"> | ||
{{ resClass.label }} | ||
{{ displayOntologyLabelsInPreferredLanguage() }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not use a method in the view, as it calls it many many times during the rerender
@@ -36,7 +37,7 @@ import { map, takeUntil } from 'rxjs/operators'; | |||
export class OntologyClassItemComponent implements OnInit, AfterViewInit, OnDestroy { | |||
destroyed: Subject<void> = new Subject<void>(); | |||
|
|||
@Input() resClass: ClassDefinition; | |||
@Input() resClass: ResourceClassDefinitionWithAllLanguages; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add "?" if it is not required, otherwise @input({required: true}) variable!;
prefferedLanguage = l; | ||
}); | ||
|
||
if (this.resClass.labels) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should go in the subscribe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const preferedLanguage = this._store.selectSnapshot(UserSelector.language);
@@ -66,6 +67,8 @@ export class OntologyClassItemComponent implements OnInit, AfterViewInit, OnDest | |||
}, | |||
}; | |||
|
|||
ontologiesLabel: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ontologiesLabel?: string;
// https://github.com/dasch-swiss/dsp-das/pull/1651 | ||
const prefferedLanguage = this._store.selectSnapshot(UserSelectors.language); | ||
|
||
if (this.resClass.labels) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so if this condition is not met, ontologiesLabel stays undefined, is that what we want ? (just asking I don't know what's the right behaviour)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not necessary, because of the guard I added: this.resClass.labels[0].value
. If there is no match between label languages and preferred language, the first one from the labels array is applied, and at least one label is required AFAIK.
…-preferred-language
resolves DEV-3739