Skip to content

Commit

Permalink
[Enhancement #291] Fix minor issues in multilingual vocabularies.
Browse files Browse the repository at this point in the history
  • Loading branch information
ledsoft committed Feb 27, 2024
1 parent af67bb0 commit 900ac53
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/component/vocabulary/CreateVocabularyForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ const CreateVocabularyForm: React.FC<CreateVocabularyFormProps> = ({
}
});
};
const onLanguageSwitch = (lang: string) => {
if (iri.length > 0) {
setShouldGenerateIri(false);
selectLanguage(lang);
}
};
const onSubmit = () => {
const vocabulary = new Vocabulary({
iri,
Expand Down Expand Up @@ -130,7 +136,7 @@ const CreateVocabularyForm: React.FC<CreateVocabularyFormProps> = ({
<EditLanguageSelector
language={language}
existingLanguages={Vocabulary.getLanguages({ label, comment })}
onSelect={selectLanguage}
onSelect={onLanguageSwitch}
onRemove={removeTranslation}
/>
<Card id="create-vocabulary">
Expand Down
7 changes: 5 additions & 2 deletions src/model/Vocabulary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ import {
const ctx = {
label: context(VocabularyUtils.DC_TITLE),
comment: context(VocabularyUtils.DC_DESCRIPTION),
document: VocabularyUtils.DESCRIBES_DOCUMENT,
document: {
"@id": VocabularyUtils.DESCRIBES_DOCUMENT,
"@context": DOCUMENT_CONTEXT,
},
glossary: VocabularyUtils.HAS_GLOSSARY,
model: VocabularyUtils.HAS_MODEL,
importedVocabularies: VocabularyUtils.IMPORTS_VOCABULARY,
accessLevel: JsonLdUtils.idContext(VocabularyUtils.HAS_ACCESS_LEVEL),
};

export const CONTEXT = Object.assign({}, ASSET_CONTEXT, DOCUMENT_CONTEXT, ctx);
export const CONTEXT = Object.assign({}, ASSET_CONTEXT, ctx);

const MAPPED_PROPERTIES = [
"@context",
Expand Down

0 comments on commit 900ac53

Please sign in to comment.