fix duplicate filter
This commit is contained in:
parent
e8236b272b
commit
d4ef478d48
@ -116,7 +116,7 @@ public class FilteredDataBus implements BusListener {
|
|||||||
|
|
||||||
// filter duplicate values
|
// filter duplicate values
|
||||||
if(filterDuplicate) {
|
if(filterDuplicate) {
|
||||||
if(!isDuplicate(value)) {
|
if(!isDuplicate(key, value)) {
|
||||||
shadow.setTranslation(key, null);
|
shadow.setTranslation(key, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,13 +155,17 @@ public class FilteredDataBus implements BusListener {
|
|||||||
/**
|
/**
|
||||||
* Filter duplicate translation values
|
* Filter duplicate translation values
|
||||||
*/
|
*/
|
||||||
private boolean isDuplicate(@NotNull TranslationValue value) {
|
private boolean isDuplicate(@NotNull KeyPath key, @NotNull TranslationValue value) {
|
||||||
Collection<String> contents = value.getLocaleContents();
|
Collection<String> contents = value.getLocaleContents();
|
||||||
|
|
||||||
for (KeyPath currentKey : this.data.getFullKeys()) {
|
for (KeyPath currentKey : this.data.getFullKeys()) {
|
||||||
TranslationValue currentValue = this.data.getTranslation(currentKey);
|
TranslationValue currentValue = this.data.getTranslation(currentKey);
|
||||||
assert currentValue != null;
|
assert currentValue != null;
|
||||||
|
|
||||||
|
if(currentKey.equals(key)) { // Only consider other translations
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (String currentContent : currentValue.getLocaleContents()) {
|
for (String currentContent : currentValue.getLocaleContents()) {
|
||||||
if(contents.contains(currentContent)) {
|
if(contents.contains(currentContent)) {
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user