From e45b88ce38f1f8217b243cc06565900f206ca5d6 Mon Sep 17 00:00:00 2001 From: Nick Stokoe Date: Thu, 31 Aug 2023 17:10:43 +0100 Subject: [PATCH] app/model/vocabs.ts - disallow omission of language params In getVocabForUri and getTerm --- src/map-app/app/model/vocabs.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/map-app/app/model/vocabs.ts b/src/map-app/app/model/vocabs.ts index c0c0a13f..07d2d5b7 100644 --- a/src/map-app/app/model/vocabs.ts +++ b/src/map-app/app/model/vocabs.ts @@ -64,7 +64,7 @@ export interface VocabServices { // Gets a vocab for the given URI / language // Throws an exception if the URI can't be found. - // Uses the value of getFallBackLanguage() if the language can't be found. + // // Returns the Vocab found. getVocabForUri(uri: string, language: string): Vocab; @@ -85,9 +85,7 @@ export interface VocabServices { getLocalisedVocabs(language: string): LocalisedVocab; // Gets a vocab term from the (possibly abbreviated) URI in the given language - // Falls back to the default fall-back language if no language given, or - // the term is not localised in that language - getTerm(termUri: string, language?: string): string; + getTerm(termUri: string, language: string): string; // Construct the object of terms for advanced search // @@ -278,7 +276,7 @@ export class VocabServiceImpl implements VocabServices { } } - getVocabForUri(uri: string, language: string = this.fallBackLanguage): Vocab { + getVocabForUri(uri: string, language: string): Vocab { // Assume propertySchema's vocabUris are validated. But language availability can't be // checked so easily. const vocab = this.vocabs.vocabs[this.abbrevUri(uri)]; @@ -295,10 +293,7 @@ export class VocabServiceImpl implements VocabServices { } // Gets a vocab term from the (possibly abbreviated) URI in the given language - // Falls back to the default fall-back language if no language given, or - // the term is not localised in that language - getTerm(termUri: string, language?: string) { - language ??= this.fallBackLanguage; + getTerm(termUri: string, language: string) { termUri = this.abbrevUri(termUri); const [prefix, _] = termUri.split(':', 2);