Skip to content

Commit

Permalink
Issue 3650: Updating & Adding Internationalization Keys & Messages
Browse files Browse the repository at this point in the history
  • Loading branch information
psikomonkie committed Jan 9, 2025
1 parent 89cd99f commit e408853
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
AssignForceToTransportMenu.transportSpaceRemaining.text={0} | Space Remaining: {1}

AssignForceToTransportMenu.TACTICAL_TRANSPORT.text=Assign Force to Tactical Transport
AssignForceToTransportMenu.SHIP_TRANSPORT.text=Assign Force to Ship Transport
AssignForceToTransportMenu.ASFBay.text=ASF Bay
Expand All @@ -19,3 +20,10 @@ AssignForceToTransportMenu.ClampMountTank.text=Clamp Mount Tank
AssignForceToTransportMenu.ProtoMekClampMount=ProtoMek Clamp Mount
AssignForceToTransportMenu.DockingCollar=Docking Collar
AssignForceToTransportMenu.TrailerHitch=Trailer Hitch

TOEMouseAdapter.unassign.TACTICAL_TRANSPORT.text=Unassign Force from Tactical Transport
TOEMouseAdapter.unassign.SHIP_TRANSPORT.text=Unassign Force from Ship Transport

AtBGameThread.loadTransportDialog.TACTICAL_TRANSPORT.title=Load Units onto Transport?
AtBGameThread.loadTransportDialog.TACTICAL_TRANSPORT.text=Would you like the units assigned to {0} to deploy loaded?

5 changes: 3 additions & 2 deletions MekHQ/src/mekhq/AtBGameThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import mekhq.campaign.unit.TransportAssignment;
import mekhq.campaign.unit.TransportShipAssignment;
import mekhq.campaign.unit.Unit;
import mekhq.utilities.Internationalization;

import javax.swing.*;
import java.io.File;
Expand Down Expand Up @@ -488,8 +489,8 @@ public void run() {

if (transport.hasTacticalTransportedUnits()) {
loadTactical = (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(null,
String.format(AtBGameThread.LOAD_GND_DIALOG_TEXT, transport.getName()),
AtBGameThread.LOAD_GND_DIALOG_TITLE, JOptionPane.YES_NO_OPTION));
Internationalization.getFormattedTextAt("AssignForceToTransport", "AtBGameThread.loadTransportDialog.TACTICAL_TRANSPORT.text", transport.getName()),
Internationalization.getFormattedTextAt("AssignForceToTransport", "AtBGameThread.loadTransportDialog.TACTICAL_TRANSPORT.title"), JOptionPane.YES_NO_OPTION));
}

// Now, send the load commands
Expand Down
4 changes: 2 additions & 2 deletions MekHQ/src/mekhq/campaign/Campaign.java
Original file line number Diff line number Diff line change
Expand Up @@ -1430,9 +1430,9 @@ public void removeShipTransporter(Unit unit) {
}

