Skip to content

Commit

Permalink
Updated tooltip text formatting for marriageability
Browse files Browse the repository at this point in the history
The tooltip text for the "Marriageable" menu item has been updated to use the String.format method for cleaner text replacement. Additionally, the GUI properties file has been adjusted to support this update, changing the replacement syntax to use a placeholder ("%s") for the minimum marriage age.
  • Loading branch information
IllianiCBT committed May 16, 2024
1 parent c18b4eb commit 77ad875
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion MekHQ/resources/mekhq/resources/GUI.properties
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ miFounder.toolTipText=If this is selected then the person is a founding member o
miImmortal.text=Immortal
miImmortal.toolTipText=If this is selected then the person will not be processed during random death \n(standard checks still apply)
miMarriageable.text=Marriageable
miMarriageable.toolTipText=If this is selected, then the person will be included as a potential spouse for marriages (married personnel will not be included even if this flag is selected, nor will characters under 0 years old)
miMarriageable.toolTipText=If this is selected, then the person will be included as a potential spouse for marriages (married personnel will not be included even if this flag is selected, nor will characters under %s years old)
miTryingToConceive.text=Trying to Conceive
miTryingToConceive.toolTipText=If this is selected, the person has a chance to have children created through random procreation (this flag is ignored for personnel under 18 years old).
### Randomization Menu
Expand Down
4 changes: 2 additions & 2 deletions MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -2165,8 +2165,8 @@ protected Optional<JPopupMenu> createPopupMenu() {
|| !gui.getCampaign().getCampaignOptions().getRandomMarriageMethod().isNone())
&& Stream.of(selected).allMatch(p -> p.isMarriageable() == person.isMarriageable())) {
cbMenuItem = new JCheckBoxMenuItem(resources.getString("miMarriageable.text"));
cbMenuItem.setToolTipText(MultiLineTooltip.splitToolTip(resources.getString("miMarriageable.toolTipText")
.replaceAll("0", String.valueOf(gui.getCampaign().getCampaignOptions().getMinimumMarriageAge())), 100));
cbMenuItem.setToolTipText(MultiLineTooltip.splitToolTip(String.format(resources.getString("miMarriageable.toolTipText"),
gui.getCampaign().getCampaignOptions().getMinimumMarriageAge()), 100));
cbMenuItem.setName("miMarriageable");
cbMenuItem.setSelected(person.isMarriageable());
cbMenuItem.addActionListener(evt -> {
Expand Down

0 comments on commit 77ad875

Please sign in to comment.