Skip to content

Commit

Permalink
Display first entry instead of empty as file name
Browse files Browse the repository at this point in the history
  • Loading branch information
t-cordonnier committed Dec 2, 2024
1 parent a858d4e commit d1944d0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/org/omegat/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2160,6 +2160,8 @@ MATCHES_THIS_PROJECT=This project
# 0 Number of additional matches. There is a non-break space between {0} and more
MATCHES_MULTI_FILE_HINT=(+{0}\u00A0more)

MATCHES_SUBSEGMENTS_HINT=(+subsegments)

MATCHES_OPEN_PREFERENCES=TM Matching Options

# Dictionary area popup menu
Expand Down
2 changes: 2 additions & 0 deletions src/org/omegat/Bundle_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1965,6 +1965,8 @@ MATCHES_THIS_PROJECT=Ce projet
# 0 Number of additional matches. There is a non-break space between {0} and more
MATCHES_MULTI_FILE_HINT=({0}\u00A0de\u00A0plus)

MATCHES_SUBSEGMENTS_HINT=(+sous-segments)

MATCHES_OPEN_PREFERENCES=Options des correspondances

# Dictionary area popup menu
Expand Down
11 changes: 10 additions & 1 deletion src/org/omegat/core/statistics/FindMatches.java
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ public List<NearString> search(String searchText, boolean requiresTranslation, b
List<String> fsrc = new ArrayList<>(segments.size());
List<String> ftrans = new ArrayList<>(segments.size());
int maxPenalty = 0;
String first = OStrings.getString("MATCHES_THIS_PROJECT");
// multiple segments
for (String onesrc : segments) {
// find match for a separate segment
Expand All @@ -293,6 +294,13 @@ public List<NearString> search(String searchText, boolean requiresTranslation, b
maxPenalty = penalty;
}
}
if ((segmentMatch.get(0).projs != null) && (segmentMatch.get(0).projs[0] != null)) {
if (segmentMatch.get(0).projs[0].length() > 0) {
first = segmentMatch.get(0).projs[0];
} else {
first = OStrings.getString("MATCHES_THIS_PROJECT");
}
}
} else {
fsrc.add("");
ftrans.add("");
Expand All @@ -302,7 +310,8 @@ public List<NearString> search(String searchText, boolean requiresTranslation, b
PrepareTMXEntry entry = new PrepareTMXEntry();
entry.source = segmenter.glue(sourceLang, sourceLang, fsrc, spaces, brules);
entry.translation = segmenter.glue(sourceLang, targetLang, ftrans, spaces, brules);
processEntry(null, entry, "", NearString.MATCH_SOURCE.TM, false, 0);
processEntry(null, entry, first + " " + OStrings.getString("MATCHES_SUBSEGMENTS_HINT"),
NearString.MATCH_SOURCE.TM, false, 0);
}
}
// fill similarity data only for a result
Expand Down

0 comments on commit d1944d0

Please sign in to comment.