/**
* Deletes an entry from the list of transit-capable transport ships. This gets
* Deletes an entry from the list of transit-capable transport units. This gets
* updated when
* the ship is removed from the campaign for one reason or another
* the unit is removed from the campaign for one reason or another
*
* @param unit - The ship we want to remove from this Set
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,7 @@ else if (transporterType != null){
}
addTransportedUnit(Objects.requireNonNull(transportedUnit));

//if ((transportedUnit.getEntity() != null)) {
// if (transport.getEntity() != null) {
// loadEntity(transportedUnit.getEntity());
// }
//}

// If the old transport was TODO
// Update Transport Capacities
if (!Objects.equals(oldTransport, transport)
&& (transportedUnit.getTacticalTransportAssignment().getTransporterType() != oldTransporterType)) {
setCurrentTransportCapacity(transporterType,
Expand Down
4 changes: 1 addition & 3 deletions MekHQ/src/mekhq/campaign/unit/TransportAssignment.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,9 @@ public void fixReferences(Campaign campaign, Unit unit) {
if (transport != null) {
if (hasTransportedLocation()) {
setTransport(transport);
//setTransportedLocation(getTransportedLocation());
//setTransporterType(hasTransportedLocation() ? getTransportedLocation().getClass() : null);

} else if (hasTransporterType()) {
setTransport(transport);
//setTransporterType(getTransporterType());
}
else {
setTransport(transport);
Expand Down
5 changes: 3 additions & 2 deletions MekHQ/src/mekhq/gui/adapter/TOEMouseAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import mekhq.gui.menus.ExportUnitSpriteMenu;
import mekhq.gui.utilities.JMenuHelpers;
import mekhq.gui.utilities.StaticChecks;
import mekhq.utilities.Internationalization;

import javax.swing.*;
import javax.swing.tree.TreePath;
Expand Down Expand Up @@ -1461,7 +1462,7 @@ private void clearTransportAssignment(@Nullable Unit currentUnit) {

private void unassignShipTransportMenuClass(Vector<Unit> units, JPopupMenu popup) {
if (units.stream().allMatch(Unit::hasTransportShipAssignment) && !StaticChecks.areAnyUnitsDeployed(units)) {
JMenuItem menuItem = new JMenuItem("Unassign Unit from Transport Ship");
JMenuItem menuItem = new JMenuItem(Internationalization.getTextAt("AssignForceToTransport", "TOEMouseAdapter.unassign.SHIP_TRANSPORT.text"));
menuItem.addActionListener(evt -> {
unassignTransportAction(SHIP_TRANSPORT, units.toArray(new Unit[0]));});
menuItem.setEnabled(true);
Expand All @@ -1471,7 +1472,7 @@ private void unassignShipTransportMenuClass(Vector<Unit> units, JPopupMenu popup

private void unassignTacticalTransportMenuClass(Vector<Unit> units, JPopupMenu popup) {
if (units.stream().allMatch(Unit::hasTacticalTransportAssignment) && !StaticChecks.areAnyUnitsDeployed(units)) {
JMenuItem menuItem = new JMenuItem("Unassign Unit from Tactical Transport");
JMenuItem menuItem = new JMenuItem(Internationalization.getTextAt("AssignForceToTransport", "TOEMouseAdapter.unassign.TACTICAL_TRANSPORT.text"));
menuItem.addActionListener(evt -> {
unassignTransportAction(TACTICAL_TRANSPORT, units.toArray(new Unit[0]));
});
Expand Down
6 changes: 4 additions & 2 deletions MekHQ/src/mekhq/gui/menus/AssignForceToShipTransportMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import mekhq.MekHQ;
import mekhq.campaign.Campaign;
import mekhq.campaign.event.UnitChangedEvent;
import mekhq.campaign.unit.ShipTransportedUnitsSummary;
import mekhq.campaign.unit.Unit;

import java.awt.event.ActionEvent;
Expand All @@ -13,6 +12,9 @@

import static mekhq.campaign.enums.CampaignTransportType.SHIP_TRANSPORT;

/**
* Menu for assigning a unit to a specific Ship Transport
*/
public class AssignForceToShipTransportMenu extends AssignForceToTransportMenu {

public AssignForceToShipTransportMenu(Campaign campaign, Unit... units) {
Expand Down Expand Up @@ -42,7 +44,7 @@ protected Set<Class<? extends Transporter>> filterTransporterTypeMenus(final Uni
protected void transportMenuAction(ActionEvent evt, Class<? extends Transporter> transporterType, Unit transport, Unit... units) {
for (Unit unit : units) {
if (!transport.getEntity().canLoad(unit.getEntity(), false)) {
return; //TODO error popup
return;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import mekhq.MekHQ;
import mekhq.campaign.Campaign;
import mekhq.campaign.event.UnitChangedEvent;
import mekhq.campaign.unit.TacticalTransportedUnitsSummary;
import mekhq.campaign.unit.Unit;

import java.awt.event.ActionEvent;
Expand All @@ -13,6 +12,9 @@

import static mekhq.campaign.enums.CampaignTransportType.TACTICAL_TRANSPORT;

/**
* Menu for assigning a force to a specific Tactical transport
*/
public class AssignForceToTacticalTransportMenu extends AssignForceToTransportMenu {

public AssignForceToTacticalTransportMenu(Campaign campaign, Unit... units) {
Expand Down Expand Up @@ -42,7 +44,7 @@ protected Set<Class<? extends Transporter>> filterTransporterTypeMenus(final Uni
protected void transportMenuAction(ActionEvent evt, Class<? extends Transporter> transporterType, Unit transport, Unit... units) {
for (Unit unit : units) {
if (!transport.getEntity().canLoad(unit.getEntity(), false)) {
return; //TODO error popup
return;
}

}
Expand Down
4 changes: 3 additions & 1 deletion MekHQ/src/mekhq/gui/menus/AssignForceToTransportMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
import java.util.Set;
import java.util.stream.Stream;

/**
* Generic menu for displaying transports for the units in the force selected (or an individual unit)
*/
public abstract class AssignForceToTransportMenu extends JScrollableMenu {

final Campaign campaign;
Expand Down Expand Up @@ -70,7 +73,6 @@ calculation methods (an infantry and tank were both selected)
Set<Unit> transports = campaign.getTransportsByType(campaignTransportType, transporterType, requiredTransportCapacity);

if (!transports.isEmpty()) {
//TODO
JScrollableMenu transporterTypeMenu = new JScrollableMenu(transporterType.getName(), transporterType.getName());
Set<JMenuItem> transportMenus = createTransportMenus(transporterType, transports, units);
for (JMenuItem transportMenu : transportMenus) {
Expand Down

0 comments on commit e408853

Please sign in to comment.