Skip to content

Commit 158e05d

Browse files
authored
Fix LT-22167: Confusing flextext Duplicate text found dialog (#496)
* Fix LT-22167: Confusing flextext Duplicate text found dialog * Fix problem identified by Jason
1 parent 7254e36 commit 158e05d

4 files changed

Lines changed: 8 additions & 7 deletions

File tree

Src/LexText/Interlinear/ITextDllTests/BIRDFormatImportTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,7 @@ public LLIMergeExtension(LcmCache cache, string tempDir, string rootDir) : base(
12821282
NumTimesDlgShown = 0;
12831283
}
12841284

1285-
protected override DialogResult ShowPossibleMergeDialog(IThreadedProgress progress)
1285+
protected override DialogResult ShowPossibleMergeDialog(IThreadedProgress progress, string textName)
12861286
{
12871287
NumTimesDlgShown++;
12881288
return DialogResult.Yes;
@@ -1301,7 +1301,7 @@ public LLINomergeExtension(LcmCache cache, string tempDir, string rootDir) : bas
13011301
NumTimesDlgShown = 0;
13021302
}
13031303

1304-
protected override DialogResult ShowPossibleMergeDialog(IThreadedProgress progress)
1304+
protected override DialogResult ShowPossibleMergeDialog(IThreadedProgress progress, string textName)
13051305
{
13061306
NumTimesDlgShown++;
13071307
return DialogResult.No;

Src/LexText/Interlinear/ITextStrings.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Src/LexText/Interlinear/ITextStrings.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ Click "Cancel" to abort this import.</value>
833833
<value>{0} texts will be imported from this SFM file.</value>
834834
</data>
835835
<data name="ksAskMergeInterlinearText" xml:space="preserve">
836-
<value>You already have this interlinear text in your project. Would you like to merge it?</value>
836+
<value>You already have the text '{0}' in your project. Would you like to merge it?</value>
837837
</data>
838838
<data name="ksAskMergeInterlinearTextTitle" xml:space="preserve">
839839
<value>Duplicate text found.</value>

Src/LexText/Interlinear/LinguaLinksImport.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ public bool ImportInterlinear(ImportInterlinearOptions options, ref LCModel.ITex
318318
ICmObject repoObj;
319319
m_cache.ServiceLocator.ObjectRepository.TryGetObject(new Guid(interlineartext.guid), out repoObj);
320320
newText = repoObj as LCModel.IText;
321-
if (newText != null && ShowPossibleMergeDialog(progress) == DialogResult.Yes)
321+
string textName = newText?.Name?.BestVernacularAnalysisAlternative?.Text ?? "";
322+
if (newText != null && ShowPossibleMergeDialog(progress, textName) == DialogResult.Yes)
322323
{
323324
continueMerge = MergeTextWithBIRDDoc(ref newText,
324325
new TextCreationParams
@@ -448,14 +449,14 @@ private static void NormalizeItems(item[] items)
448449
/// </summary>
449450
/// <param name="progress"></param>
450451
/// <returns></returns>
451-
protected virtual DialogResult ShowPossibleMergeDialog(IThreadedProgress progress)
452+
protected virtual DialogResult ShowPossibleMergeDialog(IThreadedProgress progress, string textName)
452453
{ //we need to invoke the dialog on the main thread so we can use the progress dialog as the parent.
453454
//otherwise the message box can be displayed behind everything
454455
IAsyncResult asyncResult = progress.SynchronizeInvoke.BeginInvoke(new ShowDialogAboveProgressbarDelegate(ShowDialogAboveProgressbar),
455456
new object[]
456457
{
457458
progress,
458-
ITextStrings.ksAskMergeInterlinearText,
459+
string.Format(ITextStrings.ksAskMergeInterlinearText, textName),
459460
ITextStrings.ksAskMergeInterlinearTextTitle,
460461
MessageBoxButtons.YesNo
461462
});

0 commit comments

Comments
 (0)