Translated Component Fix

Components that lack base translations will overwrite with blank text, this preserves the default text until translation is applied
This commit is contained in:
Konloch 2021-07-08 01:53:08 -07:00
parent dca90245e5
commit d651f43b62
10 changed files with 50 additions and 10 deletions

View File

@ -20,7 +20,11 @@ public class TranslatedDefaultMutableTreeNode extends DefaultMutableTreeNode
if(translation != null)
{
componentReference = translation.getTranslatedComponentReference();
componentReference.runOnUpdate.add(()-> setUserObject(componentReference.value));
componentReference.runOnUpdate.add(()->
{
if(componentReference.value != null && componentReference.value.isEmpty())
setUserObject(componentReference.value);
});
componentReference.translate();
}
else

View File

@ -20,7 +20,11 @@ public class TranslatedJButton extends JButton
if(translation != null)
{
componentReference = translation.getTranslatedComponentReference();
componentReference.runOnUpdate.add(()-> setText(componentReference.value));
componentReference.runOnUpdate.add(()->
{
if(componentReference.value != null && componentReference.value.isEmpty())
setText(componentReference.value);
});
componentReference.translate();
}
else

View File

@ -38,7 +38,11 @@ public class TranslatedJCheckBox extends JCheckBox
if(translation != null)
{
componentReference = translation.getTranslatedComponentReference();
componentReference.runOnUpdate.add(()-> setText(componentReference.value));
componentReference.runOnUpdate.add(()->
{
if(componentReference.value != null && componentReference.value.isEmpty())
setText(componentReference.value);
});
componentReference.translate();
}
else

View File

@ -38,7 +38,11 @@ public class TranslatedJCheckBoxMenuItem extends JCheckBoxMenuItem
if(translation != null)
{
componentReference = translation.getTranslatedComponentReference();
componentReference.runOnUpdate.add(()-> setText(componentReference.value));
componentReference.runOnUpdate.add(()->
{
if(componentReference.value != null && componentReference.value.isEmpty())
setText(componentReference.value);
});
componentReference.translate();
}
else

View File

@ -20,7 +20,11 @@ public class TranslatedJLabel extends JLabel
if(translation != null)
{
componentReference = translation.getTranslatedComponentReference();
componentReference.runOnUpdate.add(()-> setText(componentReference.value));
componentReference.runOnUpdate.add(()->
{
if(componentReference.value != null && componentReference.value.isEmpty())
setText(componentReference.value);
});
componentReference.translate();
}
else

View File

@ -38,7 +38,11 @@ public class TranslatedJMenu extends JMenu
if(translation != null)
{
componentReference = translation.getTranslatedComponentReference();
componentReference.runOnUpdate.add(()-> setText(componentReference.value));
componentReference.runOnUpdate.add(()->
{
if(componentReference.value != null && componentReference.value.isEmpty())
setText(componentReference.value);
});
componentReference.translate();
}
else

View File

@ -38,7 +38,11 @@ public class TranslatedJMenuItem extends JMenuItem
if(translation != null)
{
componentReference = translation.getTranslatedComponentReference();
componentReference.runOnUpdate.add(()-> setText(componentReference.value));
componentReference.runOnUpdate.add(()->
{
if(componentReference.value != null && componentReference.value.isEmpty())
setText(componentReference.value);
});
componentReference.translate();
}
else

View File

@ -38,7 +38,11 @@ public class TranslatedJRadioButtonMenuItem extends JRadioButtonMenuItem
if(translation != null)
{
componentReference = translation.getTranslatedComponentReference();
componentReference.runOnUpdate.add(()-> setText(componentReference.value));
componentReference.runOnUpdate.add(()->
{
if(componentReference.value != null && componentReference.value.isEmpty())
setText(componentReference.value);
});
componentReference.translate();
}
else

View File

@ -20,7 +20,11 @@ public class TranslatedJTextField extends JTextField
if(translation != null)
{
componentReference = translation.getTranslatedComponentReference();
componentReference.runOnUpdate.add(()-> setText(componentReference.value));
componentReference.runOnUpdate.add(()->
{
if(componentReference.value != null && componentReference.value.isEmpty())
setText(componentReference.value);
});
componentReference.translate();
}
else

View File

@ -19,7 +19,11 @@ public class TranslatedVisibleComponent extends VisibleComponent
if(translation != null)
{
componentReference = translation.getTranslatedComponentReference();
componentReference.runOnUpdate.add(()-> setTitle(componentReference.value));
componentReference.runOnUpdate.add(()->
{
if(componentReference.value != null && componentReference.value.isEmpty())
setTitle(componentReference.value);
});
componentReference.translate();
}
else