Skip to content

Commit

Permalink
Add fwdata support for example sentnce translations
Browse files Browse the repository at this point in the history
I think there's typically only 1, but there's a Find example sentence feature in FLEx that copies more from other sources. With my change, I think we safely support editing the first translation.
  • Loading branch information
myieye committed Jun 13, 2024
1 parent 7bc9bb1 commit 27008d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion backend/FwDataMiniLcmBridge/Api/FwDataMiniLcmApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,13 @@ private Sense FromLexSense(ILexSense sense)

private ExampleSentence FromLexExampleSentence(ILexExampleSentence sentence)
{
var translation = sentence.TranslationsOC.FirstOrDefault()?.Translation;
return new ExampleSentence
{
Id = sentence.Guid,
Sentence = FromLcmMultiString(sentence.Example),
Reference = sentence.Reference.Text
Reference = sentence.Reference.Text,
Translation = translation is null ? new MultiString() : FromLcmMultiString(translation),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ public override MultiString Sentence

public override MultiString Translation
{
get => throw new NotImplementedException();
get
{
var firstTranslation = sentence.TranslationsOC.FirstOrDefault()?.Translation;
return firstTranslation is null ? new MultiString() : new UpdateMultiStringProxy(firstTranslation, lexboxLcmApi);
}
set => throw new NotImplementedException();
}

Expand Down

0 comments on commit 27008d5

Please sign in to comment.