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:
parent
dca90245e5
commit
d651f43b62
10 changed files with 50 additions and 10 deletions
|
@ -20,7 +20,11 @@ public class TranslatedDefaultMutableTreeNode extends DefaultMutableTreeNode
|
||||||
if(translation != null)
|
if(translation != null)
|
||||||
{
|
{
|
||||||
componentReference = translation.getTranslatedComponentReference();
|
componentReference = translation.getTranslatedComponentReference();
|
||||||
componentReference.runOnUpdate.add(()-> setUserObject(componentReference.value));
|
componentReference.runOnUpdate.add(()->
|
||||||
|
{
|
||||||
|
if(componentReference.value != null && componentReference.value.isEmpty())
|
||||||
|
setUserObject(componentReference.value);
|
||||||
|
});
|
||||||
componentReference.translate();
|
componentReference.translate();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -20,7 +20,11 @@ public class TranslatedJButton extends JButton
|
||||||
if(translation != null)
|
if(translation != null)
|
||||||
{
|
{
|
||||||
componentReference = translation.getTranslatedComponentReference();
|
componentReference = translation.getTranslatedComponentReference();
|
||||||
componentReference.runOnUpdate.add(()-> setText(componentReference.value));
|
componentReference.runOnUpdate.add(()->
|
||||||
|
{
|
||||||
|
if(componentReference.value != null && componentReference.value.isEmpty())
|
||||||
|
setText(componentReference.value);
|
||||||
|
});
|
||||||
componentReference.translate();
|
componentReference.translate();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -38,7 +38,11 @@ public class TranslatedJCheckBox extends JCheckBox
|
||||||
if(translation != null)
|
if(translation != null)
|
||||||
{
|
{
|
||||||
componentReference = translation.getTranslatedComponentReference();
|
componentReference = translation.getTranslatedComponentReference();
|
||||||
componentReference.runOnUpdate.add(()-> setText(componentReference.value));
|
componentReference.runOnUpdate.add(()->
|
||||||
|
{
|
||||||
|
if(componentReference.value != null && componentReference.value.isEmpty())
|
||||||
|
setText(componentReference.value);
|
||||||
|
});
|
||||||
componentReference.translate();
|
componentReference.translate();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -38,7 +38,11 @@ public class TranslatedJCheckBoxMenuItem extends JCheckBoxMenuItem
|
||||||
if(translation != null)
|
if(translation != null)
|
||||||
{
|
{
|
||||||
componentReference = translation.getTranslatedComponentReference();
|
componentReference = translation.getTranslatedComponentReference();
|
||||||
componentReference.runOnUpdate.add(()-> setText(componentReference.value));
|
componentReference.runOnUpdate.add(()->
|
||||||
|
{
|
||||||
|
if(componentReference.value != null && componentReference.value.isEmpty())
|
||||||
|
setText(componentReference.value);
|
||||||
|
});
|
||||||
componentReference.translate();
|
componentReference.translate();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -20,7 +20,11 @@ public class TranslatedJLabel extends JLabel
|
||||||
if(translation != null)
|
if(translation != null)
|
||||||
{
|
{
|
||||||
componentReference = translation.getTranslatedComponentReference();
|
componentReference = translation.getTranslatedComponentReference();
|
||||||
componentReference.runOnUpdate.add(()-> setText(componentReference.value));
|
componentReference.runOnUpdate.add(()->
|
||||||
|
{
|
||||||
|
if(componentReference.value != null && componentReference.value.isEmpty())
|
||||||
|
setText(componentReference.value);
|
||||||
|
});
|
||||||
componentReference.translate();
|
componentReference.translate();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -38,7 +38,11 @@ public class TranslatedJMenu extends JMenu
|
||||||
if(translation != null)
|
if(translation != null)
|
||||||
{
|
{
|
||||||
componentReference = translation.getTranslatedComponentReference();
|
componentReference = translation.getTranslatedComponentReference();
|
||||||
componentReference.runOnUpdate.add(()-> setText(componentReference.value));
|
componentReference.runOnUpdate.add(()->
|
||||||
|
{
|
||||||
|
if(componentReference.value != null && componentReference.value.isEmpty())
|
||||||
|
setText(componentReference.value);
|
||||||
|
});
|
||||||
componentReference.translate();
|
componentReference.translate();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -38,7 +38,11 @@ public class TranslatedJMenuItem extends JMenuItem
|
||||||
if(translation != null)
|
if(translation != null)
|
||||||
{
|
{
|
||||||
componentReference = translation.getTranslatedComponentReference();
|
componentReference = translation.getTranslatedComponentReference();
|
||||||
componentReference.runOnUpdate.add(()-> setText(componentReference.value));
|
componentReference.runOnUpdate.add(()->
|
||||||
|
{
|
||||||
|
if(componentReference.value != null && componentReference.value.isEmpty())
|
||||||
|
setText(componentReference.value);
|
||||||
|
});
|
||||||
componentReference.translate();
|
componentReference.translate();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -38,7 +38,11 @@ public class TranslatedJRadioButtonMenuItem extends JRadioButtonMenuItem
|
||||||
if(translation != null)
|
if(translation != null)
|
||||||
{
|
{
|
||||||
componentReference = translation.getTranslatedComponentReference();
|
componentReference = translation.getTranslatedComponentReference();
|
||||||
componentReference.runOnUpdate.add(()-> setText(componentReference.value));
|
componentReference.runOnUpdate.add(()->
|
||||||
|
{
|
||||||
|
if(componentReference.value != null && componentReference.value.isEmpty())
|
||||||
|
setText(componentReference.value);
|
||||||
|
});
|
||||||
componentReference.translate();
|
componentReference.translate();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -20,7 +20,11 @@ public class TranslatedJTextField extends JTextField
|
||||||
if(translation != null)
|
if(translation != null)
|
||||||
{
|
{
|
||||||
componentReference = translation.getTranslatedComponentReference();
|
componentReference = translation.getTranslatedComponentReference();
|
||||||
componentReference.runOnUpdate.add(()-> setText(componentReference.value));
|
componentReference.runOnUpdate.add(()->
|
||||||
|
{
|
||||||
|
if(componentReference.value != null && componentReference.value.isEmpty())
|
||||||
|
setText(componentReference.value);
|
||||||
|
});
|
||||||
componentReference.translate();
|
componentReference.translate();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -19,7 +19,11 @@ public class TranslatedVisibleComponent extends VisibleComponent
|
||||||
if(translation != null)
|
if(translation != null)
|
||||||
{
|
{
|
||||||
componentReference = translation.getTranslatedComponentReference();
|
componentReference = translation.getTranslatedComponentReference();
|
||||||
componentReference.runOnUpdate.add(()-> setTitle(componentReference.value));
|
componentReference.runOnUpdate.add(()->
|
||||||
|
{
|
||||||
|
if(componentReference.value != null && componentReference.value.isEmpty())
|
||||||
|
setTitle(componentReference.value);
|
||||||
|
});
|
||||||
componentReference.translate();
|
componentReference.translate();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue