menuBuilder = MenuBuilder.on(getPage(), divs);
menuBuilder.item(
- _("See resource allocation"),
+ tr("See resource allocation"),
"/common/img/ico_allocation.png",
(chosen, event) -> schedule(loadLine));
@@ -181,7 +181,7 @@ public class ResourceLoadComponent extends XulElement {
Div result = new Div();
result.setClass(String.format("taskassignmentinterval %s", loadPeriod.getLoadLevel().getCategory()));
- String load = _("Load: {0}%", loadPeriod.getLoadLevel().getPercentage()) + ", ";
+ String load = tr("Load: {0}%", loadPeriod.getLoadLevel().getPercentage()) + ", ";
if (loadPeriod.getLoadLevel().getPercentage() == Integer.MAX_VALUE) {
load = "";
@@ -189,7 +189,7 @@ public class ResourceLoadComponent extends XulElement {
result.setTooltiptext(
load +
- _("available effort: {0}, assigned effort: {1}",
+ tr("available effort: {0}, assigned effort: {1}",
loadPeriod.getAvailableEffort(),
loadPeriod.getAssignedEffort()));
diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/resourceload/ResourceLoadLeftPane.java b/ganttzk/src/main/java/org/zkoss/ganttz/resourceload/ResourceLoadLeftPane.java
index 77fa98c20..d05abfa3d 100644
--- a/ganttzk/src/main/java/org/zkoss/ganttz/resourceload/ResourceLoadLeftPane.java
+++ b/ganttzk/src/main/java/org/zkoss/ganttz/resourceload/ResourceLoadLeftPane.java
@@ -21,7 +21,7 @@
package org.zkoss.ganttz.resourceload;
-import static org.zkoss.ganttz.i18n.I18nHelper._;
+import static org.zkoss.ganttz.i18n.I18nHelper.tr;
import java.util.ArrayList;
import java.util.List;
@@ -167,7 +167,7 @@ public class ResourceLoadLeftPane extends HtmlMacroComponent {
buttonPlan.setSclass("icono");
buttonPlan.setImage("/common/img/ico_planificador1.png");
buttonPlan.setHoverImage("/common/img/ico_planificador.png");
- buttonPlan.setTooltiptext(_("See scheduling"));
+ buttonPlan.setTooltiptext(tr("See scheduling"));
buttonPlan.addEventListener("onClick", event -> schedule(taskLine));
cell.appendChild(buttonPlan);
diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/resourceload/ResourcesLoadPanel.java b/ganttzk/src/main/java/org/zkoss/ganttz/resourceload/ResourcesLoadPanel.java
index 9e0b7750b..c7ff1e687 100644
--- a/ganttzk/src/main/java/org/zkoss/ganttz/resourceload/ResourcesLoadPanel.java
+++ b/ganttzk/src/main/java/org/zkoss/ganttz/resourceload/ResourcesLoadPanel.java
@@ -21,7 +21,7 @@
package org.zkoss.ganttz.resourceload;
-import static org.zkoss.ganttz.i18n.I18nHelper._;
+import static org.zkoss.ganttz.i18n.I18nHelper.tr;
import java.util.List;
@@ -83,9 +83,9 @@ public class ResourcesLoadPanel extends HtmlMacroComponent {
private WeakReferencedListeners
zoomListeners = WeakReferencedListeners.create();
- private final String FILTER_RESOURCES = _("Resources");
+ private final String FILTER_RESOURCES = tr("Resources");
- private final String FILTER_CRITERIA = _("Generic allocation criteria");
+ private final String FILTER_CRITERIA = tr("Generic allocation criteria");
private final String FILTER_BY_NAME_COMBO_COMPONENT = "filterByNameCombo";
@@ -156,10 +156,10 @@ public class ResourcesLoadPanel extends HtmlMacroComponent {
public void setFilter(String filterBy) {
if ( filterBy.equals(FILTER_RESOURCES) ) {
this.filterbyResources = true;
- this.feedBackMessage = _("showing resources");
+ this.feedBackMessage = tr("showing resources");
} else {
this.filterbyResources = false;
- this.feedBackMessage = _("showing criteria");
+ this.feedBackMessage = tr("showing criteria");
}
refreshNameFilter = true;
@@ -395,7 +395,7 @@ public class ResourcesLoadPanel extends HtmlMacroComponent {
((South) getFellow("graphics")).setOpen(this.visibleChart);
if (!visibleChart) {
- ((South) getFellow("graphics")).setTitle(_("Graphics are disabled"));
+ ((South) getFellow("graphics")).setTitle(tr("Graphics are disabled"));
}
savePreviousData();
@@ -471,8 +471,8 @@ public class ResourcesLoadPanel extends HtmlMacroComponent {
}
Comboitem lastItem = new Comboitem();
- lastItem.setLabel(_("All"));
- lastItem.setDescription(_("Show all elements"));
+ lastItem.setLabel(tr("All"));
+ lastItem.setDescription(tr("Show all elements"));
lastItem.setValue(-1);
filterByNameCombo.appendChild(lastItem);
@@ -507,7 +507,7 @@ public class ResourcesLoadPanel extends HtmlMacroComponent {
if ( paginationType != PaginationType.NONE ) {
this.filterByNamePosition = filterByNamePosition;
this.lastSelectedName = comboByName.getSelectedIndex();
- this.feedBackMessage = _("filtering by name");
+ this.feedBackMessage = tr("filtering by name");
changeNameFilterWithFeedback();
}
diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/timetracker/TimeTracker.java b/ganttzk/src/main/java/org/zkoss/ganttz/timetracker/TimeTracker.java
index 96436b6fd..ddb37341e 100644
--- a/ganttzk/src/main/java/org/zkoss/ganttz/timetracker/TimeTracker.java
+++ b/ganttzk/src/main/java/org/zkoss/ganttz/timetracker/TimeTracker.java
@@ -21,7 +21,7 @@
package org.zkoss.ganttz.timetracker;
-import static org.zkoss.ganttz.i18n.I18nHelper._;
+import static org.zkoss.ganttz.i18n.I18nHelper.tr;
import java.util.Collection;
import java.util.Date;
@@ -226,7 +226,7 @@ public class TimeTracker {
@Override
public String getName() {
- return _("changing zoom");
+ return tr("changing zoom");
}
});
}
diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/timetracker/zoom/ZoomLevel.java b/ganttzk/src/main/java/org/zkoss/ganttz/timetracker/zoom/ZoomLevel.java
index 02cd766f5..6120add21 100644
--- a/ganttzk/src/main/java/org/zkoss/ganttz/timetracker/zoom/ZoomLevel.java
+++ b/ganttzk/src/main/java/org/zkoss/ganttz/timetracker/zoom/ZoomLevel.java
@@ -31,7 +31,7 @@ import org.joda.time.LocalDate;
*/
public enum ZoomLevel {
- DETAIL_ONE(_("Year")) {
+ DETAIL_ONE(tr("Year")) {
@Override
public TimeTrackerState getTimeTrackerState(IDetailItemModifier firstLevel, IDetailItemModifier secondLevel) {
return new DetailOneTimeTrackerState(firstLevel, secondLevel);
@@ -43,7 +43,7 @@ public enum ZoomLevel {
}
},
- DETAIL_TWO(_("Quarter")) {
+ DETAIL_TWO(tr("Quarter")) {
@Override
public TimeTrackerState getTimeTrackerState(IDetailItemModifier firstLevel, IDetailItemModifier secondLevel) {
return new DetailTwoTimeTrackerState(firstLevel, secondLevel);
@@ -55,7 +55,7 @@ public enum ZoomLevel {
}
},
- DETAIL_THREE(_("Month")) {
+ DETAIL_THREE(tr("Month")) {
@Override
public TimeTrackerState getTimeTrackerState(IDetailItemModifier firstLevel, IDetailItemModifier secondLevel) {
return new DetailThreeTimeTrackerState(firstLevel, secondLevel);
@@ -67,7 +67,7 @@ public enum ZoomLevel {
}
},
- DETAIL_FOUR(_("Week")) {
+ DETAIL_FOUR(tr("Week")) {
@Override
public TimeTrackerState getTimeTrackerState(IDetailItemModifier firstLevel, IDetailItemModifier secondLevel) {
return new DetailFourTimeTrackerState(firstLevel, secondLevel);
@@ -79,7 +79,7 @@ public enum ZoomLevel {
}
},
- DETAIL_FIVE(_("Day")) {
+ DETAIL_FIVE(tr("Day")) {
@Override
public TimeTrackerState getTimeTrackerState(IDetailItemModifier firstLevel, IDetailItemModifier secondLevel) {
return new DetailFiveTimeTrackerState(firstLevel, secondLevel);
@@ -100,7 +100,7 @@ public enum ZoomLevel {
/**
* Forces to mark the string as needing translation.
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
@@ -129,7 +129,7 @@ public enum ZoomLevel {
@Override
public String toString() {
- return _(internalName);
+ return tr(internalName);
}
public static ZoomLevel getFromString(String zoomLevelParameter) {
diff --git a/ganttzk/src/main/resources/web/ganttz/zul/leftTasksTree.zul b/ganttzk/src/main/resources/web/ganttz/zul/leftTasksTree.zul
index 7db75bf8f..2e1d79f3e 100644
--- a/ganttzk/src/main/resources/web/ganttz/zul/leftTasksTree.zul
+++ b/ganttzk/src/main/resources/web/ganttz/zul/leftTasksTree.zul
@@ -20,7 +20,7 @@
-->
+ signature="java.lang.String tr(java.lang.String name)" ?>
diff --git a/ganttzk/src/main/resources/web/ganttz/zul/plannerLayout.zul b/ganttzk/src/main/resources/web/ganttz/zul/plannerLayout.zul
index b1cd2e560..a6a9d4933 100644
--- a/ganttzk/src/main/resources/web/ganttz/zul/plannerLayout.zul
+++ b/ganttzk/src/main/resources/web/ganttz/zul/plannerLayout.zul
@@ -21,7 +21,7 @@
+ signature="java.lang.String tr(java.lang.String name)" ?>
+ signature="java.lang.String tr(java.lang.String name)" ?>
diff --git a/libreplan-business/pom.xml b/libreplan-business/pom.xml
index c7c8e0b25..a881258cd 100644
--- a/libreplan-business/pom.xml
+++ b/libreplan-business/pom.xml
@@ -10,7 +10,7 @@
libreplan-business
jar
- LibrePlan Business Module
+ TASKPM Business Module
@@ -51,6 +51,12 @@
3.0.0
+
+
+ javax.annotation
+ javax.annotation-api
+
+
org.jadira.usertype
diff --git a/libreplan-business/src/main/java/org/libreplan/business/advance/entities/AdvanceType.java b/libreplan-business/src/main/java/org/libreplan/business/advance/entities/AdvanceType.java
index 39f573eaa..a4b148ad4 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/advance/entities/AdvanceType.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/advance/entities/AdvanceType.java
@@ -21,7 +21,7 @@
package org.libreplan.business.advance.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
import java.math.BigDecimal;
@@ -175,14 +175,14 @@ public class AdvanceType extends BaseEntity implements IHumanIdentifiable{
public String getType() {
if ( isUpdatable() ) {
- return _("User");
+ return tr("User");
}
if ( isQualityForm() ) {
- return _("Quality form");
+ return tr("Quality form");
}
- return _("Predefined");
+ return tr("Predefined");
}
public boolean isPrecisionValid(BigDecimal precision) {
diff --git a/libreplan-business/src/main/java/org/libreplan/business/calendars/entities/CalendarExceptionType.java b/libreplan-business/src/main/java/org/libreplan/business/calendars/entities/CalendarExceptionType.java
index 7270883b7..1134ee5a1 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/calendars/entities/CalendarExceptionType.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/calendars/entities/CalendarExceptionType.java
@@ -21,7 +21,7 @@
package org.libreplan.business.calendars.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
@@ -144,7 +144,7 @@ public class CalendarExceptionType extends IntegrationEntity implements IHumanId
}
public String getOverAssignableStr() {
- return isOverAssignableWithoutLimit() ? _("Yes") : _("No");
+ return isOverAssignableWithoutLimit() ? tr("Yes") : tr("No");
}
public EffortDuration getDuration() {
diff --git a/libreplan-business/src/main/java/org/libreplan/business/calendars/entities/CalendarExceptionTypeColor.java b/libreplan-business/src/main/java/org/libreplan/business/calendars/entities/CalendarExceptionTypeColor.java
index 06d013cdc..7e825a6f5 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/calendars/entities/CalendarExceptionTypeColor.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/calendars/entities/CalendarExceptionTypeColor.java
@@ -19,7 +19,7 @@
package org.libreplan.business.calendars.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
/**
* Enum representing the possible colors to choose for a {@link CalendarExceptionType}.
@@ -27,15 +27,15 @@ import static org.libreplan.business.i18n.I18nHelper._;
* @author Manuel Rego Casasnovas
*/
public enum CalendarExceptionTypeColor {
- DEFAULT(_("red (default)"), "#FF3333", "#FF9999"),
- GREEN(_("green"),"#2ee62e", "#8ae68a"),
- BLUE(_("blue"), "#3333FF", "#9999FF"),
- CYAN(_("cyan"), "#33FFFF", "#99FFFF"),
- MAGENTA(_("magenta"), "#FF33FF", "#FF99FF"),
- YELLOW(_("yellow"), "#e6e62e", "#e6e6a1"),
- BLACK(_("black"), "#333333", "#999999"),
- ORANGE(_("orange"), "#ffb733", "#ffdb99"),
- PURPLE(_("purple"), "#801a80", "#b38eb3");
+ DEFAULT(tr("red (default)"), "#FF3333", "#FF9999"),
+ GREEN(tr("green"),"#2ee62e", "#8ae68a"),
+ BLUE(tr("blue"), "#3333FF", "#9999FF"),
+ CYAN(tr("cyan"), "#33FFFF", "#99FFFF"),
+ MAGENTA(tr("magenta"), "#FF33FF", "#FF99FF"),
+ YELLOW(tr("yellow"), "#e6e62e", "#e6e6a1"),
+ BLACK(tr("black"), "#333333", "#999999"),
+ ORANGE(tr("orange"), "#ffb733", "#ffdb99"),
+ PURPLE(tr("purple"), "#801a80", "#b38eb3");
private final String name;
diff --git a/libreplan-business/src/main/java/org/libreplan/business/calendars/entities/Capacity.java b/libreplan-business/src/main/java/org/libreplan/business/calendars/entities/Capacity.java
index 213ccd7a4..78b86aa9e 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/calendars/entities/Capacity.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/calendars/entities/Capacity.java
@@ -19,7 +19,7 @@
package org.libreplan.business.calendars.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
import java.util.Arrays;
import java.util.Collection;
@@ -170,7 +170,7 @@ public class Capacity {
public String getExtraEffortString() {
if (getAllowedExtraEffort() == null) {
- return _("unlimited");
+ return tr("unlimited");
}
return asString(getAllowedExtraEffort());
}
diff --git a/libreplan-business/src/main/java/org/libreplan/business/common/daos/EntitySequenceDAO.java b/libreplan-business/src/main/java/org/libreplan/business/common/daos/EntitySequenceDAO.java
index bfe469564..debe7da45 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/common/daos/EntitySequenceDAO.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/common/daos/EntitySequenceDAO.java
@@ -72,7 +72,7 @@ public class EntitySequenceDAO extends GenericDAOHibernate
public void remove(final EntitySequence entitySequence) throws InstanceNotFoundException, IllegalArgumentException {
if ( entitySequence.getLastValue() > 0 ) {
throw new IllegalArgumentException(
- I18nHelper._("Entity Sequence cannot be deleted. Entity Sequence already in use"));
+ I18nHelper.tr("Entity Sequence cannot be deleted. Entity Sequence already in use"));
}
remove(entitySequence.getId());
diff --git a/libreplan-business/src/main/java/org/libreplan/business/common/entities/PersonalTimesheetsPeriodicityEnum.java b/libreplan-business/src/main/java/org/libreplan/business/common/entities/PersonalTimesheetsPeriodicityEnum.java
index 943bd4b79..8237ecf6a 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/common/entities/PersonalTimesheetsPeriodicityEnum.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/common/entities/PersonalTimesheetsPeriodicityEnum.java
@@ -19,7 +19,7 @@
package org.libreplan.business.common.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
import org.joda.time.LocalDate;
import org.joda.time.Months;
@@ -32,7 +32,7 @@ import org.joda.time.Weeks;
*/
public enum PersonalTimesheetsPeriodicityEnum {
- MONTHLY(_("Monthly")) {
+ MONTHLY(tr("Monthly")) {
@Override
public LocalDate getStart(LocalDate date) {
return date.dayOfMonth().withMinimumValue();
@@ -63,7 +63,7 @@ public enum PersonalTimesheetsPeriodicityEnum {
return getStart(date).plusMonths(1);
}
},
- TWICE_MONTHLY(_("Twice-monthly")) {
+ TWICE_MONTHLY(tr("Twice-monthly")) {
@Override
public LocalDate getStart(LocalDate date) {
if (date.getDayOfMonth() <= 15) {
@@ -120,7 +120,7 @@ public enum PersonalTimesheetsPeriodicityEnum {
}
}
},
- WEEKLY(_("Weekly")) {
+ WEEKLY(tr("Weekly")) {
@Override
public LocalDate getStart(LocalDate date) {
return date.dayOfWeek().withMinimumValue();
diff --git a/libreplan-business/src/main/java/org/libreplan/business/common/entities/PredefinedConnectorProperties.java b/libreplan-business/src/main/java/org/libreplan/business/common/entities/PredefinedConnectorProperties.java
index 24ef7a27e..80e67072f 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/common/entities/PredefinedConnectorProperties.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/common/entities/PredefinedConnectorProperties.java
@@ -19,7 +19,7 @@
package org.libreplan.business.common.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
/**
* Simply class to keep constants of {@link ConnectorProperty properties} for LibrePlan {@link Connector connectors}.
@@ -31,20 +31,20 @@ import static org.libreplan.business.i18n.I18nHelper._;
public class PredefinedConnectorProperties {
// Generic
- public static String ACTIVATED = _("Activated");
- public static String SERVER_URL = _("Server URL");
- public static String USERNAME = _("Username");
- public static String PASSWORD = _("Password");
+ public static String ACTIVATED = tr("Activated");
+ public static String SERVER_URL = tr("Server URL");
+ public static String USERNAME = tr("Username");
+ public static String PASSWORD = tr("Password");
// Specific for Tim
- public static String TIM_NR_DAYS_TIMESHEET = _("Number of days timesheet to Tim");
- public static String TIM_NR_DAYS_ROSTER = _("Number of days roster from Tim");
- public static String TIM_PRODUCTIVITY_FACTOR = _("Productivity factor");
- public static String TIM_DEPARTAMENTS_IMPORT_ROSTER = _("Department IDs to import toster");
+ public static String TIM_NR_DAYS_TIMESHEET = tr("Number of days timesheet to Tim");
+ public static String TIM_NR_DAYS_ROSTER = tr("Number of days roster from Tim");
+ public static String TIM_PRODUCTIVITY_FACTOR = tr("Productivity factor");
+ public static String TIM_DEPARTAMENTS_IMPORT_ROSTER = tr("Department IDs to import toster");
// Specific for JIRA
- public static String JIRA_LABELS = _("JIRA labels: comma-separated list of labels or URL");
- public static String JIRA_HOURS_TYPE = _("Hours type");
+ public static String JIRA_LABELS = tr("JIRA labels: comma-separated list of labels or URL");
+ public static String JIRA_HOURS_TYPE = tr("Hours type");
/**
* Code prefix for different entities integrated with JIRA.
@@ -52,11 +52,11 @@ public class PredefinedConnectorProperties {
public static final String JIRA_CODE_PREFIX = "JIRA-";
// Specific for E-mail
- public static String PROTOCOL = _("Protocol");
- public static String HOST = _("Host");
- public static String PORT = _("Port");
- public static String EMAIL_SENDER = _("From address (no reply)");
- public static String EMAIL_USERNAME = _("Username (optional)");
- public static String EMAIL_PASSWORD = _("Password (optional)");
+ public static String PROTOCOL = tr("Protocol");
+ public static String HOST = tr("Host");
+ public static String PORT = tr("Port");
+ public static String EMAIL_SENDER = tr("From address (no reply)");
+ public static String EMAIL_USERNAME = tr("Username (optional)");
+ public static String EMAIL_PASSWORD = tr("Password (optional)");
}
diff --git a/libreplan-business/src/main/java/org/libreplan/business/common/entities/ProgressType.java b/libreplan-business/src/main/java/org/libreplan/business/common/entities/ProgressType.java
index a7b56bfd9..cf70031a2 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/common/entities/ProgressType.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/common/entities/ProgressType.java
@@ -21,7 +21,7 @@
package org.libreplan.business.common.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
import java.util.Arrays;
import java.util.List;
@@ -33,10 +33,10 @@ import java.util.List;
*/
public enum ProgressType {
- SPREAD_PROGRESS(_("Spreading progress")),
- ALL_NUMHOURS(_("Progress with all tasks by hours")),
- CRITICAL_PATH_NUMHOURS(_("Progress with critical path tasks by hours")),
- CRITICAL_PATH_DURATION(_("Progress with critical path tasks by duration"));
+ SPREAD_PROGRESS(tr("Spreading progress")),
+ ALL_NUMHOURS(tr("Progress with all tasks by hours")),
+ CRITICAL_PATH_NUMHOURS(tr("Progress with critical path tasks by hours")),
+ CRITICAL_PATH_DURATION(tr("Progress with critical path tasks by duration"));
private String value;
diff --git a/libreplan-business/src/main/java/org/libreplan/business/common/hibernate/JodaTypeContributor.java b/libreplan-business/src/main/java/org/libreplan/business/common/hibernate/JodaTypeContributor.java
new file mode 100644
index 000000000..afd2990c2
--- /dev/null
+++ b/libreplan-business/src/main/java/org/libreplan/business/common/hibernate/JodaTypeContributor.java
@@ -0,0 +1,21 @@
+package org.libreplan.business.common.hibernate;
+
+import org.hibernate.boot.model.TypeContributions;
+import org.hibernate.boot.model.TypeContributor;
+import org.hibernate.service.ServiceRegistry;
+import org.jadira.usertype.dateandtime.joda.PersistentDateTime;
+import org.jadira.usertype.dateandtime.joda.PersistentLocalDate;
+import org.jadira.usertype.dateandtime.joda.PersistentLocalTime;
+
+/**
+ * Registers Joda-Time types for Hibernate.
+ */
+public class JodaTypeContributor implements TypeContributor {
+
+ @Override
+ public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
+ typeContributions.contributeType(new PersistentLocalDate(), "org.joda.time.LocalDate");
+ typeContributions.contributeType(new PersistentDateTime(), "org.joda.time.DateTime");
+ typeContributions.contributeType(new PersistentLocalTime(), "org.joda.time.LocalTime");
+ }
+}
diff --git a/libreplan-business/src/main/java/org/libreplan/business/common/hibernate/LocalTimeAsMillisIntegerType.java b/libreplan-business/src/main/java/org/libreplan/business/common/hibernate/LocalTimeAsMillisIntegerType.java
new file mode 100644
index 000000000..3ca6f3927
--- /dev/null
+++ b/libreplan-business/src/main/java/org/libreplan/business/common/hibernate/LocalTimeAsMillisIntegerType.java
@@ -0,0 +1,103 @@
+/*
+ * This file is part of LibrePlan
+ *
+ * Copyright (C) 2024 LibrePlan Contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ */
+
+package org.libreplan.business.common.hibernate;
+
+import org.hibernate.HibernateException;
+import org.hibernate.engine.spi.SharedSessionContractImplementor;
+import org.hibernate.usertype.UserType;
+import org.joda.time.LocalTime;
+
+import java.io.Serializable;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+
+/**
+ * Hibernate 5.6 UserType for storing Joda LocalTime as milliseconds integer.
+ * Replaces org.jadira.usertype.dateandtime.joda.PersistentLocalTimeAsMillisInteger
+ */
+public class LocalTimeAsMillisIntegerType implements UserType {
+
+ private static final int[] SQL_TYPES = { Types.INTEGER };
+
+ @Override
+ public int[] sqlTypes() {
+ return SQL_TYPES;
+ }
+
+ @Override
+ public Class> returnedClass() {
+ return LocalTime.class;
+ }
+
+ @Override
+ public boolean equals(Object x, Object y) throws HibernateException {
+ if (x == y) return true;
+ if (x == null || y == null) return false;
+ return x.equals(y);
+ }
+
+ @Override
+ public int hashCode(Object x) throws HibernateException {
+ return x == null ? 0 : x.hashCode();
+ }
+
+ @Override
+ public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)
+ throws HibernateException, SQLException {
+ int millis = rs.getInt(names[0]);
+ if (rs.wasNull()) {
+ return null;
+ }
+ return LocalTime.fromMillisOfDay(millis);
+ }
+
+ @Override
+ public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session)
+ throws HibernateException, SQLException {
+ if (value == null) {
+ st.setNull(index, Types.INTEGER);
+ } else {
+ st.setInt(index, ((LocalTime) value).getMillisOfDay());
+ }
+ }
+
+ @Override
+ public Object deepCopy(Object value) throws HibernateException {
+ // LocalTime is immutable
+ return value;
+ }
+
+ @Override
+ public boolean isMutable() {
+ return false;
+ }
+
+ @Override
+ public Serializable disassemble(Object value) throws HibernateException {
+ return value == null ? null : ((LocalTime) value).getMillisOfDay();
+ }
+
+ @Override
+ public Object assemble(Serializable cached, Object owner) throws HibernateException {
+ if (cached == null) {
+ return null;
+ }
+ return LocalTime.fromMillisOfDay((Integer) cached);
+ }
+
+ @Override
+ public Object replace(Object original, Object target, Object owner) throws HibernateException {
+ return original;
+ }
+}
diff --git a/libreplan-business/src/main/java/org/libreplan/business/costcategories/entities/CostCategory.java b/libreplan-business/src/main/java/org/libreplan/business/costcategories/entities/CostCategory.java
index ddf5e935f..d24420176 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/costcategories/entities/CostCategory.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/costcategories/entities/CostCategory.java
@@ -21,7 +21,7 @@
package org.libreplan.business.costcategories.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
import java.math.BigDecimal;
import java.util.ArrayList;
@@ -130,7 +130,7 @@ public class CostCategory extends IntegrationEntity implements IHumanIdentifiabl
.getInitDate().compareTo(endDate) <= 0)) {
throw ValidationException
.invalidValueException(
- _("Two Hour Cost of the same type overlap in time"),
+ tr("Two Hour Cost of the same type overlap in time"),
listElement);
} else if ((endDate != null && listElement.getEndDate() != null)
&& ((listElement.getEndDate().compareTo(initDate) >= 0 && listElement
@@ -139,7 +139,7 @@ public class CostCategory extends IntegrationEntity implements IHumanIdentifiabl
.getInitDate().compareTo(endDate) <= 0))) {
throw ValidationException
.invalidValueException(
- _("Two Hour Cost of the same type overlap in time"),
+ tr("Two Hour Cost of the same type overlap in time"),
listElement);
}
}
@@ -159,7 +159,7 @@ public class CostCategory extends IntegrationEntity implements IHumanIdentifiabl
if (endDate == null && costCategory.getEndDate() == null) {
throw ValidationException
.invalidValueException(
- _("Some cost category assignments overlap in time"),
+ tr("Some cost category assignments overlap in time"),
costCategory);
} else if ((endDate == null && costCategory.getEndDate()
.compareTo(initDate) >= 0)
@@ -167,7 +167,7 @@ public class CostCategory extends IntegrationEntity implements IHumanIdentifiabl
.getInitDate().compareTo(endDate) <= 0)) {
throw ValidationException
.invalidValueException(
- _("Some cost category assignments overlap in time"),
+ tr("Some cost category assignments overlap in time"),
costCategory);
} else if ((endDate != null && costCategory.getEndDate() != null)
&& ((costCategory.getEndDate().compareTo(initDate) >= 0 && // (1)
@@ -190,7 +190,7 @@ public class CostCategory extends IntegrationEntity implements IHumanIdentifiabl
// endDate]
throw ValidationException
.invalidValueException(
- _("Some cost category assignments overlap in time"),
+ tr("Some cost category assignments overlap in time"),
costCategory);
}
}
diff --git a/libreplan-business/src/main/java/org/libreplan/business/email/entities/EmailTemplateEnum.java b/libreplan-business/src/main/java/org/libreplan/business/email/entities/EmailTemplateEnum.java
index 60da21c66..2a9705ce2 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/email/entities/EmailTemplateEnum.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/email/entities/EmailTemplateEnum.java
@@ -19,24 +19,24 @@
package org.libreplan.business.email.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
/**
* Available E-mail templates.
*
- * TEMPLATE_N(_("Template N")) - for i18n
+ * TEMPLATE_N(tr("Template N")) - for i18n
* TEMPLATE_A("Template A") - for general use (no internationalizing)
*
* @author Vova Perebykivskyi
*/
public enum EmailTemplateEnum {
- TEMPLATE_TASK_ASSIGNED_TO_RESOURCE(_("Task assigned to resource")),
- TEMPLATE_RESOURCE_REMOVED_FROM_TASK(_("Resource removed from task")),
- TEMPLATE_MILESTONE_REACHED(_("Milestone reached")),
- TEMPLATE_TODAY_TASK_SHOULD_START(_("Task should start")),
- TEMPLATE_TODAY_TASK_SHOULD_FINISH(_("Task should finish")),
- TEMPLATE_ENTER_DATA_IN_TIMESHEET(_("Enter data in timesheet"));
+ TEMPLATE_TASK_ASSIGNED_TO_RESOURCE(tr("Task assigned to resource")),
+ TEMPLATE_RESOURCE_REMOVED_FROM_TASK(tr("Resource removed from task")),
+ TEMPLATE_MILESTONE_REACHED(tr("Milestone reached")),
+ TEMPLATE_TODAY_TASK_SHOULD_START(tr("Task should start")),
+ TEMPLATE_TODAY_TASK_SHOULD_FINISH(tr("Task should finish")),
+ TEMPLATE_ENTER_DATA_IN_TIMESHEET(tr("Enter data in timesheet"));
private final String templateType;
diff --git a/libreplan-business/src/main/java/org/libreplan/business/externalcompanies/entities/CommunicationType.java b/libreplan-business/src/main/java/org/libreplan/business/externalcompanies/entities/CommunicationType.java
index 606fcd358..f6e04b96f 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/externalcompanies/entities/CommunicationType.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/externalcompanies/entities/CommunicationType.java
@@ -19,7 +19,7 @@
package org.libreplan.business.externalcompanies.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
/**
* Enum for specified the type of {@link CustomerCommunication}
@@ -28,10 +28,10 @@ import static org.libreplan.business.i18n.I18nHelper._;
*/
public enum CommunicationType {
- NEW_PROJECT(_("New project")),
- PROGRESS_UPDATE(_("Progress Update")),
- UPDATE_DELIVERING_DATE(_("Update Delivering Date")),
- END_DATE_UPDATE(_("End date update"));
+ NEW_PROJECT(tr("New project")),
+ PROGRESS_UPDATE(tr("Progress Update")),
+ UPDATE_DELIVERING_DATE(tr("Update Delivering Date")),
+ END_DATE_UPDATE(tr("End date update"));
private String description;
diff --git a/libreplan-business/src/main/java/org/libreplan/business/i18n/I18nHelper.java b/libreplan-business/src/main/java/org/libreplan/business/i18n/I18nHelper.java
index 1d178f275..63bdc4c14 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/i18n/I18nHelper.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/i18n/I18nHelper.java
@@ -41,7 +41,7 @@ public class I18nHelper {
* @param text
* @return Text depends on locale
*/
- public static String _(String text) {
+ public static String tr(String text) {
return text;
}
diff --git a/libreplan-business/src/main/java/org/libreplan/business/logs/entities/IssueTypeEnum.java b/libreplan-business/src/main/java/org/libreplan/business/logs/entities/IssueTypeEnum.java
index 0db92e05e..89f053dc3 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/logs/entities/IssueTypeEnum.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/logs/entities/IssueTypeEnum.java
@@ -1,6 +1,6 @@
package org.libreplan.business.logs.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
/**
* Defines PROBLEM_OR_CONCERN, REQUEST_FOR_CHANGE, OFF_SPECIFICATION enums
@@ -10,7 +10,7 @@ import static org.libreplan.business.i18n.I18nHelper._;
* @author Misha Gozhda
*/
public enum IssueTypeEnum {
- PROBLEM_OR_CONCERN(_("Problem or concern")), REQUEST_FOR_CHANGE(_("Request for change")), OFF_SPECIFICATION(_("Off specification"));
+ PROBLEM_OR_CONCERN(tr("Problem or concern")), REQUEST_FOR_CHANGE(tr("Request for change")), OFF_SPECIFICATION(tr("Off specification"));
private final String issueTypeEnum;
diff --git a/libreplan-business/src/main/java/org/libreplan/business/logs/entities/LowMediumHighEnum.java b/libreplan-business/src/main/java/org/libreplan/business/logs/entities/LowMediumHighEnum.java
index 686b46d35..2c20f0fb7 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/logs/entities/LowMediumHighEnum.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/logs/entities/LowMediumHighEnum.java
@@ -18,7 +18,7 @@
*/
package org.libreplan.business.logs.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
/**
@@ -29,7 +29,7 @@ import static org.libreplan.business.i18n.I18nHelper._;
*/
public enum LowMediumHighEnum {
- LOW(_("Low")), MEDIUM(_("Medium")), HIGH(_("High"));
+ LOW(tr("Low")), MEDIUM(tr("Medium")), HIGH(tr("High"));
private final String lowMediumHighEnum;
diff --git a/libreplan-business/src/main/java/org/libreplan/business/logs/entities/RiskScoreStatesEnum.java b/libreplan-business/src/main/java/org/libreplan/business/logs/entities/RiskScoreStatesEnum.java
index 26f3e4bc7..72a41f43e 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/logs/entities/RiskScoreStatesEnum.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/logs/entities/RiskScoreStatesEnum.java
@@ -1,5 +1,5 @@
package org.libreplan.business.logs.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
/**
* Defines ZERO, ONE, TWO, THREE, FOUR, SIX, NINE
* to be used as data type in
@@ -8,7 +8,7 @@ import static org.libreplan.business.i18n.I18nHelper._;
* @author Misha Gozhda
*/
public enum RiskScoreStatesEnum {
- ZERO(_("0")), ONE(_("1")), TWO(_("2")), THREE(_("3")), FOUR(_("4")), SIX(_("6")), NINE(_("9")) ;
+ ZERO(tr("0")), ONE(tr("1")), TWO(tr("2")), THREE(tr("3")), FOUR(tr("4")), SIX(tr("6")), NINE(tr("9")) ;
private final String riskScoreStateEnum;
diff --git a/libreplan-business/src/main/java/org/libreplan/business/materials/entities/MaterialStatusEnum.java b/libreplan-business/src/main/java/org/libreplan/business/materials/entities/MaterialStatusEnum.java
index c0cf73084..143679f92 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/materials/entities/MaterialStatusEnum.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/materials/entities/MaterialStatusEnum.java
@@ -21,7 +21,7 @@
package org.libreplan.business.materials.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
/**
*
@@ -29,11 +29,11 @@ import static org.libreplan.business.i18n.I18nHelper._;
*
*/
public enum MaterialStatusEnum {
- RECEIVED(_("RECEIVED")),
- PENDING(_("PENDING")),
- ORDERED(_("ORDERED")),
- PROCESSING(_("PROCESSING")),
- CANCELED(_("CANCELED"));
+ RECEIVED(tr("RECEIVED")),
+ PENDING(tr("PENDING")),
+ ORDERED(tr("ORDERED")),
+ PROCESSING(tr("PROCESSING")),
+ CANCELED(tr("CANCELED"));
private String description;
diff --git a/libreplan-business/src/main/java/org/libreplan/business/orders/entities/CriterionRequirementHandler.java b/libreplan-business/src/main/java/org/libreplan/business/orders/entities/CriterionRequirementHandler.java
index 096462abf..d11df21b0 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/orders/entities/CriterionRequirementHandler.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/orders/entities/CriterionRequirementHandler.java
@@ -21,7 +21,7 @@
package org.libreplan.business.orders.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
import java.util.Collection;
import java.util.HashMap;
@@ -536,7 +536,7 @@ public abstract class CriterionRequirementHandler {
newRequirement);
} else {
throw new IllegalStateException(
- _("The criterion already exists into another task"));
+ tr("The criterion already exists into another task"));
}
}
diff --git a/libreplan-business/src/main/java/org/libreplan/business/orders/entities/HoursGroup.java b/libreplan-business/src/main/java/org/libreplan/business/orders/entities/HoursGroup.java
index 2e1fa0736..2c59b4382 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/orders/entities/HoursGroup.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/orders/entities/HoursGroup.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.business.orders.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
import java.math.BigDecimal;
import java.util.Collection;
@@ -206,7 +206,7 @@ public class HoursGroup extends IntegrationEntity implements Cloneable, ICriteri
if ( !isPercentageValidForParent() ) {
this.percentage = oldPercentage;
- throw new IllegalArgumentException(_("Total percentage should be less than 100%"));
+ throw new IllegalArgumentException(tr("Total percentage should be less than 100%"));
}
}
diff --git a/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderElement.java b/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderElement.java
index 6edfd44a6..256fa3a52 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderElement.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderElement.java
@@ -21,7 +21,7 @@
package org.libreplan.business.orders.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
import java.math.BigDecimal;
import java.util.ArrayList;
@@ -749,7 +749,7 @@ public abstract class OrderElement extends IntegrationEntity implements ICriteri
for (DirectAdvanceAssignment directAdvanceAssignment : directAdvanceAssignments) {
if ( directAdvanceAssignment.getReportGlobalAdvance() ) {
throw new DuplicateValueTrueReportGlobalAdvanceException(
- _("Cannot spread two progress in the same task"), this, OrderElement.class);
+ tr("Cannot spread two progress in the same task"), this, OrderElement.class);
}
}
}
@@ -771,7 +771,7 @@ public abstract class OrderElement extends IntegrationEntity implements ICriteri
directAdvanceAssignment.getAdvanceType(), newAdvanceAssignment.getAdvanceType()) ) {
throw new DuplicateAdvanceAssignmentForOrderElementException(
- _("Duplicate Progress Assignment For Task"), this, OrderElement.class);
+ tr("Duplicate Progress Assignment For Task"), this, OrderElement.class);
}
}
if (orderElement.getParent() != null) {
@@ -792,7 +792,7 @@ public abstract class OrderElement extends IntegrationEntity implements ICriteri
if (orderElement.existsDirectAdvanceAssignmentWithTheSameType(newAdvanceAssignment.getAdvanceType())) {
throw new DuplicateAdvanceAssignmentForOrderElementException(
- _("Duplicate Progress Assignment For Task"),
+ tr("Duplicate Progress Assignment For Task"),
this,
OrderElement.class);
}
@@ -1101,7 +1101,7 @@ public abstract class OrderElement extends IntegrationEntity implements ICriteri
if ( qualityForm.equals(taskQualityForm.getQualityForm()) ) {
throw new ValidationException(ValidationException.invalidValue(
- _("Quality form already exists"),
+ tr("Quality form already exists"),
"name",
qualityForm.getName(),
qualityForm));
diff --git a/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderLineGroup.java b/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderLineGroup.java
index 0da0094ca..f724b5bbf 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderLineGroup.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderLineGroup.java
@@ -21,7 +21,7 @@
package org.libreplan.business.orders.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
import java.math.BigDecimal;
import java.math.RoundingMode;
@@ -969,7 +969,7 @@ public class OrderLineGroup extends OrderElement implements ITreeParentNode distributeForDay(PartialDay day, EffortDuration totalDuration) {
- return withCaptureOfResourcesPicked(distributeForDay_(day, totalDuration));
+ return withCaptureOfResourcesPicked(distributeForDaytr(day, totalDuration));
}
private List withCaptureOfResourcesPicked(List result) {
@@ -318,7 +318,7 @@ public class EffortDistributor {
return result;
}
- private List distributeForDay_(PartialDay day, EffortDuration totalDuration) {
+ private List distributeForDaytr(PartialDay day, EffortDuration totalDuration) {
List resourcesAssignable = resourcesAssignableAt(day.getDate());
List withoutOvertime =
diff --git a/libreplan-business/src/main/java/org/libreplan/business/planner/entities/PositionConstraintType.java b/libreplan-business/src/main/java/org/libreplan/business/planner/entities/PositionConstraintType.java
index 4da8798e9..13d5a178e 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/planner/entities/PositionConstraintType.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/planner/entities/PositionConstraintType.java
@@ -28,21 +28,21 @@ import org.libreplan.business.orders.entities.Order.SchedulingMode;
* @author Óscar González Fernández
*/
public enum PositionConstraintType {
- AS_SOON_AS_POSSIBLE(false, _("as soon as possible")) {
+ AS_SOON_AS_POSSIBLE(false, tr("as soon as possible")) {
@Override
public boolean appliesToTheStart() {
return true;
}
},
- START_NOT_EARLIER_THAN(true, _("start not earlier than")) {
+ START_NOT_EARLIER_THAN(true, tr("start not earlier than")) {
@Override
public boolean appliesToTheStart() {
return true;
}
},
- START_IN_FIXED_DATE(true, _("start in fixed date")) {
+ START_IN_FIXED_DATE(true, tr("start in fixed date")) {
@Override
public PositionConstraintType newTypeAfterMoved(SchedulingMode mode) {
@@ -54,14 +54,14 @@ public enum PositionConstraintType {
return true;
}
},
- AS_LATE_AS_POSSIBLE(false, _("as late as possible")) {
+ AS_LATE_AS_POSSIBLE(false, tr("as late as possible")) {
@Override
public boolean appliesToTheStart() {
return false;
}
},
- FINISH_NOT_LATER_THAN(true, _("finish not later than")) {
+ FINISH_NOT_LATER_THAN(true, tr("finish not later than")) {
@Override
public boolean appliesToTheStart() {
@@ -72,7 +72,7 @@ public enum PositionConstraintType {
/**
* Forces to mark the string as needing translation
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-business/src/main/java/org/libreplan/business/planner/entities/StretchesFunction.java b/libreplan-business/src/main/java/org/libreplan/business/planner/entities/StretchesFunction.java
index 0b678848f..9bbac9048 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/planner/entities/StretchesFunction.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/planner/entities/StretchesFunction.java
@@ -22,7 +22,7 @@
package org.libreplan.business.planner.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
import java.math.BigDecimal;
import java.math.RoundingMode;
@@ -423,7 +423,7 @@ public class StretchesFunction extends AssignmentFunction {
BigDecimal left = calculateLeftFor(sumOfProportions);
if ( !left.equals(BigDecimal.ZERO) ) {
- throw new IllegalStateException(_("Stretches must sum 100%"));
+ throw new IllegalStateException(tr("Stretches must sum 100%"));
}
}
diff --git a/libreplan-business/src/main/java/org/libreplan/business/planner/entities/SubcontractState.java b/libreplan-business/src/main/java/org/libreplan/business/planner/entities/SubcontractState.java
index 27001cde8..cc6744fca 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/planner/entities/SubcontractState.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/planner/entities/SubcontractState.java
@@ -21,7 +21,7 @@
package org.libreplan.business.planner.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
/**
* Possible states of a {@link SubcontractedTaskData}.
@@ -29,10 +29,10 @@ import static org.libreplan.business.i18n.I18nHelper._;
* @author Manuel Rego Casasnovas
*/
public enum SubcontractState {
- PENDING_INITIAL_SEND(_("Pending initial send"), true), PENDING_UPDATE_DELIVERING_DATE(
- _("Pending update delivering date"), true), FAILED_SENT(
- _("Failed sent"), true), FAILED_UPDATE(_("Failed update"), true), SUCCESS_SENT(
- _("Success sent"), false);
+ PENDING_INITIAL_SEND(tr("Pending initial send"), true), PENDING_UPDATE_DELIVERING_DATE(
+ tr("Pending update delivering date"), true), FAILED_SENT(
+ tr("Failed sent"), true), FAILED_UPDATE(tr("Failed update"), true), SUCCESS_SENT(
+ tr("Success sent"), false);
private String name;
private boolean sendable;
diff --git a/libreplan-business/src/main/java/org/libreplan/business/planner/entities/TaskDeadlineViolationStatusEnum.java b/libreplan-business/src/main/java/org/libreplan/business/planner/entities/TaskDeadlineViolationStatusEnum.java
index 30545df0c..36145284e 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/planner/entities/TaskDeadlineViolationStatusEnum.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/planner/entities/TaskDeadlineViolationStatusEnum.java
@@ -19,7 +19,7 @@
package org.libreplan.business.planner.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
/**
* Enumerate of {@link Task} deadline violation statuses.
@@ -31,9 +31,9 @@ import static org.libreplan.business.i18n.I18nHelper._;
* @author Nacho Barrientos
*/
public enum TaskDeadlineViolationStatusEnum {
- NO_DEADLINE(_("No deadline")),
- DEADLINE_VIOLATED(_("Deadline violated")),
- ON_SCHEDULE(_("On schedule"));
+ NO_DEADLINE(tr("No deadline")),
+ DEADLINE_VIOLATED(tr("Deadline violated")),
+ ON_SCHEDULE(tr("On schedule"));
private String value;
diff --git a/libreplan-business/src/main/java/org/libreplan/business/planner/entities/TaskStatusEnum.java b/libreplan-business/src/main/java/org/libreplan/business/planner/entities/TaskStatusEnum.java
index 7ddeddb98..d7508ba90 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/planner/entities/TaskStatusEnum.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/planner/entities/TaskStatusEnum.java
@@ -21,15 +21,15 @@
package org.libreplan.business.planner.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
public enum TaskStatusEnum {
- ALL(_("All")),
- FINISHED(_("Finished")),
- IN_PROGRESS(_("In progress")),
- PENDING(_("Pending")),
- BLOCKED(_("Blocked")),
- READY_TO_START(_("Ready to start"));
+ ALL(tr("All")),
+ FINISHED(tr("Finished")),
+ IN_PROGRESS(tr("In progress")),
+ PENDING(tr("Pending")),
+ BLOCKED(tr("Blocked")),
+ READY_TO_START(tr("Ready to start"));
private String value;
diff --git a/libreplan-business/src/main/java/org/libreplan/business/planner/entities/allocationalgorithms/ResourcesPerDayModification.java b/libreplan-business/src/main/java/org/libreplan/business/planner/entities/allocationalgorithms/ResourcesPerDayModification.java
index 3a18dab68..6ae185d10 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/planner/entities/allocationalgorithms/ResourcesPerDayModification.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/planner/entities/allocationalgorithms/ResourcesPerDayModification.java
@@ -21,7 +21,7 @@
package org.libreplan.business.planner.entities.allocationalgorithms;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
import static org.libreplan.business.workingday.EffortDuration.min;
import java.util.ArrayList;
@@ -92,15 +92,15 @@ public abstract class ResourcesPerDayModification extends
@Override
public String getNoValidPeriodsMessage() {
- String firstLine = _("There are no days available due to not satisfying the criteria.");
- String secondLine = _("Another possibility is that the resources do not have days available due to their calendars.");
+ String firstLine = tr("There are no days available due to not satisfying the criteria.");
+ String secondLine = tr("Another possibility is that the resources do not have days available due to their calendars.");
return firstLine + "\n" + secondLine;
}
@Override
public String getNoValidPeriodsMessageDueToIntersectionMessage() {
- String firstLine = _("There are no days available in the days marked available by the task calendar.");
- String secondLine = _("Maybe the criteria are not satisfied in those days.");
+ String firstLine = tr("There are no days available in the days marked available by the task calendar.");
+ String secondLine = tr("Maybe the criteria are not satisfied in those days.");
return firstLine + "\n" + secondLine;
}
@@ -172,12 +172,12 @@ public abstract class ResourcesPerDayModification extends
@Override
public String getNoValidPeriodsMessage() {
- return _("Resource is not available from task's start");
+ return tr("Resource is not available from task's start");
}
@Override
public String getNoValidPeriodsMessageDueToIntersectionMessage() {
- return _("Resource is not available according to task's calendar");
+ return tr("Resource is not available according to task's calendar");
}
private Resource getAssociatedResource() {
diff --git a/libreplan-business/src/main/java/org/libreplan/business/planner/limiting/entities/LimitingResourceQueueDependency.java b/libreplan-business/src/main/java/org/libreplan/business/planner/limiting/entities/LimitingResourceQueueDependency.java
index 64fabb575..7fbcd6830 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/planner/limiting/entities/LimitingResourceQueueDependency.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/planner/limiting/entities/LimitingResourceQueueDependency.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.business.planner.limiting.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
import java.util.EnumMap;
@@ -167,7 +167,7 @@ public class LimitingResourceQueueDependency extends BaseEntity {
Validate.notNull(origin);
Validate.notNull(destiny);
Validate.notNull(ganttDependency);
- Validate.isTrue(!origin.equals(destiny), _("A queue dependency has to " +
+ Validate.isTrue(!origin.equals(destiny), tr("A queue dependency has to " +
"have an origin different from destiny"));
this.hasAsOrigin = origin;
this.hasAsDestiny = destiny;
diff --git a/libreplan-business/src/main/java/org/libreplan/business/planner/limiting/entities/QueuePosition.java b/libreplan-business/src/main/java/org/libreplan/business/planner/limiting/entities/QueuePosition.java
index 514c555d4..e43de4a37 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/planner/limiting/entities/QueuePosition.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/planner/limiting/entities/QueuePosition.java
@@ -21,7 +21,7 @@
package org.libreplan.business.planner.limiting.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
import org.apache.commons.lang3.Validate;
import org.joda.time.LocalDate;
@@ -50,7 +50,7 @@ public class QueuePosition {
}
public void setHour(int hour) {
- Validate.isTrue(hour >= 0 && hour <= 23, _("Hour should be between 0 and 23"));
+ Validate.isTrue(hour >= 0 && hour <= 23, tr("Hour should be between 0 and 23"));
this.hour = hour;
}
diff --git a/libreplan-business/src/main/java/org/libreplan/business/qualityforms/entities/QualityFormType.java b/libreplan-business/src/main/java/org/libreplan/business/qualityforms/entities/QualityFormType.java
index e6baaa2a3..f25b4db83 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/qualityforms/entities/QualityFormType.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/qualityforms/entities/QualityFormType.java
@@ -26,12 +26,12 @@ package org.libreplan.business.qualityforms.entities;
public enum QualityFormType {
- BY_PERCENTAGE(_("by percentage")), BY_ITEMS(_("by items"));
+ BY_PERCENTAGE(tr("by percentage")), BY_ITEMS(tr("by items"));
/**
* Forces to mark the string as needing translation
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-business/src/main/java/org/libreplan/business/resources/entities/Criterion.java b/libreplan-business/src/main/java/org/libreplan/business/resources/entities/Criterion.java
index 12a940535..be6f5ad56 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/resources/entities/Criterion.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/resources/entities/Criterion.java
@@ -21,7 +21,7 @@
package org.libreplan.business.resources.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
import java.util.ArrayList;
import java.util.Collection;
@@ -195,11 +195,11 @@ public class Criterion extends IntegrationEntity implements ICriterion, Comparab
}
private static String allWorkersCaption() {
- return _("[generic all workers]");
+ return tr("[generic all workers]");
}
private static String allMachinesCaption() {
- return _("[generic all machines]");
+ return tr("[generic all machines]");
}
public void updateUnvalidated(String name, Boolean active) {
diff --git a/libreplan-business/src/main/java/org/libreplan/business/resources/entities/ResourceEnum.java b/libreplan-business/src/main/java/org/libreplan/business/resources/entities/ResourceEnum.java
index 19de56829..750698309 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/resources/entities/ResourceEnum.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/resources/entities/ResourceEnum.java
@@ -26,8 +26,8 @@ package org.libreplan.business.resources.entities;
*/
public enum ResourceEnum {
- WORKER(Worker.class, _("WORKER")),
- MACHINE(Machine.class, _("MACHINE"));
+ WORKER(Worker.class, tr("WORKER")),
+ MACHINE(Machine.class, tr("MACHINE"));
private Class extends Resource> klass;
@@ -41,7 +41,7 @@ public enum ResourceEnum {
/**
* Forces to mark the string as needing translation.
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-business/src/main/java/org/libreplan/business/resources/entities/ResourceType.java b/libreplan-business/src/main/java/org/libreplan/business/resources/entities/ResourceType.java
index f40f83677..b41e1db44 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/resources/entities/ResourceType.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/resources/entities/ResourceType.java
@@ -19,7 +19,7 @@
package org.libreplan.business.resources.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
/**
* Enumerate with the three basic types of resource: non-limiting, limiting and strategic.
@@ -27,8 +27,8 @@ import static org.libreplan.business.i18n.I18nHelper._;
*/
public enum ResourceType {
- NON_LIMITING_RESOURCE(_("Normal resource")),
- LIMITING_RESOURCE(_("Queue-based resource"));
+ NON_LIMITING_RESOURCE(tr("Normal resource")),
+ LIMITING_RESOURCE(tr("Queue-based resource"));
private String option;
diff --git a/libreplan-business/src/main/java/org/libreplan/business/settings/entities/Language.java b/libreplan-business/src/main/java/org/libreplan/business/settings/entities/Language.java
index 08d242979..598cc7241 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/settings/entities/Language.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/settings/entities/Language.java
@@ -20,7 +20,7 @@
package org.libreplan.business.settings.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
import java.util.Locale;
@@ -33,7 +33,7 @@ import java.util.Locale;
*/
public enum Language {
- BROWSER_LANGUAGE(_("Use browser language configuration"), null),
+ BROWSER_LANGUAGE(tr("Use browser language configuration"), null),
GALICIAN_LANGUAGE("Galego", new Locale("gl")),
SPANISH_LANGUAGE("Español", new Locale("es")),
ENGLISH_LANGUAGE("English", Locale.ENGLISH),
diff --git a/libreplan-business/src/main/java/org/libreplan/business/templates/entities/OrderLineGroupTemplate.java b/libreplan-business/src/main/java/org/libreplan/business/templates/entities/OrderLineGroupTemplate.java
index 96c62a7ce..419763bf8 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/templates/entities/OrderLineGroupTemplate.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/templates/entities/OrderLineGroupTemplate.java
@@ -270,7 +270,7 @@ public class OrderLineGroupTemplate extends OrderElementTemplate implements
@Override
public String getType() {
- return I18nHelper._("Group");
+ return I18nHelper.tr("Group");
}
@Override
diff --git a/libreplan-business/src/main/java/org/libreplan/business/templates/entities/OrderLineTemplate.java b/libreplan-business/src/main/java/org/libreplan/business/templates/entities/OrderLineTemplate.java
index 37534bed0..c540caa8e 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/templates/entities/OrderLineTemplate.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/templates/entities/OrderLineTemplate.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.business.templates.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
import java.math.BigDecimal;
import java.util.ArrayList;
@@ -163,7 +163,7 @@ public class OrderLineTemplate extends OrderElementTemplate {
@Override
public String getType() {
- return _("Line");
+ return tr("Line");
}
public Integer getWorkHours() {
diff --git a/libreplan-business/src/main/java/org/libreplan/business/templates/entities/OrderTemplate.java b/libreplan-business/src/main/java/org/libreplan/business/templates/entities/OrderTemplate.java
index 02803db8c..2251d8436 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/templates/entities/OrderTemplate.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/templates/entities/OrderTemplate.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.business.templates.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
import javax.validation.constraints.NotNull;
import org.libreplan.business.calendars.entities.BaseCalendar;
@@ -62,7 +62,7 @@ public class OrderTemplate extends OrderLineGroupTemplate {
@Override
public String getType() {
- return _("Project");
+ return tr("Project");
}
public void setCalendar(BaseCalendar calendar) {
diff --git a/libreplan-business/src/main/java/org/libreplan/business/users/entities/OrderAuthorizationType.java b/libreplan-business/src/main/java/org/libreplan/business/users/entities/OrderAuthorizationType.java
index fea907dc6..d42b13be0 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/users/entities/OrderAuthorizationType.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/users/entities/OrderAuthorizationType.java
@@ -21,7 +21,7 @@
package org.libreplan.business.users.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
/**
* Available types of {@link OrderAuthorization}.
@@ -30,8 +30,8 @@ import static org.libreplan.business.i18n.I18nHelper._;
*/
public enum OrderAuthorizationType {
- READ_AUTHORIZATION(_("Read authorization")),
- WRITE_AUTHORIZATION(_("Write authorization"));
+ READ_AUTHORIZATION(tr("Read authorization")),
+ WRITE_AUTHORIZATION(tr("Write authorization"));
private final String displayName;
diff --git a/libreplan-business/src/main/java/org/libreplan/business/users/entities/User.java b/libreplan-business/src/main/java/org/libreplan/business/users/entities/User.java
index 28b88d328..1ec4f5021 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/users/entities/User.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/users/entities/User.java
@@ -21,7 +21,7 @@
package org.libreplan.business.users.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
import java.util.HashSet;
import java.util.List;
@@ -370,8 +370,8 @@ public class User extends BaseEntity implements IHumanIdentifiable{
public enum UserAuthenticationType {
- DATABASE(_("Database")),
- LDAP(_("LDAP"));
+ DATABASE(tr("Database")),
+ LDAP(tr("LDAP"));
private String name;
diff --git a/libreplan-business/src/main/java/org/libreplan/business/users/entities/UserRole.java b/libreplan-business/src/main/java/org/libreplan/business/users/entities/UserRole.java
index e01c484c8..1dfbe8f2c 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/users/entities/UserRole.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/users/entities/UserRole.java
@@ -21,7 +21,7 @@
package org.libreplan.business.users.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
/**
* Available user roles.
@@ -33,70 +33,70 @@ import static org.libreplan.business.i18n.I18nHelper._;
public enum UserRole {
// Access to all pages
- ROLE_SUPERUSER(_("Superuser")),
+ ROLE_SUPERUSER(tr("Superuser")),
// Web services roles
- ROLE_WS_READER(_("Web service reader")),
- ROLE_WS_WRITER(_("Web service writer")),
- ROLE_WS_SUBCONTRACTING(_("Web service subcontractor operations")),
+ ROLE_WS_READER(tr("Web service reader")),
+ ROLE_WS_WRITER(tr("Web service writer")),
+ ROLE_WS_SUBCONTRACTING(tr("Web service subcontractor operations")),
// Project operations roles
- ROLE_READ_ALL_PROJECTS(_("Read all projects")),
- ROLE_EDIT_ALL_PROJECTS(_("Edit all projects")),
- ROLE_CREATE_PROJECTS(_("Create projects")),
+ ROLE_READ_ALL_PROJECTS(tr("Read all projects")),
+ ROLE_EDIT_ALL_PROJECTS(tr("Edit all projects")),
+ ROLE_CREATE_PROJECTS(tr("Create projects")),
// Special role for bound users
- ROLE_BOUND_USER(_("Bound user")),
+ ROLE_BOUND_USER(tr("Bound user")),
// Page roles
- ROLE_PLANNING(_("Planning")),
- ROLE_TEMPLATES(_("Templates")),
- ROLE_IMPORT_PROJECTS(_("Import projects")),
- ROLE_WORKERS(_("Workers")),
- ROLE_MACHINES(_("Machines")),
- ROLE_VIRTUAL_WORKERS(_("Virtual Workers")),
- ROLE_CALENDARS(_("Calendars")),
- ROLE_CALENDAR_EXCEPTION_DAYS(_("Calendar Exception Days")),
- ROLE_CRITERIA(_("Criteria")),
- ROLE_PROGRESS_TYPES(_("Progress Types")),
- ROLE_LABELS(_("Labels")),
- ROLE_MATERIALS(_("Materials")),
- ROLE_MATERIAL_UNITS(_("Material Units")),
- ROLE_QUALITY_FORMS(_("Quality Forms")),
- ROLE_TIMESHEETS(_("Timesheets")),
- ROLE_TIMESHEETS_TEMPLATES(_("Timesheets Templates")),
- ROLE_EXPENSES(_("Expenses")),
- ROLE_COST_CATEGORIES(_("Cost Categories")),
- ROLE_HOURS_TYPES(_("Hours Types")),
- ROLE_MAIN_SETTINGS(_("Main Settings")),
- ROLE_USER_ACCOUNTS(_("User Accounts")),
- ROLE_PROFILES(_("Profiles")),
- ROLE_JOB_SCHEDULING(_("Job Scheduling")),
- ROLE_COMPANIES(_("Companies")),
- ROLE_SEND_TO_SUBCONTRACTORS(_("Send To Subcontractors")),
- ROLE_RECEIVED_FROM_SUBCONTRACTORS(_("Received From Subcontractors")),
- ROLE_SEND_TO_CUSTOMERS(_("Send To Customers")),
- ROLE_RECEIVED_FROM_CUSTOMERS(_("Received From Customers")),
- ROLE_TIMESHEET_LINES_LIST(_("Timesheet Lines List")),
- ROLE_HOURS_WORKED_PER_RESOURCE_REPORT(_("Hours Worked Per Resource Report")),
- ROLE_TOTAL_WORKED_HOURS_BY_RESOURCE_IN_A_MONTH_REPORT(_("Total Worked Hours By Resource In A Month Report")),
- ROLE_WORK_AND_PROGRESS_PER_PROJECT_REPORT(_("Work And Progress Per Project Report")),
- ROLE_WORK_AND_PROGRESS_PER_TASK_REPORT(_("Work And Progress Per Task Report")),
- ROLE_ESTIMATED_PLANNED_HOURS_PER_TASK_REPORT(_("Estimated/Planned Hours Per Task Report")),
- ROLE_PROJECT_COSTS_REPORT(_("Project Costs Report")),
- ROLE_TASK_SCHEDULING_STATUS_IN_PROJECT_REPORT(_("Task Scheduling Status In Project Report")),
- ROLE_MATERIALS_NEED_AT_DATE_REPORT(_("Materials Needed At Date Report")),
- ROLE_PROJECT_STATUS_REPORT(_("Project Status Report")),
+ ROLE_PLANNING(tr("Planning")),
+ ROLE_TEMPLATES(tr("Templates")),
+ ROLE_IMPORT_PROJECTS(tr("Import projects")),
+ ROLE_WORKERS(tr("Workers")),
+ ROLE_MACHINES(tr("Machines")),
+ ROLE_VIRTUAL_WORKERS(tr("Virtual Workers")),
+ ROLE_CALENDARS(tr("Calendars")),
+ ROLE_CALENDAR_EXCEPTION_DAYS(tr("Calendar Exception Days")),
+ ROLE_CRITERIA(tr("Criteria")),
+ ROLE_PROGRESS_TYPES(tr("Progress Types")),
+ ROLE_LABELS(tr("Labels")),
+ ROLE_MATERIALS(tr("Materials")),
+ ROLE_MATERIAL_UNITS(tr("Material Units")),
+ ROLE_QUALITY_FORMS(tr("Quality Forms")),
+ ROLE_TIMESHEETS(tr("Timesheets")),
+ ROLE_TIMESHEETS_TEMPLATES(tr("Timesheets Templates")),
+ ROLE_EXPENSES(tr("Expenses")),
+ ROLE_COST_CATEGORIES(tr("Cost Categories")),
+ ROLE_HOURS_TYPES(tr("Hours Types")),
+ ROLE_MAIN_SETTINGS(tr("Main Settings")),
+ ROLE_USER_ACCOUNTS(tr("User Accounts")),
+ ROLE_PROFILES(tr("Profiles")),
+ ROLE_JOB_SCHEDULING(tr("Job Scheduling")),
+ ROLE_COMPANIES(tr("Companies")),
+ ROLE_SEND_TO_SUBCONTRACTORS(tr("Send To Subcontractors")),
+ ROLE_RECEIVED_FROM_SUBCONTRACTORS(tr("Received From Subcontractors")),
+ ROLE_SEND_TO_CUSTOMERS(tr("Send To Customers")),
+ ROLE_RECEIVED_FROM_CUSTOMERS(tr("Received From Customers")),
+ ROLE_TIMESHEET_LINES_LIST(tr("Timesheet Lines List")),
+ ROLE_HOURS_WORKED_PER_RESOURCE_REPORT(tr("Hours Worked Per Resource Report")),
+ ROLE_TOTAL_WORKED_HOURS_BY_RESOURCE_IN_A_MONTH_REPORT(tr("Total Worked Hours By Resource In A Month Report")),
+ ROLE_WORK_AND_PROGRESS_PER_PROJECT_REPORT(tr("Work And Progress Per Project Report")),
+ ROLE_WORK_AND_PROGRESS_PER_TASK_REPORT(tr("Work And Progress Per Task Report")),
+ ROLE_ESTIMATED_PLANNED_HOURS_PER_TASK_REPORT(tr("Estimated/Planned Hours Per Task Report")),
+ ROLE_PROJECT_COSTS_REPORT(tr("Project Costs Report")),
+ ROLE_TASK_SCHEDULING_STATUS_IN_PROJECT_REPORT(tr("Task Scheduling Status In Project Report")),
+ ROLE_MATERIALS_NEED_AT_DATE_REPORT(tr("Materials Needed At Date Report")),
+ ROLE_PROJECT_STATUS_REPORT(tr("Project Status Report")),
- ROLE_EDIT_EMAIL_TEMPLATES(_("Edit E-mail Templates")),
- ROLE_USE_FILES(_("Use files for order")),
+ ROLE_EDIT_EMAIL_TEMPLATES(tr("Edit E-mail Templates")),
+ ROLE_USE_FILES(tr("Use files for order")),
- ROLE_EMAIL_TASK_ASSIGNED_TO_RESOURCE(_("Email: task assigned to resource")),
- ROLE_EMAIL_RESOURCE_REMOVED_FROM_TASK(_("Email: resource removed from task")),
- ROLE_EMAIL_MILESTONE_REACHED(_("Email: milestone reached")),
- ROLE_EMAIL_TASK_SHOULD_FINISH(_("Email: task should finish")),
- ROLE_EMAIL_TASK_SHOULD_START(_("Email: task should start")),
- ROLE_EMAIL_TIMESHEET_DATA_MISSING(_("Email: timesheet data missing"));
+ ROLE_EMAIL_TASK_ASSIGNED_TO_RESOURCE(tr("Email: task assigned to resource")),
+ ROLE_EMAIL_RESOURCE_REMOVED_FROM_TASK(tr("Email: resource removed from task")),
+ ROLE_EMAIL_MILESTONE_REACHED(tr("Email: milestone reached")),
+ ROLE_EMAIL_TASK_SHOULD_FINISH(tr("Email: task should finish")),
+ ROLE_EMAIL_TASK_SHOULD_START(tr("Email: task should start")),
+ ROLE_EMAIL_TIMESHEET_DATA_MISSING(tr("Email: timesheet data missing"));
private final String displayName;
diff --git a/libreplan-business/src/main/java/org/libreplan/business/workingday/hibernate/EffortDurationType.java b/libreplan-business/src/main/java/org/libreplan/business/workingday/hibernate/EffortDurationType.java
index 6431edb9d..5d132526f 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/workingday/hibernate/EffortDurationType.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/workingday/hibernate/EffortDurationType.java
@@ -28,7 +28,7 @@ import java.sql.Types;
import java.util.Objects;
import org.hibernate.HibernateException;
-import org.hibernate.engine.spi.SessionImplementor;
+import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.usertype.UserType;
import org.libreplan.business.workingday.EffortDuration;
@@ -60,10 +60,9 @@ public class EffortDurationType implements UserType {
@Override
public Object nullSafeGet(ResultSet rs, String[] names,
- SessionImplementor session, Object owner)
+ SharedSessionContractImplementor session, Object owner)
throws HibernateException, SQLException {
- Integer seconds = StandardBasicTypes.INTEGER.nullSafeGet(rs, names[0],
- session);
+ Integer seconds = (Integer) rs.getObject(names[0]);
if (seconds == null) {
return null;
}
@@ -72,10 +71,13 @@ public class EffortDurationType implements UserType {
@Override
public void nullSafeSet(PreparedStatement st, Object value, int index,
- SessionImplementor session) throws HibernateException, SQLException {
+ SharedSessionContractImplementor session) throws HibernateException, SQLException {
EffortDuration duration = (EffortDuration) value;
- Integer seconds = duration != null ? duration.getSeconds() : null;
- StandardBasicTypes.INTEGER.nullSafeSet(st, seconds, index, session);
+ if (duration == null) {
+ st.setNull(index, Types.INTEGER);
+ } else {
+ st.setInt(index, duration.getSeconds());
+ }
}
@Override
diff --git a/libreplan-business/src/main/java/org/libreplan/business/workingday/hibernate/ResourcesPerDayType.java b/libreplan-business/src/main/java/org/libreplan/business/workingday/hibernate/ResourcesPerDayType.java
index 15d43ec63..7b42e18ac 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/workingday/hibernate/ResourcesPerDayType.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/workingday/hibernate/ResourcesPerDayType.java
@@ -29,8 +29,7 @@ import java.sql.SQLException;
import java.sql.Types;
import org.hibernate.HibernateException;
-import org.hibernate.engine.spi.SessionImplementor;
-import org.hibernate.type.StandardBasicTypes;
+import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.usertype.UserType;
import org.libreplan.business.workingday.ResourcesPerDay;
@@ -87,11 +86,10 @@ public class ResourcesPerDayType implements UserType {
@Override
public Object nullSafeGet(ResultSet rs, String[] names,
- SessionImplementor session, Object owner)
+ SharedSessionContractImplementor session, Object owner)
throws HibernateException, SQLException {
- BigDecimal bigDecimal = (BigDecimal) StandardBasicTypes.BIG_DECIMAL
- .nullSafeGet(rs, names[0], session);
- if (bigDecimal == null) {
+ BigDecimal bigDecimal = rs.getBigDecimal(names[0]);
+ if (rs.wasNull() || bigDecimal == null) {
return null;
}
return ResourcesPerDay.amount(bigDecimal);
@@ -99,13 +97,12 @@ public class ResourcesPerDayType implements UserType {
@Override
public void nullSafeSet(PreparedStatement st, Object value, int index,
- SessionImplementor session) throws HibernateException, SQLException {
- BigDecimal amount = null;
- if (value != null) {
- amount = ((ResourcesPerDay) value).getAmount();
+ SharedSessionContractImplementor session) throws HibernateException, SQLException {
+ if (value == null) {
+ st.setNull(index, Types.NUMERIC);
+ } else {
+ st.setBigDecimal(index, ((ResourcesPerDay) value).getAmount());
}
- StandardBasicTypes.BIG_DECIMAL.nullSafeSet(st, amount, index, session);
-
}
@Override
diff --git a/libreplan-business/src/main/java/org/libreplan/business/workreports/entities/HoursManagementEnum.java b/libreplan-business/src/main/java/org/libreplan/business/workreports/entities/HoursManagementEnum.java
index 50697e6fb..82aa231e9 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/workreports/entities/HoursManagementEnum.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/workreports/entities/HoursManagementEnum.java
@@ -24,13 +24,13 @@
*/
package org.libreplan.business.workreports.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
public enum HoursManagementEnum {
- NUMBER_OF_HOURS(_("Number of assigned hours")),
- HOURS_CALCULATED_BY_CLOCK(_("Number of hours calculated by clock")),
- NUMBER_OF_HOURS_AND_CLOCK(_("Number of assigned hours and time"));
+ NUMBER_OF_HOURS(tr("Number of assigned hours")),
+ HOURS_CALCULATED_BY_CLOCK(tr("Number of hours calculated by clock")),
+ NUMBER_OF_HOURS_AND_CLOCK(tr("Number of assigned hours and time"));
private String description;
diff --git a/libreplan-business/src/main/java/org/libreplan/business/workreports/entities/PositionInWorkReportEnum.java b/libreplan-business/src/main/java/org/libreplan/business/workreports/entities/PositionInWorkReportEnum.java
index 3e61e8e0c..92c183ddd 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/workreports/entities/PositionInWorkReportEnum.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/workreports/entities/PositionInWorkReportEnum.java
@@ -24,14 +24,14 @@
*/
package org.libreplan.business.workreports.entities;
-import static org.libreplan.business.i18n.I18nHelper._;
+import static org.libreplan.business.i18n.I18nHelper.tr;
/**
* @author Susana Montes Pedreira
*/
public enum PositionInWorkReportEnum {
- HEADING(_("heading")), LINE(_("line"));
+ HEADING(tr("heading")), LINE(tr("line"));
private String displayName;
diff --git a/libreplan-business/src/main/resources/META-INF/services/org.hibernate.boot.model.TypeContributor b/libreplan-business/src/main/resources/META-INF/services/org.hibernate.boot.model.TypeContributor
new file mode 100644
index 000000000..637cd08af
--- /dev/null
+++ b/libreplan-business/src/main/resources/META-INF/services/org.hibernate.boot.model.TypeContributor
@@ -0,0 +1 @@
+org.libreplan.business.common.hibernate.JodaTypeContributor
diff --git a/libreplan-business/src/main/resources/libreplan-business-hibernate.cfg.xml b/libreplan-business/src/main/resources/libreplan-business-hibernate.cfg.xml
index ac5fda42b..40b53ba3c 100644
--- a/libreplan-business/src/main/resources/libreplan-business-hibernate.cfg.xml
+++ b/libreplan-business/src/main/resources/libreplan-business-hibernate.cfg.xml
@@ -20,7 +20,7 @@
-->
none
- true
+ false
jvm
jvm
diff --git a/libreplan-business/src/main/resources/libreplan-business-spring-config.xml b/libreplan-business/src/main/resources/libreplan-business-spring-config.xml
index 2ed5f1c38..0f27c35c7 100644
--- a/libreplan-business/src/main/resources/libreplan-business-spring-config.xml
+++ b/libreplan-business/src/main/resources/libreplan-business-spring-config.xml
@@ -7,10 +7,10 @@
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
+ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
diff --git a/libreplan-webapp/pom.xml b/libreplan-webapp/pom.xml
index 055ac512e..6523efaf7 100644
--- a/libreplan-webapp/pom.xml
+++ b/libreplan-webapp/pom.xml
@@ -10,7 +10,7 @@
libreplan-webapp
war
- LibrePlan Web Client Module
+ TASKPM Web Client Module
@@ -395,7 +395,7 @@
${jdbcDriver.groupId}
${jdbcDriver.artifactId}
- test
+ runtime
diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/CalendarImporterMPXJ.java b/libreplan-webapp/src/main/java/org/libreplan/importers/CalendarImporterMPXJ.java
index 46c85c846..7f2f33e29 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/importers/CalendarImporterMPXJ.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/importers/CalendarImporterMPXJ.java
@@ -20,7 +20,7 @@
package org.libreplan.importers;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.io.InputStream;
import java.util.ArrayList;
@@ -337,7 +337,7 @@ public class CalendarImporterMPXJ implements ICalendarImporter {
if (calendars.isEmpty()) {
return name;
} else {
- throw new ValidationException(_("Calendar name already in use"));
+ throw new ValidationException(tr("Calendar name already in use"));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/ExportTimesheetsToTim.java b/libreplan-webapp/src/main/java/org/libreplan/importers/ExportTimesheetsToTim.java
index 8ad2a329d..6c3cf8aae 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/importers/ExportTimesheetsToTim.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/importers/ExportTimesheetsToTim.java
@@ -19,7 +19,7 @@
package org.libreplan.importers;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.Collections;
@@ -89,21 +89,21 @@ public class ExportTimesheetsToTim implements IExportTimesheetsToTim {
public List exportTimesheets() throws ConnectorException {
Connector connector = getTimConnector();
if (connector == null) {
- throw new ConnectorException(_("Tim connector not found"));
+ throw new ConnectorException(tr("Tim connector not found"));
}
if (!connector.areConnectionValuesValid()) {
throw new ConnectorException(
- _("Connection values of Tim connector are invalid"));
+ tr("Connection values of Tim connector are invalid"));
}
- synchronizationInfo = new SynchronizationInfo(_("Export"));
+ synchronizationInfo = new SynchronizationInfo(tr("Export"));
List syncInfos = new ArrayList();
List orderSyncInfos = orderSyncInfoDAO.findByConnectorName(PredefinedConnectors.TIM.getName());
if (orderSyncInfos == null || orderSyncInfos.isEmpty()) {
LOG.warn("No items found in 'OrderSyncInfo' to export to Tim");
- synchronizationInfo.addFailedReason(_("No items found in 'OrderSyncInfo' to export to Tim"));
+ synchronizationInfo.addFailedReason(tr("No items found in 'OrderSyncInfo' to export to Tim"));
syncInfos.add(synchronizationInfo);
return syncInfos;
}
@@ -124,20 +124,20 @@ public class ExportTimesheetsToTim implements IExportTimesheetsToTim {
public void exportTimesheets(String productCode, Order order)
throws ConnectorException {
if (productCode == null || productCode.isEmpty()) {
- throw new ConnectorException(_("Product code should not be empty"));
+ throw new ConnectorException(tr("Product code should not be empty"));
}
if (order == null) {
- throw new ConnectorException(_("Order should not be empty"));
+ throw new ConnectorException(tr("Order should not be empty"));
}
Connector connector = getTimConnector();
if (connector == null) {
- throw new ConnectorException(_("Tim connector not found"));
+ throw new ConnectorException(tr("Tim connector not found"));
}
if (!connector.areConnectionValuesValid()) {
throw new ConnectorException(
- _("Connection values of Tim connector are invalid"));
+ tr("Connection values of Tim connector are invalid"));
}
exportTimesheets(productCode, order, connector);
@@ -158,7 +158,7 @@ public class ExportTimesheetsToTim implements IExportTimesheetsToTim {
private void exportTimesheets(String productCode, Order order,
Connector connector) {
- synchronizationInfo = new SynchronizationInfo(_(
+ synchronizationInfo = new SynchronizationInfo(tr(
"Export product code {0}, project {1}", productCode,
order.getName()));
@@ -181,7 +181,7 @@ public class ExportTimesheetsToTim implements IExportTimesheetsToTim {
if (workReportLines == null || workReportLines.isEmpty()) {
LOG.warn("No work reportlines are found for order: '"
+ order.getName() + "'");
- synchronizationInfo.addFailedReason(_(
+ synchronizationInfo.addFailedReason(tr(
"No work reportlines are found for order: \"{0}\"",
order.getName()));
return;
@@ -200,7 +200,7 @@ public class ExportTimesheetsToTim implements IExportTimesheetsToTim {
if (timeRegistrationDTOs.isEmpty()) {
LOG.warn("Unable to crate timeregistration for request");
synchronizationInfo
- .addFailedReason(_("Unable to crate time registration for request"));
+ .addFailedReason(tr("Unable to crate time registration for request"));
return;
}
@@ -214,14 +214,14 @@ public class ExportTimesheetsToTim implements IExportTimesheetsToTim {
if (timeRegistrationResponseDTO == null) {
LOG.error("No response or exception in response");
synchronizationInfo
- .addFailedReason(_("No response or exception in response"));
+ .addFailedReason(tr("No response or exception in response"));
return;
}
if (isRefsListEmpty(timeRegistrationResponseDTO.getRefs())) {
LOG.warn("Registration response with empty refs");
synchronizationInfo
- .addFailedReason(_("Registration response with empty refs"));
+ .addFailedReason(tr("Registration response with empty refs"));
return;
}
saveSyncInfoOnAnotherTransaction(productCode, order);
@@ -288,7 +288,7 @@ public class ExportTimesheetsToTim implements IExportTimesheetsToTim {
worker = workerDAO.findByCode(workerCode);
} catch (InstanceNotFoundException e) {
LOG.warn("Worker '" + workerCode + "' not found");
- synchronizationInfo.addFailedReason(_("Worker \"{0}\" not found",
+ synchronizationInfo.addFailedReason(tr("Worker \"{0}\" not found",
workerCode));
return null;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/ImportRosterFromTim.java b/libreplan-webapp/src/main/java/org/libreplan/importers/ImportRosterFromTim.java
index dc8f1a11d..f14e01d44 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/importers/ImportRosterFromTim.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/importers/ImportRosterFromTim.java
@@ -19,7 +19,7 @@
package org.libreplan.importers;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.Collections;
@@ -121,12 +121,12 @@ public class ImportRosterFromTim implements IImportRosterFromTim {
Connector connector = connectorDAO
.findUniqueByName(PredefinedConnectors.TIM.getName());
if (connector == null) {
- throw new ConnectorException(_("Tim connector not found"));
+ throw new ConnectorException(tr("Tim connector not found"));
}
if (!connector.areConnectionValuesValid()) {
throw new ConnectorException(
- _("Connection values of Tim connector are invalid"));
+ tr("Connection values of Tim connector are invalid"));
}
Map properties = connector.getPropertiesAsMap();
@@ -150,7 +150,7 @@ public class ImportRosterFromTim implements IImportRosterFromTim {
if (StringUtils.isBlank(departmentIds)) {
LOG.warn("No departments configured");
- throw new ConnectorException(_("No departments configured"));
+ throw new ConnectorException(tr("No departments configured"));
}
String[] departmentIdsArray = StringUtils.stripAll(StringUtils.split(
@@ -161,7 +161,7 @@ public class ImportRosterFromTim implements IImportRosterFromTim {
for (String department : departmentIdsArray) {
LOG.info("Department: " + department);
- synchronizationInfo = new SynchronizationInfo(_(
+ synchronizationInfo = new SynchronizationInfo(tr(
"Import roster for department {0}", department));
RosterRequestDTO rosterRequestDTO = createRosterRequest(department,
@@ -178,7 +178,7 @@ public class ImportRosterFromTim implements IImportRosterFromTim {
}
} else {
LOG.error("No valid response for department " + department);
- synchronizationInfo.addFailedReason(_(
+ synchronizationInfo.addFailedReason(tr(
"No valid response for department \"{0}\"",
department));
syncInfos.add(synchronizationInfo);
@@ -207,7 +207,7 @@ public class ImportRosterFromTim implements IImportRosterFromTim {
} else {
LOG.info("No roster-exceptions found in the response");
synchronizationInfo
- .addFailedReason(_("No roster-exceptions found in the response"));
+ .addFailedReason(tr("No roster-exceptions found in the response"));
}
return null;
}
@@ -235,7 +235,7 @@ public class ImportRosterFromTim implements IImportRosterFromTim {
worker = workerDAO.findUniqueByNif(workerCode);
} catch (InstanceNotFoundException e) {
LOG.warn("Worker '" + workerCode + "' not found");
- synchronizationInfo.addFailedReason(_(
+ synchronizationInfo.addFailedReason(tr(
"Worker \"{0}\" not found",
workerCode));
}
@@ -353,7 +353,7 @@ public class ImportRosterFromTim implements IImportRosterFromTim {
if (name == null || name.isEmpty()) {
LOG.error("Exception name should not be empty");
synchronizationInfo
- .addFailedReason(_("Exception name should not be empty"));
+ .addFailedReason(tr("Exception name should not be empty"));
return null;
}
try {
@@ -369,7 +369,7 @@ public class ImportRosterFromTim implements IImportRosterFromTim {
} catch (InstanceNotFoundException e) {
LOG.error("Calendar exceptionType not found", e);
synchronizationInfo
- .addFailedReason(_("Calendar exception day not found"));
+ .addFailedReason(tr("Calendar exception day not found"));
}
return null;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/JiraOrderElementSynchronizer.java b/libreplan-webapp/src/main/java/org/libreplan/importers/JiraOrderElementSynchronizer.java
index f98db9057..cdff8be7c 100755
--- a/libreplan-webapp/src/main/java/org/libreplan/importers/JiraOrderElementSynchronizer.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/importers/JiraOrderElementSynchronizer.java
@@ -19,7 +19,7 @@
package org.libreplan.importers;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.math.BigDecimal;
import java.math.RoundingMode;
@@ -102,7 +102,7 @@ public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchroniz
public List getAllJiraLabels() throws ConnectorException {
Connector connector = getJiraConnector();
if (connector == null) {
- throw new ConnectorException(_("JIRA connector not found"));
+ throw new ConnectorException(tr("JIRA connector not found"));
}
String jiraLabels = connector.getPropertiesAsMap().get(
@@ -124,12 +124,12 @@ public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchroniz
Connector connector = getJiraConnector();
if (connector == null) {
- throw new ConnectorException(_("JIRA connector not found"));
+ throw new ConnectorException(tr("JIRA connector not found"));
}
if (!connector.areConnectionValuesValid()) {
throw new ConnectorException(
- _("Connection values of JIRA connector are invalid"));
+ tr("Connection values of JIRA connector are invalid"));
}
return getJiraIssues(label, connector);
@@ -167,7 +167,7 @@ public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchroniz
@Transactional(readOnly = true)
public void syncOrderElementsWithJiraIssues(List issues, Order order) {
- synchronizationInfo = new SynchronizationInfo(_(
+ synchronizationInfo = new SynchronizationInfo(tr(
"Synchronization order {0}", order.getName()));
for (IssueDTO issue : issues) {
@@ -178,7 +178,7 @@ public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchroniz
OrderLine orderLine = syncOrderLine(order, code, name);
if (orderLine == null) {
- synchronizationInfo.addFailedReason(_(
+ synchronizationInfo.addFailedReason(tr(
"Order-element for \"{0}\" issue not found",
issue.getKey()));
continue;
@@ -190,7 +190,7 @@ public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchroniz
.getTimetracking(), loggedHours);
if (estimatedHours.isZero()) {
- synchronizationInfo.addFailedReason(_(
+ synchronizationInfo.addFailedReason(tr(
"Estimated time for \"{0}\" issue is 0",
issue.getKey()));
continue;
@@ -279,14 +279,14 @@ public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchroniz
WorkLogDTO workLog = issue.getFields().getWorklog();
if (workLog == null) {
- synchronizationInfo.addFailedReason(_(
+ synchronizationInfo.addFailedReason(tr(
"No worklogs found for \"{0}\" issue", issue.getKey()));
return;
}
List workLogItems = workLog.getWorklogs();
if (workLogItems.isEmpty()) {
- synchronizationInfo.addFailedReason(_(
+ synchronizationInfo.addFailedReason(tr(
"No worklog items found for \"{0}\" issue",
issue.getKey()));
return;
@@ -398,7 +398,7 @@ public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchroniz
// This could happen if a parent or child of the current
// OrderElement has an advance of type PERCENTAGE
synchronizationInfo
- .addFailedReason(_(
+ .addFailedReason(tr(
"Duplicate value AdvanceAssignment for order element of \"{0}\"",
orderElement.getCode()));
return;
@@ -504,24 +504,24 @@ public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchroniz
public List syncOrderElementsWithJiraIssues() throws ConnectorException {
Connector connector = getJiraConnector();
if (connector == null) {
- throw new ConnectorException(_("JIRA connector not found"));
+ throw new ConnectorException(tr("JIRA connector not found"));
}
if (!connector.areConnectionValuesValid()) {
throw new ConnectorException(
- _("Connection values of JIRA connector are invalid"));
+ tr("Connection values of JIRA connector are invalid"));
}
List orderSyncInfos = orderSyncInfoDAO
.findByConnectorName(PredefinedConnectors.JIRA.getName());
- synchronizationInfo = new SynchronizationInfo(_("Synchronization"));
+ synchronizationInfo = new SynchronizationInfo(tr("Synchronization"));
List syncInfos = new ArrayList();
if (orderSyncInfos == null || orderSyncInfos.isEmpty()) {
LOG.warn("No items found in 'OrderSyncInfo' to synchronize with JIRA issues");
synchronizationInfo
- .addFailedReason(_("No items found in 'OrderSyncInfo' to synchronize with JIRA issues"));
+ .addFailedReason(tr("No items found in 'OrderSyncInfo' to synchronize with JIRA issues"));
syncInfos.add(synchronizationInfo);
return syncInfos;
}
@@ -529,7 +529,7 @@ public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchroniz
for (OrderSyncInfo orderSyncInfo : orderSyncInfos) {
Order order = orderSyncInfo.getOrder();
LOG.info("Synchronizing '" + order.getName() + "'");
- synchronizationInfo = new SynchronizationInfo(_(
+ synchronizationInfo = new SynchronizationInfo(tr(
"Synchronization order {0}", order.getName()));
List issueDTOs = getJiraIssues(orderSyncInfo.getKey(),
@@ -537,7 +537,7 @@ public class JiraOrderElementSynchronizer implements IJiraOrderElementSynchroniz
if (issueDTOs == null || issueDTOs.isEmpty()) {
LOG.warn("No JIRA issues found for '" + orderSyncInfo.getKey()
+ "'");
- synchronizationInfo.addFailedReason(_(
+ synchronizationInfo.addFailedReason(tr(
"No JIRA issues found for key {0}",
orderSyncInfo.getKey()));
syncInfos.add(synchronizationInfo);
diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/JiraTimesheetSynchronizer.java b/libreplan-webapp/src/main/java/org/libreplan/importers/JiraTimesheetSynchronizer.java
index c2156b705..03571122c 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/importers/JiraTimesheetSynchronizer.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/importers/JiraTimesheetSynchronizer.java
@@ -19,7 +19,7 @@
package org.libreplan.importers;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.List;
import java.util.Set;
@@ -101,14 +101,14 @@ public class JiraTimesheetSynchronizer implements IJiraTimesheetSynchronizer {
@Override
@Transactional
public void syncJiraTimesheetWithJiraIssues(List issues, Order order) throws ConnectorException {
- synchronizationInfo = new SynchronizationInfo(_("Synchronization"));
+ synchronizationInfo = new SynchronizationInfo(tr("Synchronization"));
workReportType = getJiraTimesheetsWorkReportType();
typeOfWorkHours = getTypeOfWorkHours();
workers = getWorkers();
if (workers == null && workers.isEmpty()) {
- synchronizationInfo.addFailedReason(_("No workers found"));
+ synchronizationInfo.addFailedReason(tr("No workers found"));
return;
}
@@ -117,11 +117,11 @@ public class JiraTimesheetSynchronizer implements IJiraTimesheetSynchronizer {
if (orderSyncInfo == null) {
synchronizationInfo.addFailedReason(
- _("Order \"{0}\" not found. Order probalbly not synchronized", order.getName()));
+ tr("Order \"{0}\" not found. Order probalbly not synchronized", order.getName()));
return;
}
if (StringUtils.isBlank(orderSyncInfo.getKey())) {
- synchronizationInfo.addFailedReason(_("Key for Order \"{0}\" is empty", order.getName()));
+ synchronizationInfo.addFailedReason(tr("Key for Order \"{0}\" is empty", order.getName()));
return;
}
@@ -132,11 +132,11 @@ public class JiraTimesheetSynchronizer implements IJiraTimesheetSynchronizer {
for (IssueDTO issue : issues) {
WorkLogDTO workLog = issue.getFields().getWorklog();
if (workLog == null) {
- synchronizationInfo.addFailedReason(_("No worklogs found for \"{0}\" key", issue.getKey()));
+ synchronizationInfo.addFailedReason(tr("No worklogs found for \"{0}\" key", issue.getKey()));
} else {
List workLogItems = workLog.getWorklogs();
if (workLogItems == null || workLogItems.isEmpty()) {
- synchronizationInfo.addFailedReason(_("No worklog items found for \"{0}\" issue", issue.getKey()));
+ synchronizationInfo.addFailedReason(tr("No worklog items found for \"{0}\" issue", issue.getKey()));
} else {
String codeOrderElement =
@@ -145,7 +145,7 @@ public class JiraTimesheetSynchronizer implements IJiraTimesheetSynchronizer {
OrderElement orderElement = order.getOrderElement(codeOrderElement);
if (orderElement == null) {
- synchronizationInfo.addFailedReason(_("Order element \"{0}\" not found", code));
+ synchronizationInfo.addFailedReason(tr("Order element \"{0}\" not found", code));
} else {
updateOrCreateWorkReportLineAndAddToWorkReport(workReport, orderElement, workLogItems);
}
@@ -297,14 +297,14 @@ public class JiraTimesheetSynchronizer implements IJiraTimesheetSynchronizer {
private TypeOfWorkHours getTypeOfWorkHours() throws ConnectorException {
Connector connector = connectorDAO.findUniqueByName(PredefinedConnectors.JIRA.getName());
if (connector == null) {
- throw new ConnectorException(_("JIRA connector not found"));
+ throw new ConnectorException(tr("JIRA connector not found"));
}
TypeOfWorkHours typeOfWorkHours;
String name = connector.getPropertiesAsMap().get(PredefinedConnectorProperties.JIRA_HOURS_TYPE);
if (StringUtils.isBlank(name)) {
- throw new ConnectorException(_("Hours type should not be empty to synchronine timesheets"));
+ throw new ConnectorException(tr("Hours type should not be empty to synchronine timesheets"));
}
try {
@@ -354,7 +354,7 @@ public class JiraTimesheetSynchronizer implements IJiraTimesheetSynchronizer {
return worker;
}
}
- synchronizationInfo.addFailedReason(_("Worker \"{0}\" not found", nif));
+ synchronizationInfo.addFailedReason(tr("Worker \"{0}\" not found", nif));
return null;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/OrderImporterMPXJ.java b/libreplan-webapp/src/main/java/org/libreplan/importers/OrderImporterMPXJ.java
index eafb414c1..2b42f0ef4 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/importers/OrderImporterMPXJ.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/importers/OrderImporterMPXJ.java
@@ -19,7 +19,7 @@
package org.libreplan.importers;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.io.InputStream;
import java.util.ArrayList;
@@ -605,6 +605,6 @@ public class OrderImporterMPXJ implements IOrderImporter {
}
}
- throw new ValidationException(_("Linked calendar not found"));
+ throw new ValidationException(tr("Linked calendar not found"));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/SchedulerManager.java b/libreplan-webapp/src/main/java/org/libreplan/importers/SchedulerManager.java
index 2d65379db..aa9931da1 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/importers/SchedulerManager.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/importers/SchedulerManager.java
@@ -267,7 +267,9 @@ public class SchedulerManager implements ISchedulerManager {
jobDetailBean.setName(jobSchedulerConfiguration.getJobName());
jobDetailBean.setGroup(jobSchedulerConfiguration.getJobGroup());
- jobDetailBean.setJobClass(jobClass);
+ @SuppressWarnings("unchecked")
+ Class extends org.quartz.Job> jobClassTyped = (Class extends org.quartz.Job>) jobClass;
+ jobDetailBean.setJobClass(jobClassTyped);
Map jobDataAsMap = new HashMap<>();
jobDataAsMap.put("applicationContext", applicationContext);
diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/notifications/ComposeMessage.java b/libreplan-webapp/src/main/java/org/libreplan/importers/notifications/ComposeMessage.java
index 31897184c..16db57604 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/importers/notifications/ComposeMessage.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/importers/notifications/ComposeMessage.java
@@ -88,7 +88,7 @@ import java.io.UnsupportedEncodingException;
import org.springframework.core.env.MapPropertySource;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Sends E-mail to users with data that storing in notification_queue table and
@@ -190,8 +190,8 @@ public class ComposeMessage {
throw new RuntimeException(e);
} catch (NullPointerException e) {
if (receiver == null) {
- Messagebox.show(_(currentWorker.getUser().getLoginName() + " - this user have not filled E-mail"),
- _("Error"), Messagebox.OK, Messagebox.ERROR);
+ Messagebox.show(tr(currentWorker.getUser().getLoginName() + " - this user have not filled E-mail"),
+ tr("Error"), Messagebox.OK, Messagebox.ERROR);
}
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/I18nHelper.java b/libreplan-webapp/src/main/java/org/libreplan/web/I18nHelper.java
index 4bef3350e..70381118b 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/I18nHelper.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/I18nHelper.java
@@ -100,27 +100,27 @@ public class I18nHelper {
* @param str
* @return Text depends on locale
*/
- public static String _(String str) {
+ public static String tr(String str) {
return getI18n().tr(str);
}
- public static String _(String text, Object o1) {
+ public static String tr(String text, Object o1) {
return getI18n().tr(text, o1);
}
- public static String _(String text, Object o1, Object o2) {
+ public static String tr(String text, Object o1, Object o2) {
return getI18n().tr(text, o1, o2);
}
- public static String _(String text, Object o1, Object o2, Object o3) {
+ public static String tr(String text, Object o1, Object o2, Object o3) {
return getI18n().tr(text, o1, o2, o3);
}
- public static String _(String text, Object o1, Object o2, Object o3, Object o4) {
+ public static String tr(String text, Object o1, Object o2, Object o3, Object o4) {
return getI18n().tr(text, o1, o2, o3, o4);
}
- public static String _(String text, Object[] objects) {
+ public static String tr(String text, Object[] objects) {
return getI18n().tr(text, objects);
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/LoggingConfiguration.java b/libreplan-webapp/src/main/java/org/libreplan/web/LoggingConfiguration.java
index 8e3784060..11c2e6e26 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/LoggingConfiguration.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/LoggingConfiguration.java
@@ -73,7 +73,7 @@ public class LoggingConfiguration implements ServletContextListener {
String applicationName = firstNotEmptyOrNull(
servletContext.getContextPath(),
servletContext.getServletContextName(),
- "LibrePlan");
+ "TASKPM");
if ( isTomcat(servletContext) ) {
File logDirectory = findTomcatLogDirectory();
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/advance/AdvanceTypeCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/advance/AdvanceTypeCRUDController.java
index db08e3a24..926aba283 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/advance/AdvanceTypeCRUDController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/advance/AdvanceTypeCRUDController.java
@@ -40,7 +40,7 @@ import org.zkoss.zul.RowRenderer;
import java.math.BigDecimal;
import java.util.List;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Controller for CRUD actions over a {@link AdvanceType}.
@@ -72,12 +72,12 @@ public class AdvanceTypeCRUDController extends BaseCRUDController {
public Constraint lessThanDefaultMaxValue() {
return (comp, value) -> {
if (value == null) {
- throw new WrongValueException(comp, _("Value is not valid, the precision value must not be empty"));
+ throw new WrongValueException(comp, tr("Value is not valid, the precision value must not be empty"));
}
if (!(advanceTypeModel.isPrecisionValid((BigDecimal) value))) {
throw new WrongValueException(
- comp, _("Invalid value. Precission value must be lower than the Default Max value."));
+ comp, tr("Invalid value. Precission value must be lower than the Default Max value."));
}
};
}
@@ -88,12 +88,12 @@ public class AdvanceTypeCRUDController extends BaseCRUDController {
public Constraint greaterThanPrecision() {
return (comp, value) -> {
if (value == null) {
- throw new WrongValueException(comp, _("Invalid value. Default Max Value cannot be empty"));
+ throw new WrongValueException(comp, tr("Invalid value. Default Max Value cannot be empty"));
}
if (!(advanceTypeModel.isDefaultMaxValueValid((BigDecimal) value))) {
throw new WrongValueException(
comp,
- _("Value is not valid, the default max value must be greater than the precision value "));
+ tr("Value is not valid, the default max value must be greater than the precision value "));
}
};
}
@@ -104,13 +104,13 @@ public class AdvanceTypeCRUDController extends BaseCRUDController {
public Constraint distinctNames() {
return (comp, value) -> {
if (((String) value).isEmpty()) {
- throw new WrongValueException(comp, _("The name is not valid, the name must not be null "));
+ throw new WrongValueException(comp, tr("The name is not valid, the name must not be null "));
}
if (!advanceTypeModel.distinctNames((String) value)) {
throw new WrongValueException(
comp,
- _("The name is not valid, there is another progress type with the same name. "));
+ tr("The name is not valid, there is another progress type with the same name. "));
}
};
@@ -207,12 +207,12 @@ public class AdvanceTypeCRUDController extends BaseCRUDController {
@Override
protected String getEntityType() {
- return _("Progress Type");
+ return tr("Progress Type");
}
@Override
protected String getPluralEntityType() {
- return _("Progress Types");
+ return tr("Progress Types");
}
@Override
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/advance/AdvanceTypeModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/advance/AdvanceTypeModel.java
index 904362fdd..fa256a183 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/advance/AdvanceTypeModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/advance/AdvanceTypeModel.java
@@ -21,7 +21,7 @@
package org.libreplan.web.advance;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.math.BigDecimal;
import java.util.List;
@@ -86,7 +86,7 @@ public class AdvanceTypeModel implements IAdvanceTypeModel {
private void checkCanBeModified(AdvanceType advanceType) {
if (!canBeModified(advanceType)) {
- throw new IllegalArgumentException(_("Progress type cannot be modified"));
+ throw new IllegalArgumentException(tr("Progress type cannot be modified"));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/calendars/BaseCalendarCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/calendars/BaseCalendarCRUDController.java
index ae2c2c2a2..81fae2299 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/calendars/BaseCalendarCRUDController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/calendars/BaseCalendarCRUDController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.calendars;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.Date;
@@ -136,7 +136,7 @@ public class BaseCalendarCRUDController extends GenericForwardComposer {
baseCalendarModel.confirmSave();
messagesForUser.showMessage(
- Level.INFO, _("Base calendar \"{0}\" saved", baseCalendarModel.getBaseCalendar().getName()));
+ Level.INFO, tr("Base calendar \"{0}\" saved", baseCalendarModel.getBaseCalendar().getName()));
goToList();
} catch (ValidationException e) {
@@ -153,7 +153,7 @@ public class BaseCalendarCRUDController extends GenericForwardComposer {
baseCalendarModel.confirmSaveAndContinue();
messagesForUser.showMessage(
- Level.INFO, _("Base calendar \"{0}\" saved", baseCalendarModel.getBaseCalendar().getName()));
+ Level.INFO, tr("Base calendar \"{0}\" saved", baseCalendarModel.getBaseCalendar().getName()));
} catch (ValidationException e) {
messagesForUser.showInvalidValues(e);
@@ -315,7 +315,7 @@ public class BaseCalendarCRUDController extends GenericForwardComposer {
Treecell operationsTreecell = new Treecell();
Button createDerivedButton = new Button();
- createDerivedButton.setTooltiptext(_("Create derived"));
+ createDerivedButton.setTooltiptext(tr("Create derived"));
createDerivedButton.setSclass("icono");
createDerivedButton.setImage("/common/img/ico_derived1.png");
createDerivedButton.setHoverImage("/common/img/ico_derived.png");
@@ -324,7 +324,7 @@ public class BaseCalendarCRUDController extends GenericForwardComposer {
operationsTreecell.appendChild(createDerivedButton);
Button createCopyButton = new Button();
createCopyButton.setSclass("icono");
- createCopyButton.setTooltiptext(_("Create copy"));
+ createCopyButton.setTooltiptext(tr("Create copy"));
createCopyButton.setImage("/common/img/ico_copy1.png");
createCopyButton.setHoverImage("/common/img/ico_copy.png");
@@ -332,7 +332,7 @@ public class BaseCalendarCRUDController extends GenericForwardComposer {
operationsTreecell.appendChild(createCopyButton);
Button editButton = new Button();
- editButton.setTooltiptext(_("Edit"));
+ editButton.setTooltiptext(tr("Edit"));
editButton.setSclass("icono");
editButton.setImage("/common/img/ico_editar1.png");
editButton.setHoverImage("/common/img/ico_editar.png");
@@ -341,7 +341,7 @@ public class BaseCalendarCRUDController extends GenericForwardComposer {
operationsTreecell.appendChild(editButton);
Button removeButton = new Button();
- removeButton.setTooltiptext(_("Remove"));
+ removeButton.setTooltiptext(tr("Remove"));
removeButton.setSclass("icono");
removeButton.setImage("/common/img/ico_borrar1.png");
removeButton.setHoverImage("/common/img/ico_borrar.png");
@@ -367,14 +367,14 @@ public class BaseCalendarCRUDController extends GenericForwardComposer {
if (hasParent(calendar)) {
messagesForUser.showMessage(
- Level.ERROR, _("Calendar cannot be removed as it has other derived calendars from it"));
+ Level.ERROR, tr("Calendar cannot be removed as it has other derived calendars from it"));
return;
}
if (isDefault(calendar)) {
messagesForUser.showMessage(
Level.ERROR,
- _("Default calendar cannot be removed. "
+ tr("Default calendar cannot be removed. "
+ "Please, change the default calendar in the Main Settings window before."));
return;
}
@@ -388,7 +388,7 @@ public class BaseCalendarCRUDController extends GenericForwardComposer {
if (result == Messagebox.OK) {
final String calendarName = calendar.getName();
baseCalendarModel.confirmRemove(calendar);
- messagesForUser.showMessage(Level.INFO, _("Removed calendar \"{0}\"", calendarName));
+ messagesForUser.showMessage(Level.INFO, tr("Removed calendar \"{0}\"", calendarName));
Util.reloadBindings(listWindow);
}
}
@@ -396,8 +396,8 @@ public class BaseCalendarCRUDController extends GenericForwardComposer {
private int showConfirmDeleteCalendar(BaseCalendar calendar) {
return Messagebox.show(
- _("Confirm deleting {0}. Are you sure?", calendar.getName()),
- _("Delete"), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
+ tr("Confirm deleting {0}. Are you sure?", calendar.getName()),
+ tr("Delete"), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
}
private boolean isReferencedByOtherEntities(BaseCalendar calendar) {
@@ -412,7 +412,7 @@ public class BaseCalendarCRUDController extends GenericForwardComposer {
}
private void showCannotDeleteCalendarDialog(String message) {
- Messagebox.show(_(message), _("Warning"), Messagebox.OK, Messagebox.EXCLAMATION);
+ Messagebox.show(tr(message), tr("Warning"), Messagebox.OK, Messagebox.EXCLAMATION);
}
}
@@ -439,7 +439,7 @@ public class BaseCalendarCRUDController extends GenericForwardComposer {
public void updateWindowTitle() {
if (editWindow != null && state != CRUDControllerState.LIST) {
- String entityType = _("Calendar");
+ String entityType = tr("Calendar");
String humanId = getBaseCalendar().getHumanId();
String title;
@@ -448,14 +448,14 @@ public class BaseCalendarCRUDController extends GenericForwardComposer {
case CREATE:
if (StringUtils.isEmpty(humanId)) {
- title = _("Create {0}", entityType);
+ title = tr("Create {0}", entityType);
} else {
- title = _("Create {0}: {1}", entityType, humanId);
+ title = tr("Create {0}: {1}", entityType, humanId);
}
break;
case EDIT:
- title = _("Edit {0}: {1}", entityType, humanId);
+ title = tr("Edit {0}: {1}", entityType, humanId);
break;
default:
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/calendars/BaseCalendarEditionController.java b/libreplan-webapp/src/main/java/org/libreplan/web/calendars/BaseCalendarEditionController.java
index 9dc304b88..85974642b 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/calendars/BaseCalendarEditionController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/calendars/BaseCalendarEditionController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.calendars;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import static org.libreplan.web.common.Util.findOrCreate;
import java.text.DateFormatSymbols;
@@ -135,7 +135,7 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
private static String asString(Capacity capacity) {
String extraEffortString = capacity.isOverAssignableWithoutLimit()
- ? _("unl")
+ ? tr("unl")
: asString(capacity.getAllowedExtraEffort());
return asString(capacity.getStandardEffort()) + " [" + extraEffortString + "]";
@@ -205,8 +205,8 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
private Checkbox createUnlimitedCheckbox() {
Checkbox unlimited = new Checkbox();
- unlimited.setLabel(_("Unlimited"));
- unlimited.setTooltiptext(_("Infinitely Over Assignable"));
+ unlimited.setLabel(tr("Unlimited"));
+ unlimited.setTooltiptext(tr("Infinitely Over Assignable"));
return unlimited;
}
@@ -286,10 +286,10 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
String currentStartDate = this.getCurrentStartDateLabel();
String currentExpiringDate = this.getCurrentExpiringDateLabel();
- return _("Derived of calendar {0}", getNameParentCalendar()) + currentStartDate + currentExpiringDate;
+ return tr("Derived of calendar {0}", getNameParentCalendar()) + currentStartDate + currentExpiringDate;
}
- return _("Root calendar");
+ return tr("Root calendar");
}
private String getCurrentExpiringDateLabel() {
@@ -297,7 +297,7 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
String label = "";
if ( date != null ) {
- label = " " + _("to {0}", Util.formatDate(date));
+ label = " " + tr("to {0}", Util.formatDate(date));
}
return label;
@@ -308,7 +308,7 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
String label = "";
if ( date != null ) {
- label = " " + _("from {0}", Util.formatDate(date));
+ label = " " + tr("from {0}", Util.formatDate(date));
}
return label;
@@ -552,17 +552,17 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
CalendarException exceptionDay = calendar.getExceptionDay(date);
if ( exceptionDay != null ) {
if ( calendar.getOwnExceptionDay(date) != null ) {
- return _("Exception: {0}", exceptionDay.getType().getName());
+ return tr("Exception: {0}", exceptionDay.getType().getName());
} else {
- return _("Exception: {0} (Inh)", exceptionDay.getType().getName());
+ return tr("Exception: {0} (Inh)", exceptionDay.getType().getName());
}
}
if ( calendar.getCapacityOn(PartialDay.wholeDay(date)).isZero() ) {
- return _("Not workable day");
+ return tr("Not workable day");
}
- return _("Normal");
+ return tr("Normal");
}
public String getWorkableTime() {
@@ -574,7 +574,7 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
CalendarExceptionType type = exceptionTypes.getSelectedItem().getValue();
if ( type == null ) {
- throw new WrongValueException(exceptionTypes, _("Please, select type of exception"));
+ throw new WrongValueException(exceptionTypes, tr("Please, select type of exception"));
} else {
Clients.clearWrongValue(exceptionTypes);
}
@@ -583,7 +583,7 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
Date startDate = dateboxStartDate.getValue();
if ( startDate == null ) {
- throw new WrongValueException(dateboxStartDate, _("You should select a start date for the exception"));
+ throw new WrongValueException(dateboxStartDate, tr("You should select a start date for the exception"));
} else {
Clients.clearWrongValue(dateboxStartDate);
}
@@ -592,14 +592,14 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
Date endDate = dateboxEndDate.getValue();
if ( endDate == null ) {
- throw new WrongValueException(dateboxEndDate, _("Please, select an End Date for the Exception"));
+ throw new WrongValueException(dateboxEndDate, tr("Please, select an End Date for the Exception"));
} else {
Clients.clearWrongValue(dateboxEndDate);
}
if ( new LocalDate(startDate).compareTo(new LocalDate(endDate)) > 0 ) {
throw new WrongValueException(dateboxEndDate,
- _("Exception end date should be greater or equals than start date"));
+ tr("Exception end date should be greater or equals than start date"));
} else {
Clients.clearWrongValue(dateboxEndDate);
}
@@ -662,7 +662,7 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
if ( parent == null ) {
summary.add("0");
} else {
- summary.add(_("Inh"));
+ summary.add(tr("Inh"));
}
} else {
summary.add(asString(version.getCapacityOn(day)));
@@ -816,7 +816,7 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
private Button createRemoveButton(final CalendarData calendarData) {
Button result = createButton(
"/common/img/ico_borrar1.png",
- _("Delete"),
+ tr("Delete"),
"/common/img/ico_borrar.png",
"icono",
@@ -913,7 +913,7 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
if ( isDerived() ) {
Combobox parentCalendars = (Combobox) createNewVersionWindow.getFellow("parentCalendars");
if ( parentCalendars.getSelectedItem() == null ) {
- throw new WrongValueException(parentCalendars, _("cannot be empty"));
+ throw new WrongValueException(parentCalendars, tr("cannot be empty"));
}
selected = parentCalendars.getSelectedItem().getValue();
}
@@ -922,9 +922,9 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
baseCalendarModel.createNewVersion(startDate, expiringDate, selected);
} catch (IllegalArgumentException e) {
if ( e.getMessage().contains("Wrong expiring date") ) {
- throw new WrongValueException(compExpiringDate, _(e.getMessage()));
+ throw new WrongValueException(compExpiringDate, tr(e.getMessage()));
} else {
- throw new WrongValueException(compStartDate, _(e.getMessage()));
+ throw new WrongValueException(compStartDate, tr(e.getMessage()));
}
}
@@ -1037,13 +1037,13 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
private void appendStandardEffortListcell(Listitem item, Capacity capacity) {
Listcell listcell = new Listcell();
- listcell.appendChild(new Label(_(capacity.getStandardEffortString())));
+ listcell.appendChild(new Label(tr(capacity.getStandardEffortString())));
item.appendChild(listcell);
}
private void appendExtraEffortListcell(Listitem item, Capacity capacity) {
Listcell listcell = new Listcell();
- listcell.appendChild(new Label(_(capacity.getExtraEffortString())));
+ listcell.appendChild(new Label(tr(capacity.getExtraEffortString())));
item.appendChild(listcell);
}
@@ -1077,7 +1077,7 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
}
});
- code.setConstraint("no empty:" + _("cannot be empty"));
+ code.setConstraint("no empty:" + tr("cannot be empty"));
listcell.appendChild(code);
item.appendChild(listcell);
@@ -1085,10 +1085,10 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
private void appendOriginListcell(Listitem item, CalendarException calendarException) {
Listcell listcell = new Listcell();
- String origin = _("Inherited");
+ String origin = tr("Inherited");
if ( baseCalendarModel.isOwnException(calendarException) )
- origin = _("Direct");
+ origin = tr("Direct");
listcell.appendChild(new Label(origin));
item.appendChild(listcell);
@@ -1103,7 +1103,7 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
private Button createRemoveButton(final CalendarException calendarException) {
Button result = createButton(
"/common/img/ico_borrar1.png",
- _("Delete"),
+ tr("Delete"),
"/common/img/ico_borrar.png",
"icono",
event -> {
@@ -1113,7 +1113,7 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
if ( !baseCalendarModel.isOwnException(calendarException) ) {
result.setDisabled(true);
- result.setTooltiptext(_("inherited exception can not be removed"));
+ result.setTooltiptext(tr("inherited exception can not be removed"));
}
return result;
@@ -1151,7 +1151,7 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
Date startDate = dateboxStartDate.getValue();
if ( startDate == null ) {
- throw new WrongValueException(dateboxStartDate, _("You should select a start date for the exception"));
+ throw new WrongValueException(dateboxStartDate, tr("You should select a start date for the exception"));
} else {
Clients.clearWrongValue(dateboxStartDate);
}
@@ -1160,14 +1160,14 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
Date endDate = dateboxEndDate.getValue();
if ( endDate == null ) {
- throw new WrongValueException(dateboxEndDate, _("Please, select an End Date for the Exception"));
+ throw new WrongValueException(dateboxEndDate, tr("Please, select an End Date for the Exception"));
} else {
Clients.clearWrongValue(dateboxEndDate);
}
if ( startDate.compareTo(endDate) > 0 ) {
throw new WrongValueException(dateboxEndDate,
- _("Exception end date should be greater or equals than start date"));
+ tr("Exception end date should be greater or equals than start date"));
} else {
Clients.clearWrongValue(dateboxEndDate);
}
@@ -1267,7 +1267,7 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
if (baseCalendarModel.isLastActivationPeriod(calendarAvailability)) {
return null;
} else {
- throw new IllegalArgumentException(_("End date can only be deleted in the last activation"));
+ throw new IllegalArgumentException(tr("End date can only be deleted in the last activation"));
}
}
@@ -1294,7 +1294,7 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
}
});
- code.setConstraint("no empty:" + _("cannot be empty"));
+ code.setConstraint("no empty:" + tr("cannot be empty"));
listcell.appendChild(code);
item.appendChild(listcell);
@@ -1309,7 +1309,7 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
private Button createRemoveButton(final CalendarAvailability calendarAvailability) {
return createButton(
"/common/img/ico_borrar1.png",
- _("Delete"),
+ tr("Delete"),
"/common/img/ico_borrar.png",
"icono",
event -> {
@@ -1365,7 +1365,7 @@ public abstract class BaseCalendarEditionController extends GenericForwardCompos
Textbox code = (Textbox) (item.getChildren().get(3)).getFirstChild();
if ( code != null && !code.isDisabled() && code.getValue().isEmpty() ) {
- throw new WrongValueException(code, _("It cannot be empty"));
+ throw new WrongValueException(code, tr("It cannot be empty"));
}
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/calendars/BaseCalendarModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/calendars/BaseCalendarModel.java
index c248363ae..97ed5b819 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/calendars/BaseCalendarModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/calendars/BaseCalendarModel.java
@@ -22,7 +22,7 @@
package org.libreplan.web.calendars;
import static org.libreplan.business.common.exceptions.ValidationException.invalidValue;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.Date;
import java.util.HashSet;
@@ -485,7 +485,7 @@ public class BaseCalendarModel extends IntegrationEntityModel implements IBaseCa
if (version.equals(getBaseCalendar().getFirstCalendarData())) {
return;
} else {
- throw new ValidationException(_("This date cannot be empty"));
+ throw new ValidationException(tr("This date cannot be empty"));
}
}
@@ -505,7 +505,7 @@ public class BaseCalendarModel extends IntegrationEntityModel implements IBaseCa
}
}
throw new ValidationException(
- _("This date can not include the whole previous work week"));
+ tr("This date can not include the whole previous work week"));
}
@Override
@@ -517,7 +517,7 @@ public class BaseCalendarModel extends IntegrationEntityModel implements IBaseCa
if (version.equals(getBaseCalendar().getLastCalendarData())) {
return;
} else {
- throw new ValidationException(_("This date cannot be empty"));
+ throw new ValidationException(tr("This date cannot be empty"));
}
}
@@ -531,7 +531,7 @@ public class BaseCalendarModel extends IntegrationEntityModel implements IBaseCa
}
}
throw new ValidationException(
- _("Date cannot include the entire next work week"));
+ tr("Date cannot include the entire next work week"));
}
@Override
@@ -598,8 +598,8 @@ public class BaseCalendarModel extends IntegrationEntityModel implements IBaseCa
public void checkInvalidValuesCalendar(BaseCalendar entity)
throws ValidationException {
if (baseCalendarDAO.thereIsOtherWithSameName(entity)) {
- throw new ValidationException(_("Could not save the new calendar"),
- invalidValue(_("{0} already exists", entity.getName()),
+ throw new ValidationException(tr("Could not save the new calendar"),
+ invalidValue(tr("{0} already exists", entity.getName()),
"name", entity.getName(), entity));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/BaseCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/BaseCRUDController.java
index 7be8358d6..d4d7bd7e2 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/BaseCRUDController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/BaseCRUDController.java
@@ -19,7 +19,7 @@
package org.libreplan.web.common;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import org.apache.commons.lang3.StringUtils;
import org.libreplan.business.common.IHumanIdentifiable;
@@ -82,7 +82,7 @@ public abstract class BaseCRUDController extends G
messagesForUser = new MessagesForUser(messagesContainer);
- listWindow.setTitle(_("{0} List", getPluralEntityType()));
+ listWindow.setTitle(tr("{0} List", getPluralEntityType()));
showListWindow();
}
@@ -126,13 +126,13 @@ public abstract class BaseCRUDController extends G
case CREATE:
if (StringUtils.isEmpty(humanId))
- title = _("Create {0}", getEntityType());
+ title = tr("Create {0}", getEntityType());
else
- title = _("Create {0}: {1}", getEntityType(), humanId);
+ title = tr("Create {0}: {1}", getEntityType(), humanId);
break;
case EDIT:
- title = _("Edit {0}: {1}", getEntityType(), humanId);
+ title = tr("Edit {0}: {1}", getEntityType(), humanId);
break;
default:
@@ -230,7 +230,7 @@ public abstract class BaseCRUDController extends G
beforeSaving();
messagesForUser.clearMessages();
save();
- messagesForUser.showMessage(Level.INFO, _("{0} \"{1}\" saved", getEntityType(), getEntityBeingEdited().getHumanId()));
+ messagesForUser.showMessage(Level.INFO, tr("{0} \"{1}\" saved", getEntityType(), getEntityBeingEdited().getHumanId()));
}
/**
@@ -303,21 +303,21 @@ public abstract class BaseCRUDController extends G
try {
if (Messagebox.show(
- _("Delete {0} \"{1}\". Are you sure?", getEntityType(), entity.getHumanId()),
- _("Confirm"), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION) == Messagebox.OK) {
+ tr("Delete {0} \"{1}\". Are you sure?", getEntityType(), entity.getHumanId()),
+ tr("Confirm"), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION) == Messagebox.OK) {
delete(entity);
messagesForUser.showMessage(
Level.INFO,
- _("{0} \"{1}\" deleted", getEntityType(), entity.getHumanId()));
+ tr("{0} \"{1}\" deleted", getEntityType(), entity.getHumanId()));
Util.reloadBindings(listWindow);
}
} catch (InstanceNotFoundException ie) {
messagesForUser.showMessage(
Level.ERROR,
- _("{0} \"{1}\" could not be deleted, it was already removed", getEntityType(), entity.getHumanId()));
+ tr("{0} \"{1}\" could not be deleted, it was already removed", getEntityType(), entity.getHumanId()));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/ConfigurationController.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/ConfigurationController.java
index ec80a2248..4e4b08243 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/ConfigurationController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/ConfigurationController.java
@@ -63,7 +63,7 @@ import javax.ws.rs.core.Response.Status;
import java.io.*;
import java.util.*;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Controller for {@link Configuration} entity.
@@ -243,7 +243,7 @@ public class ConfigurationController extends GenericForwardComposer {
!areEmailFieldsValid() ) {
messages.clearMessages();
- messages.showMessage(Level.ERROR, _("Check all fields"));
+ messages.showMessage(Level.ERROR, tr("Check all fields"));
} else {
ConstraintChecker.isValid(configurationWindow);
@@ -251,7 +251,7 @@ public class ConfigurationController extends GenericForwardComposer {
try {
configurationModel.confirm();
configurationModel.init();
- messages.showMessage(Level.INFO, _("Changes saved"));
+ messages.showMessage(Level.INFO, tr("Changes saved"));
// Send data to server
if (!SecurityUtils.isGatheredStatsAlreadySent && (configurationDAO.getConfigurationWithReadOnlyTransaction() == null || configurationDAO.getConfigurationWithReadOnlyTransaction().isAllowedToGatherUsageStatsEnabled())) {
@@ -262,7 +262,7 @@ public class ConfigurationController extends GenericForwardComposer {
!configurationModel.scheduleOrUnscheduleJobs(getSelectedConnector())) {
messages.showMessage(Level.ERROR,
- _("Scheduling or unscheduling of jobs for this connector is not completed"));
+ tr("Scheduling or unscheduling of jobs for this connector is not completed"));
}
reloadWindow();
@@ -291,7 +291,7 @@ public class ConfigurationController extends GenericForwardComposer {
public void cancel() {
configurationModel.cancel();
messages.clearMessages();
- messages.showMessage(Level.INFO, _("Changes have been canceled"));
+ messages.showMessage(Level.INFO, tr("Changes have been canceled"));
reloadWindow();
reloadEntitySequences();
reloadConnectors();
@@ -326,10 +326,10 @@ public class ConfigurationController extends GenericForwardComposer {
new EqualsFilter(configurationModel.getLdapConfiguration().getLdapUserId(), "test").toString(),
"test");
- messages.showMessage(Level.INFO, _("LDAP connection was successful"));
+ messages.showMessage(Level.INFO, tr("LDAP connection was successful"));
} catch (Exception e) {
LOG.info(e);
- messages.showMessage(Level.ERROR, _("Cannot connect to LDAP server"));
+ messages.showMessage(Level.ERROR, tr("Cannot connect to LDAP server"));
}
}
@@ -341,7 +341,7 @@ public class ConfigurationController extends GenericForwardComposer {
*/
public void testConnection() {
if (selectedConnector == null) {
- messages.showMessage(Level.ERROR, _("Please select a connector to test it"));
+ messages.showMessage(Level.ERROR, tr("Please select a connector to test it"));
return;
}
@@ -379,9 +379,9 @@ public class ConfigurationController extends GenericForwardComposer {
*/
private void testTimConnection(String url, String username, String password) {
if ( TimSoapClient.checkAuthorization(url, username, password) ) {
- messages.showMessage(Level.INFO, _("Tim connection was successful"));
+ messages.showMessage(Level.INFO, tr("Tim connection was successful"));
} else {
- messages.showMessage(Level.ERROR, _("Cannot connet to Tim server"));
+ messages.showMessage(Level.ERROR, tr("Cannot connet to Tim server"));
}
}
@@ -407,15 +407,15 @@ public class ConfigurationController extends GenericForwardComposer {
Response response = client.get();
if ( response.getStatus() == Status.OK.getStatusCode() ) {
- messages.showMessage(Level.INFO, _("JIRA connection was successful"));
+ messages.showMessage(Level.INFO, tr("JIRA connection was successful"));
} else {
LOG.error("Status code: " + response.getStatus());
- messages.showMessage(Level.ERROR, _("Cannot connect to JIRA server"));
+ messages.showMessage(Level.ERROR, tr("Cannot connect to JIRA server"));
}
} catch (Exception e) {
LOG.error(e);
- messages.showMessage(Level.ERROR, _("Cannot connect to JIRA server"));
+ messages.showMessage(Level.ERROR, tr("Cannot connect to JIRA server"));
}
}
@@ -462,26 +462,26 @@ public class ConfigurationController extends GenericForwardComposer {
messages.clearMessages();
if (transport != null) {
if ( transport.isConnected() ) {
- messages.showMessage(Level.INFO, _("Connection successful!"));
+ messages.showMessage(Level.INFO, tr("Connection successful!"));
}
else if ( !transport.isConnected() ) {
- messages.showMessage(Level.WARNING, _("Connection unsuccessful"));
+ messages.showMessage(Level.WARNING, tr("Connection unsuccessful"));
}
}
}
catch (AuthenticationFailedException e) {
messages.clearMessages();
- messages.showMessage(Level.ERROR, _("Invalid credentials"));
+ messages.showMessage(Level.ERROR, tr("Invalid credentials"));
}
catch (MessagingException e) {
LOG.error(e);
messages.clearMessages();
- messages.showMessage(Level.ERROR, _("Cannot connect"));
+ messages.showMessage(Level.ERROR, tr("Cannot connect"));
}
catch (Exception e) {
LOG.error(e);
messages.clearMessages();
- messages.showMessage(Level.ERROR, _("Failed to connect"));
+ messages.showMessage(Level.ERROR, tr("Failed to connect"));
}
}
@@ -510,7 +510,7 @@ public class ConfigurationController extends GenericForwardComposer {
} catch (IllegalArgumentException e) {
throw new WrongValueException(
digitsBox,
- _("number of digits must be between {0} and {1}",
+ tr("number of digits must be between {0} and {1}",
EntitySequence.MIN_NUMBER_OF_DIGITS, EntitySequence.MAX_NUMBER_OF_DIGITS));
}
}
@@ -818,7 +818,7 @@ public class ConfigurationController extends GenericForwardComposer {
@Override
public void render(Listitem listitem, Object o, int i) throws Exception {
ProgressType progressType = (ProgressType) o;
- listitem.setLabel(_(progressType.getValue()));
+ listitem.setLabel(tr(progressType.getValue()));
listitem.setValue(progressType);
}
}
@@ -830,7 +830,7 @@ public class ConfigurationController extends GenericForwardComposer {
final EntityNameEnum entityName = entitySequence.getEntityName();
row.setValue(entityName);
- row.appendChild(new Label(_("{0} sequences", entityName.getDescription())));
+ row.appendChild(new Label(tr("{0} sequences", entityName.getDescription())));
row.setValue(entitySequence);
appendActiveRadiobox(row, entitySequence);
@@ -840,7 +840,7 @@ public class ConfigurationController extends GenericForwardComposer {
appendOperations(row, entitySequence);
if ( entitySequence.isAlreadyInUse() ) {
- row.setTooltiptext(_("Code sequence is already in use and cannot be updated"));
+ row.setTooltiptext(tr("Code sequence is already in use and cannot be updated"));
}
if ( (row.getPreviousSibling() != null) &&
@@ -902,7 +902,7 @@ public class ConfigurationController extends GenericForwardComposer {
} catch (IllegalArgumentException e) {
throw new WrongValueException(
tempIntbox,
- _("number of digits must be between {0} and {1}",
+ tr("number of digits must be between {0} and {1}",
EntitySequence.MIN_NUMBER_OF_DIGITS, EntitySequence.MAX_NUMBER_OF_DIGITS));
}
});
@@ -967,10 +967,10 @@ public class ConfigurationController extends GenericForwardComposer {
if ( !configurationModel.checkPrefixFormat(sequence) ) {
String message =
- _("Invalid format prefix. Format prefix cannot be empty, contain '_' or contain whitespaces.");
+ tr("Invalid format prefix. Format prefix cannot be empty, contain '_' or contain whitespaces.");
if ( sequence.getEntityName().canContainLowBar() ) {
- message = _("format prefix invalid. It cannot be empty or contain whitespaces.");
+ message = tr("format prefix invalid. It cannot be empty or contain whitespaces.");
}
return message;
@@ -990,7 +990,7 @@ public class ConfigurationController extends GenericForwardComposer {
} catch (IllegalArgumentException e) {
throw new WrongValueException(
comp,
- _("number of digits must be between {0} and {1}",
+ tr("number of digits must be between {0} and {1}",
EntitySequence.MIN_NUMBER_OF_DIGITS, EntitySequence.MAX_NUMBER_OF_DIGITS));
}
}
@@ -1012,7 +1012,7 @@ public class ConfigurationController extends GenericForwardComposer {
private void showMessageNotDelete() {
Messagebox.show(
- _("It can not be deleted. At least one sequence is necessary."), _("Deleting sequence"),
+ tr("It can not be deleted. At least one sequence is necessary."), tr("Deleting sequence"),
Messagebox.OK, Messagebox.INFORMATION);
}
@@ -1041,11 +1041,11 @@ public class ConfigurationController extends GenericForwardComposer {
public void addNewEntitySequence() {
if ( entityCombo != null && numDigitBox != null ) {
if ( entityCombo.getSelectedItem() == null ) {
- throw new WrongValueException(entityCombo, _("Select entity, please"));
+ throw new WrongValueException(entityCombo, tr("Select entity, please"));
}
if ( prefixBox.getValue() == null || prefixBox.getValue().isEmpty() ) {
- throw new WrongValueException(prefixBox, _("cannot be empty"));
+ throw new WrongValueException(prefixBox, tr("cannot be empty"));
}
try {
@@ -1247,7 +1247,7 @@ public class ConfigurationController extends GenericForwardComposer {
public ListitemRenderer getPersonalTimesheetsPeriodicityRenderer() {
return (listitem, o, i) -> {
PersonalTimesheetsPeriodicityEnum periodicity = (PersonalTimesheetsPeriodicityEnum) o;
- listitem.setLabel(_(periodicity.getName()));
+ listitem.setLabel(tr(periodicity.getName()));
listitem.setValue(periodicity);
};
}
@@ -1280,7 +1280,7 @@ public class ConfigurationController extends GenericForwardComposer {
*/
public String getPersonalTimesheetsPeriodicityTooltip() {
return isPersonalTimesheetsPeriodicityDisabled()
- ? _("Periocity cannot be changed because there is already any personal timesheet stored")
+ ? tr("Periocity cannot be changed because there is already any personal timesheet stored")
: "";
}
@@ -1352,7 +1352,7 @@ public class ConfigurationController extends GenericForwardComposer {
ConnectorProperty property = (ConnectorProperty) o;
row.setValue(property);
- Util.appendLabel(row, _(property.getKey()));
+ Util.appendLabel(row, tr(property.getKey()));
if ("Protocol".equals(property.getKey())) {
appendValueCombobox(row, property);
@@ -1439,7 +1439,7 @@ public class ConfigurationController extends GenericForwardComposer {
return (comp, value) -> {
if ( key.equals(PredefinedConnectorProperties.ACTIVATED) ) {
if ( !"Y".equalsIgnoreCase((String) value) && !"N".equalsIgnoreCase((String) value)) {
- throw new WrongValueException(comp, _("Only {0} allowed", "Y/N"));
+ throw new WrongValueException(comp, tr("Only {0} allowed", "Y/N"));
}
} else if ( key.equals(PredefinedConnectorProperties.SERVER_URL) ||
key.equals(PredefinedConnectorProperties.USERNAME) ||
@@ -1450,14 +1450,14 @@ public class ConfigurationController extends GenericForwardComposer {
key.equals(PredefinedConnectorProperties.EMAIL_SENDER) ||
key.equals(PredefinedConnectorProperties.PROTOCOL) ) {
- ((InputElement) comp).setConstraint("no empty:" + _("cannot be empty"));
+ ((InputElement) comp).setConstraint("no empty:" + tr("cannot be empty"));
} else if ( key.equals(PredefinedConnectorProperties.TIM_NR_DAYS_TIMESHEET) ||
key.equals(PredefinedConnectorProperties.TIM_NR_DAYS_ROSTER) ||
key.equals(PredefinedConnectorProperties.PORT) ) {
if ( !isNumeric((String) value) ) {
- throw new WrongValueException(comp, _("Only digits allowed"));
+ throw new WrongValueException(comp, tr("Only digits allowed"));
}
}
};
@@ -1561,7 +1561,7 @@ public class ConfigurationController extends GenericForwardComposer {
((org.zkoss.zul.Image) configurationWindow.getFellow(LOGO_PREVIEW_COMPONENT)).setContent(Util.logo);
} else {
- messages.showMessage(Level.WARNING, _("The only current supported formats are png and jpeg"));
+ messages.showMessage(Level.WARNING, tr("The only current supported formats are png and jpeg"));
}
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/ConfigurationModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/ConfigurationModel.java
index 963463ec9..eff4900ef 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/ConfigurationModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/ConfigurationModel.java
@@ -21,7 +21,7 @@
package org.libreplan.web.common;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.Collection;
@@ -199,15 +199,15 @@ public class ConfigurationModel implements IConfigurationModel {
String entity = entityName.getDescription();
List sequences = entitySequences.get(entityName);
if (sequences.isEmpty()) {
- throw new ValidationException(_("At least one {0} sequence is needed", entity));
+ throw new ValidationException(tr("At least one {0} sequence is needed", entity));
}
if (!isAnyActive(sequences)) {
- throw new ValidationException(_("At least one {0} sequence must be active", entity));
+ throw new ValidationException(tr("At least one {0} sequence must be active", entity));
}
if (!checkConstraintPrefixNotRepeated(sequences)) {
- throw new ValidationException(_(
+ throw new ValidationException(tr(
"The {0} sequence prefixes cannot be repeated", entityName.getDescription()));
}
}
@@ -251,7 +251,7 @@ public class ConfigurationModel implements IConfigurationModel {
try {
entitySequenceDAO.remove(entitySequence);
} catch (InstanceNotFoundException e) {
- throw new ValidationException(_("Some sequences to be removed do not exist"));
+ throw new ValidationException(tr("Some sequences to be removed do not exist"));
} catch (IllegalArgumentException e) {
throw new ValidationException(e.getMessage());
}
@@ -578,8 +578,12 @@ public class ConfigurationModel implements IConfigurationModel {
Map currencies = new TreeMap<>();
for (Locale locale : Locale.getAvailableLocales()) {
if (StringUtils.isNotBlank(locale.getCountry())) {
- Currency currency = Currency.getInstance(locale);
- currencies.put(currency.getCurrencyCode(), currency.getSymbol(locale));
+ try {
+ Currency currency = Currency.getInstance(locale);
+ currencies.put(currency.getCurrencyCode(), currency.getSymbol(locale));
+ } catch (IllegalArgumentException e) {
+ // Skip locales without a valid currency (e.g., Antarctica)
+ }
}
}
return currencies;
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/CustomMenuController.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/CustomMenuController.java
index a0be6255d..f4e707418 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/CustomMenuController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/CustomMenuController.java
@@ -23,7 +23,7 @@
package org.libreplan.web.common;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.Collection;
@@ -287,287 +287,287 @@ public class CustomMenuController extends Div implements IMenuItemsRegister {
if ( SecurityUtils.isSuperuserOrRolePlanningOrHasAnyAuthorization() ) {
planningItems.add(subItem(
- _("Company view"),
+ tr("Company view"),
() -> globalView.goToCompanyScheduling(),
"01-introducion.html"));
planningItems.add(subItem(
- _("Projects"),
+ tr("Projects"),
() -> globalView.goToOrdersList(),
"01-introducion.html#id2"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_PLANNING) ) {
planningItems.add(subItem(
- _("Resources Load"),
+ tr("Resources Load"),
() -> globalView.goToCompanyLoad(),
"01-introducion.html#id1"));
planningItems.add(subItem(
- _("Queue-based Resources"),
+ tr("Queue-based Resources"),
() -> globalView.goToLimitingResources(),
"01-introducion.html"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_TEMPLATES) ) {
- planningItems.add(subItem(_("Templates"), "/templates/templates.zul", ""));
+ planningItems.add(subItem(tr("Templates"), "/templates/templates.zul", ""));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_IMPORT_PROJECTS) ) {
// In order of see the Import project option in the menu
- planningItems.add(subItem(_("Import project"), "/orders/imports/projectImport.zul", ""));
+ planningItems.add(subItem(tr("Import project"), "/orders/imports/projectImport.zul", ""));
}
if ( !planningItems.isEmpty() ) {
- topItem(_("Planning"), "/planner/index.zul", "", planningItems);
+ topItem(tr("Planning"), "/planner/index.zul", "", planningItems);
}
List resourcesItems = new ArrayList<>();
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_WORKERS) ) {
resourcesItems.add(subItem(
- _("Workers"),
+ tr("Workers"),
"/resources/worker/worker.zul",
"05-recursos.html#xesti-n-de-traballadores"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_MACHINES) ) {
resourcesItems.add(subItem(
- _("Machines"),
+ tr("Machines"),
"/resources/machine/machines.zul",
"05-recursos.html#xesti-n-de-m-quinas"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_VIRTUAL_WORKERS) ) {
resourcesItems.add(subItem(
- _("Virtual Workers"),
+ tr("Virtual Workers"),
"/resources/worker/virtualWorkers.zul",
"05-recursos.html#xesti-n-de-traballadores"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_CALENDARS) ) {
- resourcesItems.add(subItem(_("Calendars"), "/calendars/calendars.zul", "03-calendarios.html"));
+ resourcesItems.add(subItem(tr("Calendars"), "/calendars/calendars.zul", "03-calendarios.html"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_CALENDAR_EXCEPTION_DAYS) ) {
- resourcesItems.add(subItem(_("Calendar Exception Days"), "/excetiondays/exceptionDays.zul", ""));
+ resourcesItems.add(subItem(tr("Calendar Exception Days"), "/excetiondays/exceptionDays.zul", ""));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_CRITERIA) ) {
- resourcesItems.add(subItem(_("Criteria"), "/resources/criterions/criterions.zul", "02-criterios.html#id1"));
+ resourcesItems.add(subItem(tr("Criteria"), "/resources/criterions/criterions.zul", "02-criterios.html#id1"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_PROGRESS_TYPES) ) {
- resourcesItems.add(subItem(_("Progress Types"), "/advance/advanceTypes.zul", "04-avances.html#id1"));
+ resourcesItems.add(subItem(tr("Progress Types"), "/advance/advanceTypes.zul", "04-avances.html#id1"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_LABELS) ) {
- resourcesItems.add(subItem(_("Labels"), "/labels/labelTypes.zul", "10-etiquetas.html"));
+ resourcesItems.add(subItem(tr("Labels"), "/labels/labelTypes.zul", "10-etiquetas.html"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_MATERIALS) ) {
resourcesItems.add(subItem(
- _("Materials"),
+ tr("Materials"),
"/materials/materials.zul",
"11-materiales.html#administraci-n-de-materiais"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_MATERIAL_UNITS) ) {
resourcesItems.add(subItem(
- _("Material Units"),
+ tr("Material Units"),
"/unittypes/unitTypes.zul",
"11-materiales.html#administraci-n-de-materiais"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_QUALITY_FORMS) ) {
resourcesItems.add(subItem(
- _("Quality Forms"),
+ tr("Quality Forms"),
"/qualityforms/qualityForms.zul",
"12-formularios-calidad.html#administraci-n-de-formularios-de-calidade"));
}
if ( !resourcesItems.isEmpty() ) {
- topItem(_("Resources"), "/resources/worker/worker.zul", "", resourcesItems);
+ topItem(tr("Resources"), "/resources/worker/worker.zul", "", resourcesItems);
}
List costItems = new ArrayList<>();
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_TIMESHEETS) ) {
- costItems.add(subItem(_("Timesheets"), "/workreports/workReport.zul", "09-partes.html#id3"));
+ costItems.add(subItem(tr("Timesheets"), "/workreports/workReport.zul", "09-partes.html#id3"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_TIMESHEETS_TEMPLATES) ) {
costItems.add(subItem(
- _("Timesheets Templates"),
+ tr("Timesheets Templates"),
"/workreports/workReportTypes.zul",
"09-partes.html#id2"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_TIMESHEET_LINES_LIST) ) {
costItems.add(subItem(
- _("Timesheet Lines List"),
+ tr("Timesheet Lines List"),
"/workreports/workReportQuery.zul",
"09-partes.html#id4"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_EXPENSES) ) {
- costItems.add(subItem(_("Expenses"), "/expensesheet/expenseSheet.zul", ""));
+ costItems.add(subItem(tr("Expenses"), "/expensesheet/expenseSheet.zul", ""));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_COST_CATEGORIES) ) {
costItems.add(subItem(
- _("Cost Categories"),
+ tr("Cost Categories"),
"/costcategories/costCategory.zul",
"14-custos.html#categor-as-de-custo"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_HOURS_TYPES) ) {
costItems.add(subItem(
- _("Hours Types"),
+ tr("Hours Types"),
"/typeofworkhours/typeOfWorkHours.zul",
"14-custos.html#administraci-n-de-horas-traballadas"));
}
if ( !costItems.isEmpty() ) {
- topItem(_("Cost"), "/workreports/workReport.zul", "", costItems);
+ topItem(tr("Cost"), "/workreports/workReport.zul", "", costItems);
}
List configurationItems = new ArrayList<>();
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_MAIN_SETTINGS) ) {
configurationItems.add(subItem(
- _("Main Settings"),
+ tr("Main Settings"),
"/common/configuration.zul",
"16-ldap-authentication.html"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_USER_ACCOUNTS) ) {
configurationItems.add(subItem(
- _("User Accounts"),
+ tr("User Accounts"),
"/users/users.zul",
"13-usuarios.html#administraci-n-de-usuarios"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_PROFILES) ) {
configurationItems.add(subItem(
- _("Profiles"),
+ tr("Profiles"),
"/profiles/profiles.zul",
"13-usuarios.html#administraci-n-de-perfiles"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_JOB_SCHEDULING) ) {
- configurationItems.add(subItem(_("Job Scheduling"), "/common/jobScheduling.zul", "19-scheduler.html"));
+ configurationItems.add(subItem(tr("Job Scheduling"), "/common/jobScheduling.zul", "19-scheduler.html"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_EDIT_EMAIL_TEMPLATES) ) {
configurationItems.add(subItem(
- _("Edit E-mail Templates"),
+ tr("Edit E-mail Templates"),
"/email/email_templates.zul",
"email-templates.html"));
}
if ( !configurationItems.isEmpty() ) {
- topItem(_("Configuration"), "/common/configuration.zul", "", configurationItems);
+ topItem(tr("Configuration"), "/common/configuration.zul", "", configurationItems);
}
List communicationsItems = new ArrayList<>();
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_COMPANIES) ) {
- communicationsItems.add(subItem(_("Companies"), "/externalcompanies/externalcompanies.zul", ""));
+ communicationsItems.add(subItem(tr("Companies"), "/externalcompanies/externalcompanies.zul", ""));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_SEND_TO_SUBCONTRACTORS) ) {
- communicationsItems.add(subItem(_("Send To Subcontractors"), "/subcontract/subcontractedTasks.zul", ""));
+ communicationsItems.add(subItem(tr("Send To Subcontractors"), "/subcontract/subcontractedTasks.zul", ""));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_RECEIVED_FROM_SUBCONTRACTORS) ) {
communicationsItems.add(subItem(
- _("Received From Subcontractors"),
+ tr("Received From Subcontractors"),
"/subcontract/subcontractorCommunications.zul",
""));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_SEND_TO_CUSTOMERS) ) {
- communicationsItems.add(subItem(_("Send To Customers"), "/subcontract/reportAdvances.zul", ""));
+ communicationsItems.add(subItem(tr("Send To Customers"), "/subcontract/reportAdvances.zul", ""));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_RECEIVED_FROM_CUSTOMERS) ) {
communicationsItems.add(subItem(
- _("Received From Customers"),
+ tr("Received From Customers"),
"/subcontract/customerCommunications.zul", ""));
}
if ( !communicationsItems.isEmpty() ) {
- topItem(_("Communications"), "/externalcompanies/externalcompanies.zul", "", communicationsItems);
+ topItem(tr("Communications"), "/externalcompanies/externalcompanies.zul", "", communicationsItems);
}
List reportsItems = new ArrayList<>();
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_HOURS_WORKED_PER_RESOURCE_REPORT) ) {
reportsItems.add(subItem(
- _("Hours Worked Per Resource"),
+ tr("Hours Worked Per Resource"),
"/reports/hoursWorkedPerWorkerReport.zul",
"15-1-report-hours-worked-by-resource.html"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_TOTAL_WORKED_HOURS_BY_RESOURCE_IN_A_MONTH_REPORT) ) {
reportsItems.add(subItem(
- _("Total Worked Hours By Resource In A Month"),
+ tr("Total Worked Hours By Resource In A Month"),
"/reports/hoursWorkedPerWorkerInAMonthReport.zul",
"15-2-total-hours-by-resource-month.html"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_WORK_AND_PROGRESS_PER_PROJECT_REPORT) ) {
reportsItems.add(subItem(
- _("Work And Progress Per Project"),
+ tr("Work And Progress Per Project"),
"/reports/schedulingProgressPerOrderReport.zul",
"15-3-work-progress-per-project.html"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_WORK_AND_PROGRESS_PER_TASK_REPORT) ) {
reportsItems.add(subItem(
- _("Work And Progress Per Task"),
+ tr("Work And Progress Per Task"),
"/reports/workingProgressPerTaskReport.zul",
"15-informes.html"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_ESTIMATED_PLANNED_HOURS_PER_TASK_REPORT) ) {
reportsItems.add(subItem(
- _("Estimated/Planned Hours Per Task"),
+ tr("Estimated/Planned Hours Per Task"),
"/reports/completedEstimatedHoursPerTask.zul",
"15-informes.html"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_PROJECT_COSTS_REPORT) ) {
- reportsItems.add(subItem(_("Project Costs"), "/reports/orderCostsPerResource.zul", "15-informes.html"));
+ reportsItems.add(subItem(tr("Project Costs"), "/reports/orderCostsPerResource.zul", "15-informes.html"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_TASK_SCHEDULING_STATUS_IN_PROJECT_REPORT) ) {
reportsItems.add(subItem(
- _("Task Scheduling Status In Project"),
+ tr("Task Scheduling Status In Project"),
"/reports/workingArrangementsPerOrderReport.zul",
"15-informes.html"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_MATERIALS_NEED_AT_DATE_REPORT) ) {
reportsItems.add(subItem(
- _("Materials Needed At Date"),
+ tr("Materials Needed At Date"),
"/reports/timeLineMaterialReport.zul",
"15-informes.html"));
}
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_PROJECT_STATUS_REPORT) ) {
- reportsItems.add(subItem(_("Project Status"), "/reports/projectStatusReport.zul", "15-informes.html"));
+ reportsItems.add(subItem(tr("Project Status"), "/reports/projectStatusReport.zul", "15-informes.html"));
}
if ( !reportsItems.isEmpty() ) {
- topItem(_("Reports"), "/reports/hoursWorkedPerWorkerReport.zul", "", reportsItems);
+ topItem(tr("Reports"), "/reports/hoursWorkedPerWorkerReport.zul", "", reportsItems);
}
List personalAreaItems = new ArrayList<>();
if ( SecurityUtils.isUserInRole(UserRole.ROLE_BOUND_USER) ) {
- personalAreaItems.add(subItem(_("Home"), "/myaccount/userDashboard.zul", ""));
+ personalAreaItems.add(subItem(tr("Home"), "/myaccount/userDashboard.zul", ""));
}
- personalAreaItems.add(subItem(_("Preferences"), "/myaccount/settings.zul", ""));
- personalAreaItems.add(subItem(_("Change Password"), "/myaccount/changePassword.zul", ""));
- topItem(_("Personal area"), "/myaccount/userDashboard.zul", "", personalAreaItems);
+ personalAreaItems.add(subItem(tr("Preferences"), "/myaccount/settings.zul", ""));
+ personalAreaItems.add(subItem(tr("Change Password"), "/myaccount/changePassword.zul", ""));
+ topItem(tr("Personal area"), "/myaccount/userDashboard.zul", "", personalAreaItems);
}
private Vbox getRegisteredItemsInsertionPoint() {
@@ -585,7 +585,7 @@ public class CustomMenuController extends Div implements IMenuItemsRegister {
if ( ci.isActiveParent() ) {
- if ( (ci.name != null) && (!Objects.equals(ci.name, _("Planning"))) ) {
+ if ( (ci.name != null) && (!Objects.equals(ci.name, tr("Planning"))) ) {
breadcrumbsPath.add(ci);
@@ -646,7 +646,7 @@ public class CustomMenuController extends Div implements IMenuItemsRegister {
public Object addMenuItem(String name, String cssClass, EventListener eventListener) {
Vbox insertionPoint = getRegisteredItemsInsertionPoint();
Button button = new Button();
- button.setLabel(_(name));
+ button.setLabel(tr(name));
if ( cssClass != null ) {
toggleDomainCssClass(cssClass, button);
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/EffortDurationBox.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/EffortDurationBox.java
index 15c099b65..193f60434 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/EffortDurationBox.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/EffortDurationBox.java
@@ -1,7 +1,7 @@
package org.libreplan.web.common;
import static org.libreplan.business.workingday.EffortDuration.zero;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import org.libreplan.business.workingday.EffortDuration;
import org.zkoss.zk.ui.WrongValueException;
@@ -46,7 +46,7 @@ public class EffortDurationBox extends Textbox {
EffortDuration result = EffortDuration.parseFromFormattedString(value);
if (result == null) {
throw new WrongValueException(this,
- _("Invalid Effort Duration"));
+ tr("Invalid Effort Duration"));
}
return result;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/EnumsListitemRenderer.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/EnumsListitemRenderer.java
index 577b8f0fa..7c9b45654 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/EnumsListitemRenderer.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/EnumsListitemRenderer.java
@@ -26,7 +26,7 @@ import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* {@link Enum} types needs to be translated in the webapp module, because of it
@@ -42,7 +42,7 @@ public class EnumsListitemRenderer implements ListitemRenderer {
@Override
public void render(Listitem item, Object data, int i) {
item.setValue(data);
- item.appendChild(new Listcell(_(data.toString())));
+ item.appendChild(new Listcell(tr(data.toString())));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/IntegrationEntityModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/IntegrationEntityModel.java
index 48a059a06..fe6e275f8 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/IntegrationEntityModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/IntegrationEntityModel.java
@@ -21,7 +21,7 @@
package org.libreplan.web.common;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ConcurrentModificationException;
import java.util.HashMap;
@@ -76,7 +76,7 @@ public abstract class IntegrationEntityModel implements IIntegrationEntityModel
String code = getEntitySequenceDAO().getNextEntityCode(getEntityName());
if (code == null) {
throw new ConcurrentModificationException(
- _("Could not retrieve Code. Please, try again later"));
+ tr("Could not retrieve Code. Please, try again later"));
}
getCurrentEntity().setCode(code);
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/JobSchedulerController.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/JobSchedulerController.java
index ebc083c40..75c8c40ec 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/JobSchedulerController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/JobSchedulerController.java
@@ -19,7 +19,7 @@
package org.libreplan.web.common;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.text.ParseException;
import java.util.ArrayList;
@@ -210,7 +210,7 @@ public class JobSchedulerController extends BaseCRUDController();
- synchronizationInfos.add(new SynchronizationInfo(_("Task assigned to resource emails job")));
+ synchronizationInfos.add(new SynchronizationInfo(tr("Task assigned to resource emails job")));
taskAssignedToResource.sendEmail();
return;
@@ -146,7 +146,7 @@ public class JobSchedulerModel implements IJobSchedulerModel {
if ( name.equals(JobClassNameEnum.SEND_EMAIL_RESOURCE_REMOVED_FROM_TASK.getName()) ) {
synchronizationInfos = new ArrayList<>();
- synchronizationInfos.add(new SynchronizationInfo(_("Resource removed from task job")));
+ synchronizationInfos.add(new SynchronizationInfo(tr("Resource removed from task job")));
resourceRemovedFromTask.sendEmail();
return;
@@ -154,7 +154,7 @@ public class JobSchedulerModel implements IJobSchedulerModel {
if ( name.equals(JobClassNameEnum.SEND_EMAIL_MILESTONE_REACHED.getName()) ) {
synchronizationInfos = new ArrayList<>();
- synchronizationInfos.add(new SynchronizationInfo(_("Milestone reached job")));
+ synchronizationInfos.add(new SynchronizationInfo(tr("Milestone reached job")));
milestoneReached.sendEmail();
return;
@@ -162,7 +162,7 @@ public class JobSchedulerModel implements IJobSchedulerModel {
if ( name.equals(JobClassNameEnum.SEND_EMAIL_TASK_SHOULD_START.getName()) ) {
synchronizationInfos = new ArrayList<>();
- synchronizationInfos.add(new SynchronizationInfo(_("Task should start job")));
+ synchronizationInfos.add(new SynchronizationInfo(tr("Task should start job")));
taskShouldStart.sendEmail();
return;
@@ -170,7 +170,7 @@ public class JobSchedulerModel implements IJobSchedulerModel {
if ( name.equals(JobClassNameEnum.SEND_EMAIL_TASK_SHOULD_FINISH.getName()) ) {
synchronizationInfos = new ArrayList<>();
- synchronizationInfos.add(new SynchronizationInfo(_("Task should finish job")));
+ synchronizationInfos.add(new SynchronizationInfo(tr("Task should finish job")));
taskShouldFinish.sendEmail();
return;
@@ -178,7 +178,7 @@ public class JobSchedulerModel implements IJobSchedulerModel {
if ( name.equals(JobClassNameEnum.SEND_EMAIL_TIMESHEET_DATA_MISSING.getName()) ) {
synchronizationInfos = new ArrayList<>();
- synchronizationInfos.add(new SynchronizationInfo(_("Timesheet data missing job")));
+ synchronizationInfos.add(new SynchronizationInfo(tr("Timesheet data missing job")));
timesheetDataMissing.sendEmail();
return;
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/MessagesForUser.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/MessagesForUser.java
index e109787bf..8b4d32e61 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/MessagesForUser.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/MessagesForUser.java
@@ -21,7 +21,7 @@
package org.libreplan.web.common;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
@@ -174,7 +174,7 @@ public class MessagesForUser extends GenericForwardComposer implements IMessages
public static Label createLabelFor(InvalidValue invalidValue) {
Label result = new Label();
- result.setValue(_(invalidValue.getMessage()));
+ result.setValue(tr(invalidValue.getMessage()));
return result;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/TemplateController.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/TemplateController.java
index dbb92a641..187905e95 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/TemplateController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/TemplateController.java
@@ -44,7 +44,7 @@ import org.zkoss.zul.Window;
import java.util.Collections;
import java.util.List;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Controller to manage UI operations from main template.
@@ -130,7 +130,7 @@ public class TemplateController extends GenericForwardComposer {
@Override
public void errorHappened(Exception exceptionHappened) {
LOG.error("error doing reassignation", exceptionHappened);
- windowMessages.showMessage(Level.ERROR, _("error doing reassignment: {0}", exceptionHappened));
+ windowMessages.showMessage(Level.ERROR, tr("error doing reassignment: {0}", exceptionHappened));
}
});
}
@@ -242,7 +242,7 @@ public class TemplateController extends GenericForwardComposer {
* Used in template.zul
*/
public String getVersionMessage() {
- return _("A new version ") + lastVersionNumber + _(" of LibrePlan is available. Please check next link for more information:");
+ return tr("A new version ") + lastVersionNumber + tr(" of LibrePlan is available. Please check next link for more information:");
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/TemplateModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/TemplateModel.java
index a90aa3afd..d37e9f7ba 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/TemplateModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/TemplateModel.java
@@ -74,7 +74,7 @@ import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Model to manage UI operations from main template.
@@ -326,11 +326,11 @@ public class TemplateModel implements ITemplateModel {
}
private IDesktopUpdate showStart(final int ordersNumber) {
- return sendMessage(_("Reassigning {0} projects", ordersNumber));
+ return sendMessage(tr("Reassigning {0} projects", ordersNumber));
}
private IDesktopUpdate showProgress(int remaining) {
- return sendMessage(_("{0} projects remaining to reassign", remaining));
+ return sendMessage(tr("{0} projects remaining to reassign", remaining));
}
private IDesktopUpdate sendMessage(final String message) {
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/Util.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/Util.java
index 642858ed3..d1f155a53 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/Util.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/Util.java
@@ -21,7 +21,7 @@
package org.libreplan.web.common;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.io.IOException;
import java.math.BigDecimal;
@@ -665,7 +665,7 @@ public class Util {
*/
public static Button createEditButton(EventListener eventListener) {
Button result = new Button();
- result.setTooltiptext(_("Edit"));
+ result.setTooltiptext(tr("Edit"));
result.setSclass("icono");
result.setImage("/common/img/ico_editar1.png");
result.setHoverImage("/common/img/ico_editar.png");
@@ -684,7 +684,7 @@ public class Util {
*/
public static Button createRemoveButton(EventListener eventListener) {
Button result = new Button();
- result.setTooltiptext(_("Remove"));
+ result.setTooltiptext(tr("Remove"));
result.setSclass("icono");
result.setImage("/common/img/ico_borrar1.png");
result.setHoverImage("/common/img/ico_borrar.png");
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/EffortDurationPicker.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/EffortDurationPicker.java
index 7b9176d40..e7f77bcb5 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/EffortDurationPicker.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/EffortDurationPicker.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.web.common.components;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.EnumMap;
@@ -59,14 +59,14 @@ public class EffortDurationPicker extends Hbox {
minutes = new Spinner();
minutes.setCols(2);
setRangeFor(minutes, 0, 59);
- appendWithTooltipText(hours, _("Hours"));
- appendWithTooltipText(minutes, _("Minutes"));
+ appendWithTooltipText(hours, tr("Hours"));
+ appendWithTooltipText(minutes, tr("Minutes"));
if (withseconds) {
seconds = new Spinner();
seconds.setCols(2);
setRangeFor(seconds, 0, 59);
- appendWithTooltipText(seconds, _("Seconds"));
+ appendWithTooltipText(seconds, tr("Seconds"));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/I18n.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/I18n.java
index f41630015..318a84e04 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/I18n.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/I18n.java
@@ -24,7 +24,7 @@ package org.libreplan.web.common.components;
import org.zkoss.zk.ui.HtmlMacroComponent;
import org.zkoss.zul.Label;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* ZK macro component for translating texts created dynamically, that means, those which need one or more parameters.
@@ -89,22 +89,22 @@ public class I18n extends HtmlMacroComponent {
public String getI18n() {
if (arg0 != null && arg1 != null && arg2 != null && arg3 != null) {
- return _(value, arg0, arg1, arg2, arg3);
+ return tr(value, arg0, arg1, arg2, arg3);
}
if (arg0 != null && arg1 != null && arg2 != null) {
- return _(value, arg0, arg1, arg2);
+ return tr(value, arg0, arg1, arg2);
}
if (arg0 != null && arg1 != null) {
- return _(value, arg0, arg1);
+ return tr(value, arg0, arg1);
}
if (arg0 != null) {
- return _(value, arg0);
+ return tr(value, arg0);
}
- return _(value);
+ return tr(value);
}
public void forceLoad() {
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/L10n.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/L10n.java
index 935ff7e15..bfca47fab 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/L10n.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/L10n.java
@@ -46,7 +46,7 @@ public class L10n extends Label {
@Override
public void setValue(String value) {
- super.setValue(I18nHelper._(value));
+ super.setValue(I18nHelper.tr(value));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/NewAllocationSelector.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/NewAllocationSelector.java
index 8ff930e43..e55a53bce 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/NewAllocationSelector.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/NewAllocationSelector.java
@@ -52,7 +52,7 @@ public class NewAllocationSelector extends AllocationSelector {
public enum AllocationType {
- GENERIC_WORKERS(_("generic workers allocation")) {
+ GENERIC_WORKERS(tr("generic workers allocation")) {
@Override
public void addTo(NewAllocationSelectorController controller, INewAllocationsAdder allocationsAdder) {
allocationsAdder.addGeneric(
@@ -72,7 +72,7 @@ public class NewAllocationSelector extends AllocationSelector {
}
},
- GENERIC_MACHINES(_("generic machines allocation")) {
+ GENERIC_MACHINES(tr("generic machines allocation")) {
@Override
public void addTo(NewAllocationSelectorController controller, INewAllocationsAdder allocationsAdder) {
List criteria = controller.getSelectedCriterions();
@@ -90,7 +90,7 @@ public class NewAllocationSelector extends AllocationSelector {
}
},
- SPECIFIC(_("specific allocation")) {
+ SPECIFIC(tr("specific allocation")) {
@Override
public void addTo(NewAllocationSelectorController controller, INewAllocationsAdder allocationsAdder) {
allocationsAdder.addSpecific(controller.getSelectedWorkers());
@@ -110,7 +110,7 @@ public class NewAllocationSelector extends AllocationSelector {
/**
* Forces to mark the string as needing translation.
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
@@ -121,7 +121,7 @@ public class NewAllocationSelector extends AllocationSelector {
}
public String getName() {
- return I18nHelper._(name);
+ return I18nHelper.tr(name);
}
public void doTheSelectionOn(Radiogroup radioGroup) {
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/ResourceAllocationBehaviour.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/ResourceAllocationBehaviour.java
index c0f6ab7cd..72a69ecc8 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/ResourceAllocationBehaviour.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/ResourceAllocationBehaviour.java
@@ -35,7 +35,7 @@ import org.libreplan.web.common.components.NewAllocationSelector.AllocationType;
*/
public enum ResourceAllocationBehaviour {
- NON_LIMITING(_("Normal")) {
+ NON_LIMITING(tr("Normal")) {
@Override
public boolean allowMultipleSelection() {
@@ -60,7 +60,7 @@ public enum ResourceAllocationBehaviour {
}
},
- LIMITING(_("Queue-based")) {
+ LIMITING(tr("Queue-based")) {
@Override
public boolean allowMultipleSelection() {
@@ -89,7 +89,7 @@ public enum ResourceAllocationBehaviour {
/**
* Forces to mark the string as needing translation
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/TwoWaySelector.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/TwoWaySelector.java
index bb99e0d8c..c20453dbc 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/TwoWaySelector.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/TwoWaySelector.java
@@ -40,7 +40,7 @@ import java.util.HashMap;
import java.util.Set;
import java.util.Arrays;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* ZK macro component that shows two {@link Listbox} allowing to move objects
@@ -65,7 +65,7 @@ public class TwoWaySelector extends HtmlMacroComponent {
/**
* Title for the left {@link Listbox} (where assigned objects are shown)
*/
- private String assignedTitle = _("Assigned");
+ private String assignedTitle = tr("Assigned");
/**
* A {@link Set} of objects that are not assigned (so they're shown on the
@@ -76,7 +76,7 @@ public class TwoWaySelector extends HtmlMacroComponent {
/**
* Title for the right {@link Listbox} (where unassigned objects are shown)
*/
- private String unassignedTitle = _("Unassigned");
+ private String unassignedTitle = tr("Unassigned");
/**
* A {@link List} of properties to be shown on the {@link Listbox} for each
@@ -105,7 +105,7 @@ public class TwoWaySelector extends HtmlMacroComponent {
// Call the method to get the information
PropertyDescriptor propertyDescriptor = propertiesByName.get(column);
if (propertyDescriptor == null) {
- throw new RuntimeException(_("Unknown attribute '{0}' in class {1}", column, klass.getName()));
+ throw new RuntimeException(tr("Unknown attribute '{0}' in class {1}", column, klass.getName()));
}
String label = Objects.toString(propertyDescriptor.getReadMethod().invoke(data));
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/bandboxsearch/BandboxMultipleSearch.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/bandboxsearch/BandboxMultipleSearch.java
index 725c4e13d..fd2ded111 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/bandboxsearch/BandboxMultipleSearch.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/bandboxsearch/BandboxMultipleSearch.java
@@ -21,7 +21,7 @@
package org.libreplan.web.common.components.bandboxsearch;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.List;
@@ -228,7 +228,7 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
if ( (filter.getType().equals(newFilter.getType())) &&
(filter.getPattern().equals(newFilter.getPattern())) ) {
- throw new WrongValueException(bandbox, _("filter already exists"));
+ throw new WrongValueException(bandbox, tr("filter already exists"));
}
}
selectedFilters.add(obj);
@@ -238,7 +238,7 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
updateBandboxValue();
if ( this.multipleFiltersFinder != null ) {
if ( !multipleFiltersFinder.isValidFormatText(selectedFilters, bandbox.getValue()) ) {
- throw new WrongValueException(bandbox, _("format filters are not valid"));
+ throw new WrongValueException(bandbox, tr("format filters are not valid"));
}
}
@@ -274,7 +274,7 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
clearHeaderIfNecessary();
final String[] headers = multipleFiltersFinder.getHeaders();
for (String header : headers) {
- listhead.getChildren().add(new Listheader(_(header)));
+ listhead.getChildren().add(new Listheader(tr(header)));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/bandboxsearch/BandboxSearch.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/bandboxsearch/BandboxSearch.java
index 961ac923c..a3a71254f 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/bandboxsearch/BandboxSearch.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/bandboxsearch/BandboxSearch.java
@@ -21,7 +21,7 @@
package org.libreplan.web.common.components.bandboxsearch;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.List;
@@ -203,7 +203,7 @@ public class BandboxSearch extends HtmlMacroComponent {
final String[] headers = finder.getHeaders();
for (String header : headers) {
- listhead.getChildren().add(new Listheader(_(header)));
+ listhead.getChildren().add(new Listheader(tr(header)));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/BaseCalendarBandboxFinder.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/BaseCalendarBandboxFinder.java
index df40e0385..8fd848110 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/BaseCalendarBandboxFinder.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/BaseCalendarBandboxFinder.java
@@ -43,12 +43,12 @@ public class BaseCalendarBandboxFinder extends BandboxFinder implements IBandbox
@Autowired
private IBaseCalendarDAO baseCalendarDAO;
- private final String headers[] = { _("Name") };
+ private final String headers[] = { tr("Name") };
/**
* Forces to mark the string as needing translation.
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/CriterionBandboxFinder.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/CriterionBandboxFinder.java
index 201154dbf..bc64e311b 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/CriterionBandboxFinder.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/CriterionBandboxFinder.java
@@ -41,7 +41,7 @@ public class CriterionBandboxFinder extends BandboxFinder implements IBandboxFin
@Autowired
private ICriterionDAO criterionDAO;
- private final String headers[] = { _("Type"), _("Criterion Name") };
+ private final String headers[] = { tr("Type"), tr("Criterion Name") };
private final ListitemRenderer orderRenderer = (item, data, i) -> {
Criterion criterion = (Criterion)data;
@@ -59,7 +59,7 @@ public class CriterionBandboxFinder extends BandboxFinder implements IBandboxFin
/**
* Forces to mark the string as needing translation.
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/CriterionMultipleFiltersFinder.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/CriterionMultipleFiltersFinder.java
index 97882cac6..e3821c7fb 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/CriterionMultipleFiltersFinder.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/CriterionMultipleFiltersFinder.java
@@ -40,7 +40,7 @@ public class CriterionMultipleFiltersFinder extends MultipleFiltersFinder {
/**
* Forces to mark the string as needing translation
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ExternalCompanyBandboxFinder.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ExternalCompanyBandboxFinder.java
index a21bc0d98..c7fdc90eb 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ExternalCompanyBandboxFinder.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ExternalCompanyBandboxFinder.java
@@ -47,12 +47,12 @@ public class ExternalCompanyBandboxFinder extends BandboxFinder implements IBand
@Autowired
private IExternalCompanyDAO externalCompanyDAO;
- private final String headers[] = { _("ID"), _("Name") };
+ private final String headers[] = { tr("ID"), tr("Name") };
/**
* Forces to mark the string as needing translation.
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/LabelBandboxFinder.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/LabelBandboxFinder.java
index e6bb9fd20..dd319b997 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/LabelBandboxFinder.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/LabelBandboxFinder.java
@@ -48,12 +48,12 @@ public class LabelBandboxFinder extends BandboxFinder implements IBandboxFinder
@Autowired
private ILabelDAO labelDAO;
- private final String headers[] = { _("Type"), _("Name") };
+ private final String headers[] = { tr("Type"), tr("Name") };
/**
* Forces to mark the string as needing translation.
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/MultipleFiltersFinder.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/MultipleFiltersFinder.java
index 152cbabb6..0e475df20 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/MultipleFiltersFinder.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/MultipleFiltersFinder.java
@@ -34,7 +34,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
abstract class MultipleFiltersFinder implements IMultipleFiltersFinder {
@@ -198,7 +198,7 @@ abstract class MultipleFiltersFinder implements IMultipleFiltersFinder {
labelPattern.setParent(item);
final Listcell labelType = new Listcell();
- labelType.setLabel(_(filterPair.getTypeComplete()));
+ labelType.setLabel(tr(filterPair.getTypeComplete()));
labelType.setParent(item);
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderBandboxFinder.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderBandboxFinder.java
index 463a0ebe2..cf1e0b014 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderBandboxFinder.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderBandboxFinder.java
@@ -41,12 +41,12 @@ public class OrderBandboxFinder extends BandboxFinder implements IBandboxFinder
@Autowired
private IOrderDAO orderDAO;
- private final String headers[] = { _("Project code"), _("Project name") };
+ private final String headers[] = { tr("Project code"), tr("Project name") };
/**
* Forces to mark the string as needing translation.
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderElementBandboxFinder.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderElementBandboxFinder.java
index e85ff2b6a..0b157b2e0 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderElementBandboxFinder.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderElementBandboxFinder.java
@@ -48,12 +48,12 @@ public class OrderElementBandboxFinder extends BandboxFinder implements IBandbox
@Autowired
private IOrderDAO orderDAO;
- private final String headers[] = { _("Project"), _("Project code"), _("Task"), _("Task code") };
+ private final String headers[] = { tr("Project"), tr("Project code"), tr("Task"), tr("Task code") };
/**
* Forces to mark the string as needing translation
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderElementFilterEnum.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderElementFilterEnum.java
index 0fc577af6..87a8df393 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderElementFilterEnum.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderElementFilterEnum.java
@@ -33,12 +33,12 @@ import org.libreplan.business.orders.entities.OrderElement;
*/
public enum OrderElementFilterEnum implements IFilterEnum {
- Criterion(_("Criterion")), Label(_("Label"));
+ Criterion(tr("Criterion")), Label(tr("Label"));
/**
* Forces to mark the string as needing translation
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderElementInExpenseSheetBandboxFinder.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderElementInExpenseSheetBandboxFinder.java
index 3bf5b0421..ea2fb10d5 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderElementInExpenseSheetBandboxFinder.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderElementInExpenseSheetBandboxFinder.java
@@ -42,12 +42,12 @@ public class OrderElementInExpenseSheetBandboxFinder extends BandboxFinder imple
@Autowired
private IOrderElementDAO orderElementDAO;
- private final String headers[] = { _("Task name (Task code)"), _("Project name (Project code)") };
+ private final String headers[] = { tr("Task name (Task code)"), tr("Project name (Project code)") };
/**
* Forces to mark the string as needing translation.
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderFilterEnum.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderFilterEnum.java
index a3ac2393b..c77249e2e 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderFilterEnum.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderFilterEnum.java
@@ -27,13 +27,13 @@ package org.libreplan.web.common.components.finders;
public enum OrderFilterEnum implements IFilterEnum {
- Criterion(_("Criterion")), Label(_("Label")), ExternalCompany(_("Customer")), State(
- _("State")), Code(_("Code")), CustomerReference(
- _("Customer Reference"));
+ Criterion(tr("Criterion")), Label(tr("Label")), ExternalCompany(tr("Customer")), State(
+ tr("State")), Code(tr("Code")), CustomerReference(
+ tr("Customer Reference"));
/**
* Forces to mark the string as needing translation
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderInExpenseSheetBandboxFinder.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderInExpenseSheetBandboxFinder.java
index bf0b1160e..8302175d9 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderInExpenseSheetBandboxFinder.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrderInExpenseSheetBandboxFinder.java
@@ -41,12 +41,12 @@ public class OrderInExpenseSheetBandboxFinder extends BandboxFinder implements I
@Autowired
private IOrderDAO orderDAO;
- private final String headers[] = { _("Project name (Project code)") };
+ private final String headers[] = { tr("Project name (Project code)") };
/**
* Forces to mark the string as needing translation
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrdersMultipleFiltersFinder.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrdersMultipleFiltersFinder.java
index 542cb0648..192025911 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrdersMultipleFiltersFinder.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/OrdersMultipleFiltersFinder.java
@@ -36,7 +36,7 @@ import org.libreplan.business.resources.entities.Criterion;
import org.libreplan.business.resources.entities.CriterionType;
import org.springframework.beans.factory.annotation.Autowired;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
@@ -255,7 +255,7 @@ public class OrdersMultipleFiltersFinder extends MultipleFiltersFinder {
private void searchInOrderStatus(String filter) {
for (OrderStatusEnum state : OrderStatusEnum.values()) {
- String name = StringUtils.deleteWhitespace(_(state.name()).toLowerCase());
+ String name = StringUtils.deleteWhitespace(tr(state.name()).toLowerCase());
if (name.contains(filter)) {
addState(state);
@@ -313,7 +313,7 @@ public class OrdersMultipleFiltersFinder extends MultipleFiltersFinder {
}
private void addState(OrderStatusEnum state) {
- getListMatching().add(new FilterPair(OrderFilterEnum.State, _(state.name()), state));
+ getListMatching().add(new FilterPair(OrderFilterEnum.State, tr(state.name()), state));
}
private void addCode(String code) {
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/QualityFormBandboxFinder.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/QualityFormBandboxFinder.java
index 088915501..cc4cf5d39 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/QualityFormBandboxFinder.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/QualityFormBandboxFinder.java
@@ -47,12 +47,12 @@ public class QualityFormBandboxFinder extends BandboxFinder implements IBandboxF
@Autowired
private IQualityFormDAO qualityFormDAO;
- private final String headers[] = { _("Name"), _("Type") };
+ private final String headers[] = { tr("Name"), tr("Type") };
/**
* Forces to mark the string as needing translation
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ResourceAllocationFilterEnum.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ResourceAllocationFilterEnum.java
index 67ee91f26..1a8ad03a5 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ResourceAllocationFilterEnum.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ResourceAllocationFilterEnum.java
@@ -27,12 +27,12 @@ package org.libreplan.web.common.components.finders;
public enum ResourceAllocationFilterEnum implements IFilterEnum {
- Criterion(_("Criterion")), Resource(_("Resource"));
+ Criterion(tr("Criterion")), Resource(tr("Resource"));
/**
* Forces to mark the string as needing translation
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ResourceBandboxFinder.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ResourceBandboxFinder.java
index 1a1cdba24..81c90713b 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ResourceBandboxFinder.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ResourceBandboxFinder.java
@@ -43,12 +43,12 @@ public class ResourceBandboxFinder extends BandboxFinder implements IBandboxFind
@Autowired
private IResourceDAO resourceDAO;
- private final String headers[] = { _("Resource") };
+ private final String headers[] = { tr("Resource") };
/**
* Forces to mark the string as needing translation
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ResourceFilterEnum.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ResourceFilterEnum.java
index 7a4a774c8..e2f86f031 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ResourceFilterEnum.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ResourceFilterEnum.java
@@ -26,12 +26,12 @@ package org.libreplan.web.common.components.finders;
public enum ResourceFilterEnum implements IFilterEnum {
- Criterion(_("Criterion")), CostCategory(_("Cost category"));
+ Criterion(tr("Criterion")), CostCategory(tr("Cost category"));
/**
* Forces to mark the string as needing translation
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ResourceFilterEnumByResourceAndCriterion.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ResourceFilterEnumByResourceAndCriterion.java
index 8e8bf7b74..201da4d07 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ResourceFilterEnumByResourceAndCriterion.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ResourceFilterEnumByResourceAndCriterion.java
@@ -28,12 +28,12 @@ import org.libreplan.business.resources.entities.Resource;
*/
public enum ResourceFilterEnumByResourceAndCriterion implements IFilterEnum {
- RESOURCE(_("Resource")), CRITERION(_("Criterion"));
+ RESOURCE(tr("Resource")), CRITERION(tr("Criterion"));
/**
* Forces to mark the string as needing translation
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ResourceInExpenseSheetBandboxFinder.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ResourceInExpenseSheetBandboxFinder.java
index 6bf3d2429..63b939a58 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ResourceInExpenseSheetBandboxFinder.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ResourceInExpenseSheetBandboxFinder.java
@@ -41,12 +41,12 @@ public class ResourceInExpenseSheetBandboxFinder extends BandboxFinder implement
@Autowired
private IResourceDAO resourceDAO;
- private final String headers[] = { _("Resource name (Resource code)"), _("Type") };
+ private final String headers[] = { tr("Resource name (Resource code)"), tr("Type") };
/**
* Forces to mark the string as needing translation
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ScenarioBandboxFinder.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ScenarioBandboxFinder.java
index af764d657..a1ddee561 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ScenarioBandboxFinder.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/ScenarioBandboxFinder.java
@@ -43,12 +43,12 @@ public class ScenarioBandboxFinder extends BandboxFinder implements IBandboxFind
@Autowired
private IScenarioDAO scenarioDAO;
- private final String headers[] = { _("Name") };
+ private final String headers[] = { tr("Name") };
/**
* Forces to mark the string as needing translation
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/TaskElementFilterEnum.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/TaskElementFilterEnum.java
index 69692a6ce..3b3df4d5c 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/TaskElementFilterEnum.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/TaskElementFilterEnum.java
@@ -31,12 +31,12 @@ import org.libreplan.business.planner.entities.TaskElement;
*/
public enum TaskElementFilterEnum implements IFilterEnum {
- Criterion(_("Criterion")), Label(_("Label")), Resource(_("Resource"));
+ Criterion(tr("Criterion")), Label(tr("Label")), Resource(tr("Resource"));
/**
* Forces to mark the string as needing translation
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/TaskGroupFilterEnum.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/TaskGroupFilterEnum.java
index ec2d567b1..057bf66e5 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/TaskGroupFilterEnum.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/TaskGroupFilterEnum.java
@@ -27,13 +27,13 @@ import org.libreplan.business.planner.entities.TaskGroup;
*/
public enum TaskGroupFilterEnum implements IFilterEnum {
- Criterion(_("Criterion")), Label(_("Label")), ExternalCompany(_("Customer")), State(
- _("State")), Code(_("Code")), CustomerReference(
- _("Customer Reference")), Resource(_("Resource"));
+ Criterion(tr("Criterion")), Label(tr("Label")), ExternalCompany(tr("Customer")), State(
+ tr("State")), Code(tr("Code")), CustomerReference(
+ tr("Customer Reference")), Resource(tr("Resource"));
/**
* Forces to mark the string as needing translation
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/TaskGroupsMultipleFiltersFinder.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/TaskGroupsMultipleFiltersFinder.java
index 2e71b4e7d..3eb90f6e1 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/TaskGroupsMultipleFiltersFinder.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/TaskGroupsMultipleFiltersFinder.java
@@ -36,7 +36,7 @@ import org.libreplan.business.resources.entities.CriterionType;
import org.libreplan.business.resources.entities.Resource;
import org.springframework.beans.factory.annotation.Autowired;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
@@ -256,7 +256,7 @@ public class TaskGroupsMultipleFiltersFinder extends MultipleFiltersFinder {
private void searchInOrderStatus(String filter) {
for (OrderStatusEnum state : OrderStatusEnum.values()) {
- String name = StringUtils.deleteWhitespace(_(state.name()).toLowerCase());
+ String name = StringUtils.deleteWhitespace(tr(state.name()).toLowerCase());
if (name.contains(filter)) {
addState(state);
@@ -315,7 +315,7 @@ public class TaskGroupsMultipleFiltersFinder extends MultipleFiltersFinder {
}
private void addState(OrderStatusEnum state) {
- getListMatching().add(new FilterPair(TaskGroupFilterEnum.State, _(state.name()), state));
+ getListMatching().add(new FilterPair(TaskGroupFilterEnum.State, tr(state.name()), state));
}
private void addCode(String code) {
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/TypeOfWorkHoursBandboxFinder.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/TypeOfWorkHoursBandboxFinder.java
index 13a0cea06..aa2c04f4e 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/TypeOfWorkHoursBandboxFinder.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/TypeOfWorkHoursBandboxFinder.java
@@ -40,12 +40,12 @@ public class TypeOfWorkHoursBandboxFinder extends BandboxFinder implements IBand
@Autowired
private ITypeOfWorkHoursDAO typeOfWorkHoursDAO;
- private final String headers[] = { _("Name") };
+ private final String headers[] = { tr("Name") };
/**
* Forces to mark the string as needing translation
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/UserBandboxFinder.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/UserBandboxFinder.java
index 78344cbc5..dcf8d8876 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/UserBandboxFinder.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/components/finders/UserBandboxFinder.java
@@ -43,7 +43,7 @@ public class UserBandboxFinder extends BandboxFinder implements IBandboxFinder {
@Autowired
private IUserDAO userDAO;
- private final String headers[] = { _("Username"), _("Full name") };
+ private final String headers[] = { tr("Username"), tr("Full name") };
private final ListitemRenderer usersRenderer = (item, data, i) -> {
User user = (User) data;
@@ -57,7 +57,7 @@ public class UserBandboxFinder extends BandboxFinder implements IBandboxFinder {
/**
* Forces to mark the string as needing translation.
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/converters/ConverterFactory.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/converters/ConverterFactory.java
index f2bced1e6..22aff327d 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/converters/ConverterFactory.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/converters/ConverterFactory.java
@@ -30,7 +30,7 @@ import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Default implementation for {@link IConverterFactory}
@@ -61,6 +61,6 @@ public class ConverterFactory implements IConverterFactory {
return (IConverter super T>) result;
}
}
- throw new RuntimeException(_("Not found converter for {0}", klass));
+ throw new RuntimeException(tr("Not found converter for {0}", klass));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/entrypoints/EntryPointsHandler.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/entrypoints/EntryPointsHandler.java
index bb3445a60..09071223a 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/entrypoints/EntryPointsHandler.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/entrypoints/EntryPointsHandler.java
@@ -21,7 +21,7 @@
package org.libreplan.web.common.entrypoints;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -93,7 +93,7 @@ public class EntryPointsHandler {
Validate.notNull(
entryPoints,
- _(
+ tr(
"{0} annotation required on {1}",
EntryPoints.class.getName(),
interfaceDefiningEntryPoints.getName()));
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/entrypoints/RedirectorSynthetiser.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/entrypoints/RedirectorSynthetiser.java
index 3725d5a37..1fe590451 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/entrypoints/RedirectorSynthetiser.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/entrypoints/RedirectorSynthetiser.java
@@ -21,7 +21,7 @@
package org.libreplan.web.common.entrypoints;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.io.IOException;
import java.lang.reflect.InvocationHandler;
@@ -123,7 +123,7 @@ public class RedirectorSynthetiser implements BeanFactoryPostProcessor {
ClassUtils.convertClassNameToResourcePath("org.libreplan.web") + "/" + "**/*.class");
} catch (IOException e) {
- throw new RuntimeException(_("Could not load any resource"), e);
+ throw new RuntimeException(tr("Could not load any resource"), e);
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/costcategories/CostCategoryCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/costcategories/CostCategoryCRUDController.java
index edc65a334..ec4a505e0 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/costcategories/CostCategoryCRUDController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/costcategories/CostCategoryCRUDController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.costcategories;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.math.BigDecimal;
import java.util.ConcurrentModificationException;
@@ -144,13 +144,13 @@ public class CostCategoryCRUDController extends BaseCRUDController
Listbox workHoursType = getWorkHoursType(row);
String message = workHoursType.getItems().isEmpty()
- ? _("Hours types are empty. Please, create some hours types before proceeding")
- : _("cannot be empty");
+ ? tr("Hours types are empty. Please, create some hours types before proceeding")
+ : tr("cannot be empty");
throw new WrongValueException(getWorkHoursType(row), message);
}
if (hourCost.getPriceCost() == null) {
- throw new WrongValueException(getPricePerHour(row), _("cannot be empty"));
+ throw new WrongValueException(getPricePerHour(row), tr("cannot be empty"));
}
}
}
@@ -211,7 +211,7 @@ public class CostCategoryCRUDController extends BaseCRUDController
if (!hourCost.getCategory().isCodeAutogenerated()) {
txtCode.setConstraint("no empty:"
- + _("cannot be empty"));
+ + tr("cannot be empty"));
} else {
txtCode.setConstraint("");
}
@@ -277,7 +277,7 @@ public class CostCategoryCRUDController extends BaseCRUDController
}
} else if (item != null) {
hourCost.setPriceCost(BigDecimal.ZERO);
- throw new WrongValueException(item.getParent(), _("Please, select an item"));
+ throw new WrongValueException(item.getParent(), tr("Please, select an item"));
}
}
@@ -290,7 +290,7 @@ public class CostCategoryCRUDController extends BaseCRUDController
Button delete = new Button("", "/common/img/ico_borrar1.png");
delete.setHoverImage("/common/img/ico_borrar.png");
delete.setSclass("icono");
- delete.setTooltiptext(_("Delete"));
+ delete.setTooltiptext(tr("Delete"));
delete.addEventListener(Events.ON_CLICK, new EventListener() {
@Override
@@ -310,7 +310,7 @@ public class CostCategoryCRUDController extends BaseCRUDController
private void appendDecimalboxCost(Row row) {
Decimalbox boxCost = new Decimalbox();
bindDecimalboxCost(boxCost, row.getValue());
- boxCost.setConstraint("no empty:" + _("cannot be empty"));
+ boxCost.setConstraint("no empty:" + tr("cannot be empty"));
boxCost.setFormat(Util.getMoneyFormat());
row.appendChild(boxCost);
}
@@ -349,7 +349,7 @@ public class CostCategoryCRUDController extends BaseCRUDController
private void appendDateboxInitDate(final Row row) {
Datebox initDateBox = new Datebox();
bindDateboxInitDate(initDateBox, row.getValue());
- initDateBox.setConstraint("no empty:" + _("Start date cannot be empty"));
+ initDateBox.setConstraint("no empty:" + tr("Start date cannot be empty"));
row.appendChild(initDateBox);
initDateBox.addEventListener("onChange", new EventListener() {
@@ -459,7 +459,7 @@ public class CostCategoryCRUDController extends BaseCRUDController
public void confirmRemove(HourCost hourCost) {
int status = Messagebox.show(
- _("Confirm deleting this hour cost. Are you sure?"), _("Delete"),
+ tr("Confirm deleting this hour cost. Are you sure?"), tr("Delete"),
Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
if (Messagebox.OK == status) {
@@ -522,12 +522,12 @@ public class CostCategoryCRUDController extends BaseCRUDController
@Override
protected String getEntityType() {
- return _("Cost Category");
+ return tr("Cost Category");
}
@Override
protected String getPluralEntityType() {
- return _("Cost Categories");
+ return tr("Cost Categories");
}
@Override
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/costcategories/ResourcesCostCategoryAssignmentController.java b/libreplan-webapp/src/main/java/org/libreplan/web/costcategories/ResourcesCostCategoryAssignmentController.java
index 377834b67..ca8bbe05d 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/costcategories/ResourcesCostCategoryAssignmentController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/costcategories/ResourcesCostCategoryAssignmentController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.costcategories;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.Date;
import java.util.List;
@@ -105,7 +105,7 @@ public class ResourcesCostCategoryAssignmentController extends GenericForwardCom
autocomplete.setAutodrop(true);
autocomplete.applyProperties();
autocomplete.setFinder("CostCategoryFinder");
- autocomplete.setConstraint("no empty:" + _("A category must be selected"));
+ autocomplete.setConstraint("no empty:" + tr("A category must be selected"));
// Getter, show type selected
if (getCostCategory(row) != null) {
@@ -132,7 +132,7 @@ public class ResourcesCostCategoryAssignmentController extends GenericForwardCom
public void confirmRemove(ResourcesCostCategoryAssignment assignment) {
int status = Messagebox.show(
- _("Confirm deleting this hour cost. Are you sure?"), _("Delete"),
+ tr("Confirm deleting this hour cost. Are you sure?"), tr("Delete"),
Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
if (Messagebox.OK == status) {
@@ -149,7 +149,7 @@ public class ResourcesCostCategoryAssignmentController extends GenericForwardCom
Button delete = new Button("", "/common/img/ico_borrar1.png");
delete.setHoverImage("/common/img/ico_borrar.png");
delete.setSclass("icono");
- delete.setTooltiptext(_("Delete"));
+ delete.setTooltiptext(tr("Delete"));
delete.addEventListener(Events.ON_CLICK, new EventListener() {
@Override
@@ -168,7 +168,7 @@ public class ResourcesCostCategoryAssignmentController extends GenericForwardCom
private void appendDateboxInitDate(final Row row) {
Datebox initDateBox = new Datebox();
bindDateboxInitDate(initDateBox, row.getValue());
- initDateBox.setConstraint("no empty:" + _("Start date cannot be empty"));
+ initDateBox.setConstraint("no empty:" + tr("Start date cannot be empty"));
row.appendChild(initDateBox);
initDateBox.addEventListener("onChange", new EventListener() {
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/costcategories/TypeOfWorkHoursCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/costcategories/TypeOfWorkHoursCRUDController.java
index 44bdb0fc7..6c072b961 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/costcategories/TypeOfWorkHoursCRUDController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/costcategories/TypeOfWorkHoursCRUDController.java
@@ -37,7 +37,7 @@ import org.zkoss.zul.Messagebox;
import java.util.ConcurrentModificationException;
import java.util.List;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Controller for CRUD actions over a {@link TypeOfWorkHours}
@@ -98,17 +98,17 @@ public class TypeOfWorkHoursCRUDController extends BaseCRUDController pieChart = new PieChart<>(_("Task deadline violations"));
- pieChart.addValue(_("On schedule"), dashboardModel.getPercentageOfOnScheduleTasks());
- pieChart.addValue(_("Violated deadline"), dashboardModel.getPercentageOfTasksWithViolatedDeadline());
- pieChart.addValue(_("No deadline"), dashboardModel.getPercentageOfTasksWithNoDeadline());
+ PieChart pieChart = new PieChart<>(tr("Task deadline violations"));
+ pieChart.addValue(tr("On schedule"), dashboardModel.getPercentageOfOnScheduleTasks());
+ pieChart.addValue(tr("Violated deadline"), dashboardModel.getPercentageOfTasksWithViolatedDeadline());
+ pieChart.addValue(tr("No deadline"), dashboardModel.getPercentageOfTasksWithNoDeadline());
pieChart.addIntervalColors("#8fbe86", "#eb6b71", "#cfcfcf");
@@ -216,7 +216,7 @@ public class DashboardController extends GenericForwardComposer {
final String divId = "task-completation-lag";
BarChart barChart;
- barChart = new BarChart<>(_("Task Completation Lead/Lag"));
+ barChart = new BarChart<>(tr("Task Completation Lead/Lag"));
barChart.setFillZero(true);
barChart.setHighlightMouseDown(true);
@@ -234,9 +234,9 @@ public class DashboardController extends GenericForwardComposer {
barChart.getAxes()
.getXaxis()
- .setLabel(_("Days Interval (Calculated as task completion end date minus estimated end date)"));
+ .setLabel(tr("Days Interval (Calculated as task completion end date minus estimated end date)"));
- barChart.getAxes().yAxisInstance().setLabel(_("Number of tasks"));
+ barChart.getAxes().yAxisInstance().setLabel(tr("Number of tasks"));
renderChart(barChart, divId);
}
@@ -245,7 +245,7 @@ public class DashboardController extends GenericForwardComposer {
final String divId = "estimation-accuracy";
BarChart barChart;
- barChart = new BarChart<>(_("Estimation deviation on completed tasks"));
+ barChart = new BarChart<>(tr("Estimation deviation on completed tasks"));
barChart.setFillZero(true);
barChart.setHighlightMouseDown(true);
@@ -263,22 +263,22 @@ public class DashboardController extends GenericForwardComposer {
barChart.getAxes()
.getXaxis()
- .setLabel(_("% Deviation interval (difference % between consumed and estimated hours)"));
+ .setLabel(tr("% Deviation interval (difference % between consumed and estimated hours)"));
- barChart.getAxes().yAxisInstance().setLabel(_("Number of tasks"));
+ barChart.getAxes().yAxisInstance().setLabel(tr("Number of tasks"));
renderChart(barChart, divId);
}
private String statusLegend(TaskStatusEnum status, Map taskStatus) {
- return _(status.toString()) + String.format(_(" (%d tasks)"), taskStatus.get(status));
+ return tr(status.toString()) + String.format(tr(" (%d tasks)"), taskStatus.get(status));
}
private void renderTaskStatus() {
final String divId = "task-status";
Map taskStatus = dashboardModel.calculateTaskStatus();
- PieChart taskStatusPieChart = new PieChart<>(_("Task Status"));
+ PieChart taskStatusPieChart = new PieChart<>(tr("Task Status"));
taskStatusPieChart.addValue(
statusLegend(TaskStatusEnum.FINISHED, taskStatus),
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/dashboard/GlobalProgressChart.java b/libreplan-webapp/src/main/java/org/libreplan/web/dashboard/GlobalProgressChart.java
index b99fae5fc..3616885dd 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/dashboard/GlobalProgressChart.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/dashboard/GlobalProgressChart.java
@@ -19,7 +19,7 @@
package org.libreplan.web.dashboard;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.math.BigDecimal;
import java.util.ArrayList;
@@ -52,13 +52,13 @@ public class GlobalProgressChart {
private List series = new ArrayList<>();
private GlobalProgressChart() {
- series.add(Series.create(_("Current"), "#004469"));
- series.add(Series.create(_("Expected"), "#3C90BE"));
+ series.add(Series.create(tr("Current"), "#004469"));
+ series.add(Series.create(tr("Expected"), "#3C90BE"));
- SPREAD_PROGRESS = _("Spreading progress");
- ALL_TASKS_HOURS = _("By all tasks hours");
- CRITICAL_PATH_HOURS = _("By critical path hours");
- CRITICAL_PATH_DURATION = _("By critical path duration");
+ SPREAD_PROGRESS = tr("Spreading progress");
+ ALL_TASKS_HOURS = tr("By all tasks hours");
+ CRITICAL_PATH_HOURS = tr("By critical path hours");
+ CRITICAL_PATH_DURATION = tr("By critical path duration");
}
public void current(String key, BigDecimal value) {
@@ -119,8 +119,8 @@ public class GlobalProgressChart {
public void render() {
String params = String.format(
"'{\"title\": %s, \"label\": %s, \"ticks\": %s, \"series\": %s}'",
- jsonify(_("Project progress percentage")),
- jsonify(_("Progress percentage per progress type")),
+ jsonify(tr("Project progress percentage")),
+ jsonify(tr("Progress percentage per progress type")),
getTicks(), getSeries());
String command = String.format("global_progress.render(%s, %s);", getPercentages(), params);
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/email/EmailTemplateController.java b/libreplan-webapp/src/main/java/org/libreplan/web/email/EmailTemplateController.java
index d254bee70..7091dab17 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/email/EmailTemplateController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/email/EmailTemplateController.java
@@ -40,7 +40,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Controller for page Edit email templates.
@@ -95,7 +95,7 @@ public class EmailTemplateController extends GenericForwardComposer {
setSelectedSubject();
emailTemplateModel.confirmSave();
messages.clearMessages();
- messages.showMessage(Level.INFO, _("E-mail template saved"));
+ messages.showMessage(Level.INFO, tr("E-mail template saved"));
return true;
} catch (ValidationException e) {
@@ -182,7 +182,7 @@ public class EmailTemplateController extends GenericForwardComposer {
public ListitemRenderer getEmailTemplateEnumRenderer() {
return (item, data, i) -> {
EmailTemplateEnum template = (EmailTemplateEnum) data;
- item.setLabel(_(template.getTemplateType()));
+ item.setLabel(tr(template.getTemplateType()));
item.setValue(template);
};
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/exceptionDays/CalendarExceptionTypeCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/exceptionDays/CalendarExceptionTypeCRUDController.java
index c0398b7a2..6077b55fe 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/exceptionDays/CalendarExceptionTypeCRUDController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/exceptionDays/CalendarExceptionTypeCRUDController.java
@@ -18,7 +18,7 @@
*/
package org.libreplan.web.exceptionDays;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ConcurrentModificationException;
import java.util.List;
@@ -77,7 +77,7 @@ public class CalendarExceptionTypeCRUDController extends BaseCRUDController confirmRemove(row.getValue()));
row.appendChild(delete);
}
@@ -426,7 +426,7 @@ public class ExpenseSheetCRUDController
bandboxSearch.setListboxEventListener(Events.ON_SELECT, eventListenerUpdateOrderElement);
bandboxSearch.setListboxEventListener(Events.ON_OK, eventListenerUpdateOrderElement);
bandboxSearch.setBandboxEventListener(Events.ON_CHANGING, eventListenerUpdateOrderElement);
- bandboxSearch.setBandboxConstraint("no empty:" + _(NOT_EMPTY));
+ bandboxSearch.setBandboxConstraint("no empty:" + tr(NOT_EMPTY));
row.appendChild(bandboxSearch);
}
@@ -436,14 +436,14 @@ public class ExpenseSheetCRUDController
String code = (String) value;
if (code == null || code.isEmpty()) {
- throw new WrongValueException(comp, _("Code cannot be empty."));
+ throw new WrongValueException(comp, tr("Code cannot be empty."));
} else {
String oldCode = line.getCode();
line.setCode(code);
if (!getExpenseSheet().isNonRepeatedExpenseSheetLinesCodesConstraint()) {
line.setCode(oldCode);
- throw new WrongValueException(comp, _("The code must be unique."));
+ throw new WrongValueException(comp, tr("The code must be unique."));
}
}
}
@@ -465,7 +465,7 @@ public class ExpenseSheetCRUDController
return (comp, value) -> {
BigDecimal expenseValue = (BigDecimal) value;
if (expenseValue == null || expenseValue.compareTo(BigDecimal.ZERO) < 0) {
- throw new WrongValueException(comp, _("must be greater or equal than 0"));
+ throw new WrongValueException(comp, tr("must be greater or equal than 0"));
}
};
}
@@ -476,11 +476,11 @@ public class ExpenseSheetCRUDController
String code = (String) value;
if (code == null || code.isEmpty()) {
- throw new WrongValueException(comp, _("The code cannot be empty and it must be unique."));
+ throw new WrongValueException(comp, tr("The code cannot be empty and it must be unique."));
} else if (!getExpenseSheet().isUniqueCodeConstraint()) {
throw new WrongValueException(
- comp, _("it already exists another expense sheet with the same code."));
+ comp, tr("it already exists another expense sheet with the same code."));
}
}
};
@@ -530,12 +530,12 @@ public class ExpenseSheetCRUDController
@Override
protected String getEntityType() {
- return _("Expense Sheet");
+ return tr("Expense Sheet");
}
@Override
protected String getPluralEntityType() {
- return _("Expense Sheets");
+ return tr("Expense Sheets");
}
public String getCurrencySymbol() {
@@ -603,7 +603,7 @@ public class ExpenseSheetCRUDController
}
private String getType(ExpenseSheet expenseSheet) {
- return expenseSheet != null && expenseSheet.isPersonal() ? _("Personal") : _("Regular");
+ return expenseSheet != null && expenseSheet.isPersonal() ? tr("Personal") : tr("Regular");
}
public RowRenderer getExpenseSheetsRenderer() {
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/externalcompanies/ExternalCompanyCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/externalcompanies/ExternalCompanyCRUDController.java
index fa6ff4dc3..d01a24dd7 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/externalcompanies/ExternalCompanyCRUDController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/externalcompanies/ExternalCompanyCRUDController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.externalcompanies;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.List;
@@ -119,9 +119,9 @@ public class ExternalCompanyCRUDController extends BaseCRUDController {
public void onChangeLabelName(Event e) {
InputEvent ie = (InputEvent) e;
if ( !labelTypeModel.labelNameIsUnique(ie.getValue()) ) {
- throw new WrongValueException(e.getTarget(), _("{0} already exists", ie.getValue()));
+ throw new WrongValueException(e.getTarget(), tr("{0} already exists", ie.getValue()));
}
}
@@ -286,12 +286,12 @@ public class LabelTypeCRUDController extends BaseCRUDController {
@Override
protected String getEntityType() {
- return _("Label Type");
+ return tr("Label Type");
}
@Override
protected String getPluralEntityType() {
- return _("Label Types");
+ return tr("Label Types");
}
@Override
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/labels/LabelTypeModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/labels/LabelTypeModel.java
index 588979c35..6331d63a8 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/labels/LabelTypeModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/labels/LabelTypeModel.java
@@ -22,7 +22,7 @@
package org.libreplan.web.labels;
import static org.libreplan.business.common.exceptions.ValidationException.invalidValue;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.Collections;
@@ -151,7 +151,7 @@ public class LabelTypeModel extends IntegrationEntityModel implements
}
private InvalidValue createInvalidValue(LabelType labelType) {
- return invalidValue(_("{0} already exists", labelType.getName()),
+ return invalidValue(tr("{0} already exists", labelType.getName()),
"name", labelType.getName(), labelType);
}
@@ -177,7 +177,7 @@ public class LabelTypeModel extends IntegrationEntityModel implements
}
private InvalidValue createInvalidValue(Label label) {
- return invalidValue(_("{0} already exists", label.getName()), "name",
+ return invalidValue(tr("{0} already exists", label.getName()), "name",
label.getName(), label);
}
@@ -264,7 +264,7 @@ public class LabelTypeModel extends IntegrationEntityModel implements
for (Label label : labelType.getLabels()) {
if (name.equals(label.getName())) {
throw new ValidationException(
- invalidValue(_("Already exists other "
+ invalidValue(tr("Already exists other "
+ "label with the same name"), "name", name,
getLabelType()));
}
@@ -275,7 +275,7 @@ public class LabelTypeModel extends IntegrationEntityModel implements
public void validateNameNotEmpty(String name) throws ValidationException {
if (name.isEmpty()) {
throw new ValidationException(invalidValue(
- _("The name of the label is empty."),
+ tr("The name of the label is empty."),
"name", "", getLabelType()));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/limitingresources/LimitingResourcesController.java b/libreplan-webapp/src/main/java/org/libreplan/web/limitingresources/LimitingResourcesController.java
index 9064fd304..9f04757b6 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/limitingresources/LimitingResourcesController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/limitingresources/LimitingResourcesController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.limitingresources;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.Arrays;
@@ -328,7 +328,7 @@ public class LimitingResourcesController extends GenericForwardComposer {
LimitingResourceQueueElement queueElement = element.getOriginal();
@@ -448,9 +448,9 @@ public class LimitingResourcesController extends GenericForwardComposer showManualAllocationWindow(element.getOriginal()));
@@ -461,7 +461,7 @@ public class LimitingResourcesController extends GenericForwardComposer removeUnassignedLimitingResourceQueueElement(element));
@@ -476,9 +476,9 @@ public class LimitingResourcesController extends GenericForwardComposer assignLimitingResourceQueueElement(element));
@@ -492,7 +492,7 @@ public class LimitingResourcesController extends GenericForwardComposer resourceAllocation = element.getResourceAllocation();
if ( resourceAllocation instanceof SpecificResourceAllocation ) {
final SpecificResourceAllocation specific = (SpecificResourceAllocation) resourceAllocation;
- result.append(_("Resource: {0}", specific.getResource().getName())).append(" ");
+ result.append(tr("Resource: {0}", specific.getResource().getName())).append(" ");
} else if ( resourceAllocation instanceof GenericResourceAllocation ) {
final GenericResourceAllocation generic = (GenericResourceAllocation) resourceAllocation;
/* TODO resolve deprecated */
- result.append(_("Criteria: {0}", Criterion.getCaptionFor(generic.getCriterions()))).append(" ");
+ result.append(tr("Criteria: {0}", Criterion.getCaptionFor(generic.getCriterions()))).append(" ");
}
- result.append(_("Allocation: [{0},{1}]", element.getStartDate().toString(), element.getEndDate()));
+ result.append(tr("Allocation: [{0},{1}]", element.getStartDate().toString(), element.getEndDate()));
return result.toString();
}
@@ -393,7 +393,7 @@ public class QueueComponent extends XulElement implements AfterCompose {
Div notWorkableHoursShade = new Div();
- notWorkableHoursShade.setTooltiptext(_("Workable capacity for this period ") + workableHours + _(" hours"));
+ notWorkableHoursShade.setTooltiptext(tr("Workable capacity for this period ") + workableHours + tr(" hours"));
notWorkableHoursShade.setContext("");
notWorkableHoursShade.setSclass("not-workable-hours");
notWorkableHoursShade.setStyle("left: " + shadeLeft + "px; width: " + shadeWidth.intValue() + "px;");
@@ -490,7 +490,7 @@ public class QueueComponent extends XulElement implements AfterCompose {
private static void validateQueueElement(LimitingResourceQueueElement queueElement) {
if ( (queueElement.getStartDate() == null ) || ( queueElement.getEndDate() == null) ) {
- throw new ValidationException(_("Invalid queue element"));
+ throw new ValidationException(tr("Invalid queue element"));
}
}
@@ -499,11 +499,11 @@ public class QueueComponent extends XulElement implements AfterCompose {
MenuBuilder menuBuilder = MenuBuilder.on(divElement.getPage(), divElement);
menuBuilder.item(
- _("Edit"), "/common/img/ico_editar.png", (chosen, event) -> editResourceAllocation(chosen));
+ tr("Edit"), "/common/img/ico_editar.png", (chosen, event) -> editResourceAllocation(chosen));
- menuBuilder.item(_("Unassign"), "/common/img/ico_borrar.png", (chosen, event) -> unassign(chosen));
+ menuBuilder.item(tr("Unassign"), "/common/img/ico_borrar.png", (chosen, event) -> unassign(chosen));
- menuBuilder.item(_("Move"), "", (chosen, event) -> moveQueueTask(chosen));
+ menuBuilder.item(tr("Move"), "", (chosen, event) -> moveQueueTask(chosen));
divElement.setContext(menuBuilder.createWithoutSettingContext());
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/logs/IssueLogCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/logs/IssueLogCRUDController.java
index 02c2f28bb..a63d8de52 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/logs/IssueLogCRUDController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/logs/IssueLogCRUDController.java
@@ -48,7 +48,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
@@ -257,25 +257,25 @@ public class IssueLogCRUDController extends BaseCRUDController {
public ArrayList getIssueStatusEnum() {
ArrayList result = new ArrayList<>();
if (getIssueLog().getType() == IssueTypeEnum.REQUEST_FOR_CHANGE){
- result.add(_("Must have"));
- result.add(_("Should have"));
- result.add(_("Could have"));
- result.add(_("Won't have"));
+ result.add(tr("Must have"));
+ result.add(tr("Should have"));
+ result.add(tr("Could have"));
+ result.add(tr("Won't have"));
return result;
}
if (getIssueLog().getType() == IssueTypeEnum.PROBLEM_OR_CONCERN) {
- result.add(_("Minor"));
- result.add(_("Significant"));
- result.add(_("Major"));
- result.add(_("Critical"));
+ result.add(tr("Minor"));
+ result.add(tr("Significant"));
+ result.add(tr("Major"));
+ result.add(tr("Critical"));
return result;
}
- result.add(_("Low"));
- result.add(_("Medium"));
- result.add(_("High"));
+ result.add(tr("Low"));
+ result.add(tr("Medium"));
+ result.add(tr("High"));
return result;
}
@@ -407,12 +407,12 @@ public class IssueLogCRUDController extends BaseCRUDController {
@Override
protected String getEntityType() {
- return _("issuelog-number");
+ return tr("issuelog-number");
}
@Override
protected String getPluralEntityType() {
- return _("Issue logs");
+ return tr("Issue logs");
}
@Override
@@ -430,11 +430,11 @@ public class IssueLogCRUDController extends BaseCRUDController {
@Override
protected void save() throws ValidationException {
if (getIssueLog().getOrder() == null) {
- throw new WrongValueException(bdProjectIssueLog, _("please select a project"));
+ throw new WrongValueException(bdProjectIssueLog, tr("please select a project"));
}
if (getIssueLog().getCreatedBy() == null) {
- throw new WrongValueException(bdUserIssueLog, _("please select an author"));
+ throw new WrongValueException(bdUserIssueLog, tr("please select an author"));
}
getIssueLog().setStatus(status.getSelectedItem().getLabel());
issueLogModel.confirmSave();
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/logs/RiskLogCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/logs/RiskLogCRUDController.java
index 75ff58802..d42681537 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/logs/RiskLogCRUDController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/logs/RiskLogCRUDController.java
@@ -48,7 +48,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Controller for RiskLog CRUD actions.
@@ -389,12 +389,12 @@ public class RiskLogCRUDController extends BaseCRUDController {
@Override
protected String getEntityType() {
- return _("Issue log");
+ return tr("Issue log");
}
@Override
protected String getPluralEntityType() {
- return _("Issue logs");
+ return tr("Issue logs");
}
@Override
@@ -410,11 +410,11 @@ public class RiskLogCRUDController extends BaseCRUDController {
@Override
protected void save() throws ValidationException {
if (getRiskLog().getOrder() == null) {
- throw new WrongValueException(bdProjectRiskLog, _("please select a project"));
+ throw new WrongValueException(bdProjectRiskLog, tr("please select a project"));
}
if (getRiskLog().getCreatedBy() == null) {
- throw new WrongValueException(bdUserRiskLog, _("please select an author"));
+ throw new WrongValueException(bdUserRiskLog, tr("please select an author"));
}
riskLogModel.confirmSave();
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/materials/MaterialsController.java b/libreplan-webapp/src/main/java/org/libreplan/web/materials/MaterialsController.java
index 2447394c6..801ca94da 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/materials/MaterialsController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/materials/MaterialsController.java
@@ -65,7 +65,7 @@ import java.util.List;
import java.util.Set;
import java.util.ArrayList;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Controller for {@link Material} materials
@@ -244,7 +244,7 @@ public class MaterialsController extends GenericForwardComposer {
Button btnDelete = new Button("", "/common/img/ico_borrar1.png");
btnDelete.setHoverImage("/common/img/ico_borrar.png");
btnDelete.setSclass("icono");
- btnDelete.setTooltiptext(_("Delete"));
+ btnDelete.setTooltiptext(tr("Delete"));
btnDelete.addEventListener(Events.ON_CLICK, event -> confirmRemove(materialCategory));
btnDelete.setDisabled(hasSubcategoriesOrMaterials(materialCategory));
Treecell tc = new Treecell();
@@ -258,8 +258,8 @@ public class MaterialsController extends GenericForwardComposer {
public void confirmRemove(MaterialCategory materialCategory) {
- int status = Messagebox.show(_("Confirm deleting {0}. Are you sure?",
- materialCategory.getName()), _("Delete"),
+ int status = Messagebox.show(tr("Confirm deleting {0}. Are you sure?",
+ materialCategory.getName()), tr("Delete"),
Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
if (Messagebox.OK == status) {
@@ -275,7 +275,7 @@ public class MaterialsController extends GenericForwardComposer {
public void addMaterialCategory() {
String categoryName = txtCategory.getValue();
if (categoryName == null || categoryName.isEmpty()) {
- throw new WrongValueException(txtCategory, _("cannot be empty"));
+ throw new WrongValueException(txtCategory, tr("cannot be empty"));
}
MaterialCategory parent = null;
@@ -294,7 +294,7 @@ public class MaterialsController extends GenericForwardComposer {
MaterialCategory materialCategory = (MaterialCategory) value;
Component comp = findInMaterialCategoryTree(materialCategory);
if (comp != null) {
- throw new WrongValueException(comp, _(invalidValue.getMessage()));
+ throw new WrongValueException(comp, tr(invalidValue.getMessage()));
}
}
}
@@ -332,7 +332,7 @@ public class MaterialsController extends GenericForwardComposer {
public void addMaterialToMaterialCategory(Treeitem treeitem) {
if (treeitem == null) {
- throw new WrongValueException(btnAddMaterial, _("Cannot insert material in general view. Please, select a category"));
+ throw new WrongValueException(btnAddMaterial, tr("Cannot insert material in general view. Please, select a category"));
}
final MaterialCategory materialCategory = treeitem.getValue();
materialsModel.addMaterialToMaterialCategory(materialCategory);
@@ -341,7 +341,7 @@ public class MaterialsController extends GenericForwardComposer {
public void saveAndContinue() {
if (save()) {
- messagesForUser.showMessage(Level.INFO, _("Materials saved"));
+ messagesForUser.showMessage(Level.INFO, tr("Materials saved"));
// Reload materials and categories, keep track of category currently being selected
final Treeitem treeitem = categoriesTree.getSelectedItem();
materialsModel.reloadMaterialCategories();
@@ -390,10 +390,10 @@ public class MaterialsController extends GenericForwardComposer {
final Treeitem treeitem = findTreeItemByMaterialCategory(categoriesTree, materialCategory);
if (treeitem != null) {
if (each.getPropertyPath().equals("name")) {
- throw new WrongValueException(getCategoryTextbox(treeitem), _(each.getMessage()));
+ throw new WrongValueException(getCategoryTextbox(treeitem), tr(each.getMessage()));
}
if (each.getPropertyPath().equals("code")) {
- throw new WrongValueException(getCategoryCodeTextbox(treeitem), _(each.getMessage()));
+ throw new WrongValueException(getCategoryCodeTextbox(treeitem), tr(each.getMessage()));
}
}
}
@@ -458,10 +458,10 @@ public class MaterialsController extends GenericForwardComposer {
Treeitem treeitem = categoriesTree.getSelectedItem();
if (treeitem != null) {
materialsCaption.setLabel(
- _("List of materials for category: {0}", ((MaterialCategory) treeitem.getValue()).getName()));
+ tr("List of materials for category: {0}", ((MaterialCategory) treeitem.getValue()).getName()));
}
else {
- materialsCaption.setLabel(_("List of materials for all categories (select one to filter)"));
+ materialsCaption.setLabel(tr("List of materials for all categories (select one to filter)"));
}
}
@@ -490,7 +490,7 @@ public class MaterialsController extends GenericForwardComposer {
Util.reloadBindings(gridMaterials);
}
else {
- messagesForUser.showMessage(Level.ERROR, _("Cannot delete that material because it is assigned to a project."));
+ messagesForUser.showMessage(Level.ERROR, tr("Cannot delete that material because it is assigned to a project."));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/materials/MaterialsModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/materials/MaterialsModel.java
index 946413a99..09601d8d1 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/materials/MaterialsModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/materials/MaterialsModel.java
@@ -22,7 +22,7 @@
package org.libreplan.web.materials;
import static org.libreplan.business.common.exceptions.ValidationException.invalidValue;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.Collection;
@@ -166,7 +166,7 @@ public class MaterialsModel extends IntegrationEntityModel implements IMaterials
Validate.notNull(categoryName);
Boolean generateCode = configurationDAO.getConfiguration().getGenerateCodeForMaterialCategories();
- MaterialCategory child = MaterialCategory.createUnvalidated("", _(categoryName));
+ MaterialCategory child = MaterialCategory.createUnvalidated("", tr(categoryName));
if ( generateCode ) {
setCurrentMaterialCategory(child);
setDefaultCode();
@@ -176,7 +176,7 @@ public class MaterialsModel extends IntegrationEntityModel implements IMaterials
final MaterialCategory materialCategory = findMaterialCategory(child);
if ( materialCategory != null ) {
throw new ValidationException(invalidValue(
- _("{0} already exists", materialCategory.getName()),
+ tr("{0} already exists", materialCategory.getName()),
"name", materialCategory.getName(), materialCategory));
}
@@ -278,7 +278,7 @@ public class MaterialsModel extends IntegrationEntityModel implements IMaterials
}
private String sameCodeMessage(Material first, Material second) {
- return _(
+ return tr(
"both {0} of category {1} and {2} of category {3} have the same code",
asStringForUser(first), first.getCategory().getName(),
asStringForUser(second), second.getCategory().getName());
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/materials/UnitTypeController.java b/libreplan-webapp/src/main/java/org/libreplan/web/materials/UnitTypeController.java
index b3daee4be..e3d3dc701 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/materials/UnitTypeController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/materials/UnitTypeController.java
@@ -44,7 +44,7 @@ import org.zkoss.zkplus.spring.SpringUtil;
import java.util.ConcurrentModificationException;
import java.util.List;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Controller for the listing and editing unit types.
@@ -123,12 +123,12 @@ public class UnitTypeController extends BaseCRUDController {
public void validate(Component comp, Object value) {
String strValue = (String) value;
if (StringUtils.isBlank(strValue)) {
- throw new WrongValueException(comp, _("cannot be empty"));
+ throw new WrongValueException(comp, tr("cannot be empty"));
}
if (unitTypeModel.existsAnotherUnitTypeWithName(strValue)) {
throw new WrongValueException(comp,
- _("The meausure name is not valid. There is " +
+ tr("The meausure name is not valid. There is " +
"another unit type with the same " +
"measure name"));
}
@@ -143,12 +143,12 @@ public class UnitTypeController extends BaseCRUDController {
public void validate(Component comp, Object value) {
String strValue = (String) value;
if (StringUtils.isBlank(strValue)) {
- throw new WrongValueException(comp, _("cannot be empty"));
+ throw new WrongValueException(comp, tr("cannot be empty"));
}
if (unitTypeModel.existsAnotherUnitTypeWithCode(strValue)) {
throw new WrongValueException(comp,
- _("The code is not valid. There is another " +
+ tr("The code is not valid. There is another " +
"unit type with the same code"));
}
}
@@ -176,12 +176,12 @@ public class UnitTypeController extends BaseCRUDController {
@Override
protected String getEntityType() {
- return _("Material Unit");
+ return tr("Material Unit");
}
@Override
protected String getPluralEntityType() {
- return _("Material Units");
+ return tr("Material Units");
}
@Override
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/montecarlo/MonteCarloController.java b/libreplan-webapp/src/main/java/org/libreplan/web/montecarlo/MonteCarloController.java
index 70f7f336a..1bb3d0de1 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/montecarlo/MonteCarloController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/montecarlo/MonteCarloController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.montecarlo;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.math.BigDecimal;
import java.util.HashMap;
@@ -137,11 +137,11 @@ public class MonteCarloController extends GenericForwardComposer {
int iterations = ibIterations.getValue() != null ? ibIterations.getValue().intValue() : 0;
if ( iterations == 0 ) {
- throw new WrongValueException(ibIterations, _("cannot be empty"));
+ throw new WrongValueException(ibIterations, tr("cannot be empty"));
}
if ( iterations < 0 || iterations > MAX_NUMBER_ITERATIONS ) {
- throw new WrongValueException(ibIterations, _("Number of iterations should be between 1 and {0}",
+ throw new WrongValueException(ibIterations, tr("Number of iterations should be between 1 and {0}",
MAX_NUMBER_ITERATIONS));
}
@@ -169,7 +169,7 @@ public class MonteCarloController extends GenericForwardComposer {
if ( sum != 100 ) {
gridCriticalPathTasks.setActivePage(page);
- throw new WrongValueException(row, _("Percentages should sum 100"));
+ throw new WrongValueException(row, tr("Percentages should sum 100"));
}
counter++;
@@ -268,9 +268,9 @@ public class MonteCarloController extends GenericForwardComposer {
Integer iterationNumber = value != null ? (Integer) value : -1;
if (iterationNumber == -1) {
- throw new WrongValueException(comp, _("cannot be empty"));
+ throw new WrongValueException(comp, tr("cannot be empty"));
} else if (iterationNumber < 1 || iterationNumber > 100_000) {
- throw new WrongValueException(comp, _("Number of iterations should be between 1 and {0}",
+ throw new WrongValueException(comp, tr("Number of iterations should be between 1 and {0}",
MAX_NUMBER_ITERATIONS));
}
};
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/montecarlo/MonteCarloModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/montecarlo/MonteCarloModel.java
index a1e81e4c2..580ecf324 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/montecarlo/MonteCarloModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/montecarlo/MonteCarloModel.java
@@ -21,7 +21,7 @@
package org.libreplan.web.montecarlo;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.math.BigDecimal;
import java.math.RoundingMode;
@@ -65,7 +65,7 @@ public class MonteCarloModel implements IMonteCarloModel {
@Autowired
private ITaskElementDAO taskDAO;
- private static String criticalPath = _("Critical path");
+ private static String criticalPath = tr("Critical path");
private static String defaultCriticalPath = criticalPath + " 1";
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/AssignedTaskQualityFormsToOrderElementController.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/AssignedTaskQualityFormsToOrderElementController.java
index 358f18c58..daa1d0175 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/AssignedTaskQualityFormsToOrderElementController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/AssignedTaskQualityFormsToOrderElementController.java
@@ -59,7 +59,7 @@ import java.util.List;
import com.libreplan.java.zk.components.customdetailrowcomponent.Detail;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Controller for showing OrderElement assigned task quality forms.
@@ -168,11 +168,11 @@ public class AssignedTaskQualityFormsToOrderElementController extends GenericFor
QualityForm qualityForm = (QualityForm) qualityFormFinder.getSelectedElement();
if (qualityForm == null) {
- throw new WrongValueException(qualityFormFinder, _("please, select a quality form"));
+ throw new WrongValueException(qualityFormFinder, tr("please, select a quality form"));
}
if (checkQualityFormAssigned.isAssigned(qualityForm)) {
- throw new WrongValueException(qualityFormFinder, _("already assigned"));
+ throw new WrongValueException(qualityFormFinder, tr("already assigned"));
}
qualityFormFinder.clear();
@@ -190,8 +190,8 @@ public class AssignedTaskQualityFormsToOrderElementController extends GenericFor
public void confirmRemove(TaskQualityForm taskQualityForm) {
int status = Messagebox.show(
- _("Confirm deleting {0}. Are you sure?", getTaskQualityFormName(taskQualityForm)),
- _(DELETE_ACTION), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
+ tr("Confirm deleting {0}. Are you sure?", getTaskQualityFormName(taskQualityForm)),
+ tr(DELETE_ACTION), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
if (Messagebox.OK == status) {
deleteTaskQualityForm(taskQualityForm);
@@ -268,7 +268,7 @@ public class AssignedTaskQualityFormsToOrderElementController extends GenericFor
appendDetails(row, taskQualityForm);
appendNewLabel(row, taskQualityForm.getQualityForm().getName());
- appendNewLabel(row, _(taskQualityForm.getQualityForm().getQualityFormType().toString()));
+ appendNewLabel(row, tr(taskQualityForm.getQualityForm().getQualityFormType().toString()));
appendCheckboxReportAdvance(row, taskQualityForm);
appendOperations(row);
}
@@ -299,7 +299,7 @@ public class AssignedTaskQualityFormsToOrderElementController extends GenericFor
} catch (DuplicateAdvanceAssignmentForOrderElementException e) {
messages.showMessage(
Level.ERROR,
- _("Another task in the same branch is already reporting progress" +
+ tr("Another task in the same branch is already reporting progress" +
" for this quality form"));
tmpCheckbox.setChecked(false);
@@ -350,25 +350,25 @@ public class AssignedTaskQualityFormsToOrderElementController extends GenericFor
// Add static headers
Column columnName = new Column();
- columnName.setLabel(_("Name"));
+ columnName.setLabel(tr("Name"));
Util.setSort(columnName, "auto=(name)");
columnName.setSortDirection(ASCENDING);
columns.appendChild(columnName);
Column columnPosition = new Column();
- columnPosition.setLabel(_("Position"));
+ columnPosition.setLabel(tr("Position"));
columns.appendChild(columnPosition);
Column columnPercentage = new Column();
- columnPercentage.setLabel(_("Percentage"));
+ columnPercentage.setLabel(tr("Percentage"));
columns.appendChild(columnPercentage);
Column columnPassed = new Column();
- columnPassed.setLabel(_("Checked"));
+ columnPassed.setLabel(tr("Checked"));
columns.appendChild(columnPassed);
Column columnDate = new Column();
- columnDate.setLabel(_("Date"));
+ columnDate.setLabel(tr("Date"));
columns.appendChild(columnDate);
columns.setParent(gridItems);
@@ -380,7 +380,7 @@ public class AssignedTaskQualityFormsToOrderElementController extends GenericFor
buttonRemove.setClass("icono");
buttonRemove.setImage("/common/img/ico_borrar1.png");
buttonRemove.setHoverImage("/common/img/ico_borrar.png");
- buttonRemove.setTooltiptext(_(DELETE_ACTION));
+ buttonRemove.setTooltiptext(tr(DELETE_ACTION));
buttonRemove.addEventListener(Events.ON_CLICK, event -> confirmRemove(row.getValue()));
}
@@ -391,7 +391,7 @@ public class AssignedTaskQualityFormsToOrderElementController extends GenericFor
}
private void showInformativeMessage(String message) {
- Messagebox.show(_(message), _(DELETE_ACTION), Messagebox.OK, Messagebox.ERROR);
+ Messagebox.show(tr(message), tr(DELETE_ACTION), Messagebox.OK, Messagebox.ERROR);
}
private class TaskQualityFormItemsRowRenderer implements RowRenderer {
@@ -465,11 +465,11 @@ public class AssignedTaskQualityFormsToOrderElementController extends GenericFor
if ((value == null) && (!item.isIfDateCanBeNullConstraint())) {
item.setDate(null);
- throw new WrongValueException(comp, _("date not specified"));
+ throw new WrongValueException(comp, tr("date not specified"));
}
if (!assignedTaskQualityFormsToOrderElementModel.isCorrectConsecutiveDate(taskQualityForm, item)) {
item.setDate(null);
- throw new WrongValueException(comp, _("must be after the previous date"));
+ throw new WrongValueException(comp, tr("must be after the previous date"));
}
}
};
@@ -562,13 +562,13 @@ public class AssignedTaskQualityFormsToOrderElementController extends GenericFor
if (TaskQualityFormItem.propertyDate.equals(propertyName)) {
openDetails(rowItem);
Datebox datebox = getDatebox(rowItem);
- throw new WrongValueException(datebox, _(invalidValue.getMessage()));
+ throw new WrongValueException(datebox, tr(invalidValue.getMessage()));
}
if (TaskQualityFormItem.propertyPassed.equals(propertyName)) {
openDetails(rowItem);
Checkbox checkbox = getCheckbox(rowItem);
- throw new WrongValueException(checkbox, _(invalidValue.getMessage()));
+ throw new WrongValueException(checkbox, tr(invalidValue.getMessage()));
}
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/AssignedTaskQualityFormsToOrderElementModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/AssignedTaskQualityFormsToOrderElementModel.java
index 2bd3714cc..2492b3247 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/AssignedTaskQualityFormsToOrderElementModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/AssignedTaskQualityFormsToOrderElementModel.java
@@ -22,7 +22,7 @@
package org.libreplan.web.orders;
import static org.libreplan.business.common.exceptions.ValidationException.invalidValue;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.math.BigDecimal;
import java.util.ArrayList;
@@ -273,7 +273,7 @@ public class AssignedTaskQualityFormsToOrderElementModel implements IAssignedTas
if ((!taskQualityForm.isByItems()) && (!taskQualityForm.isCorrectConsecutivePassed(item))) {
throw new ValidationException(invalidValue(
- _("cannot be checked until the previous item is checked before"),
+ tr("cannot be checked until the previous item is checked before"),
"passed",
item.getName(),
taskQualityForm));
@@ -282,7 +282,7 @@ public class AssignedTaskQualityFormsToOrderElementModel implements IAssignedTas
if ((!taskQualityForm.isByItems()) && (!taskQualityForm.isCorrectConsecutiveDate(item))) {
throw new ValidationException(invalidValue(
- _("must be after the previous date"),
+ tr("must be after the previous date"),
"date",
item.getName(),
taskQualityForm));
@@ -290,7 +290,7 @@ public class AssignedTaskQualityFormsToOrderElementModel implements IAssignedTas
if (!item.isIfDateCanBeNullConstraint()) {
throw new ValidationException(invalidValue(
- _("date not specified"),
+ tr("date not specified"),
"date",
item.getName(),
taskQualityForm));
@@ -341,7 +341,7 @@ public class AssignedTaskQualityFormsToOrderElementModel implements IAssignedTas
}
private void showMessageDeleteSpread() throws ValidationException {
- throw new ValidationException(_("Quality form cannot be removed as it is spreading progress"));
+ throw new ValidationException(tr("Quality form cannot be removed as it is spreading progress"));
}
@Override
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/CriterionRequirementWrapper.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/CriterionRequirementWrapper.java
index c1140dc1d..6d41c2886 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/CriterionRequirementWrapper.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/CriterionRequirementWrapper.java
@@ -25,7 +25,7 @@
package org.libreplan.web.orders;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import org.libreplan.business.INewObject;
import org.libreplan.business.requirements.entities.CriterionRequirement;
@@ -43,7 +43,7 @@ import org.libreplan.business.resources.entities.ResourceEnum;
*/
public class CriterionRequirementWrapper implements INewObject {
- private final String DIRECT = _("Direct");
+ private final String DIRECT = tr("Direct");
private String type;
@@ -84,7 +84,7 @@ public class CriterionRequirementWrapper implements INewObject {
}
public static String getIndirectTypeLabel() {
- return _("Inherited");
+ return tr("Inherited");
}
public CriterionWithItsType getCriterionWithItsType() {
@@ -213,7 +213,7 @@ public class CriterionRequirementWrapper implements INewObject {
}
public String getLabelValidate() {
- return isValid() ? _("Invalidate") : _("Validate");
+ return isValid() ? tr("Invalidate") : tr("Validate");
}
public boolean isUpdatable(){
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/DetailsOrderElementController.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/DetailsOrderElementController.java
index 705126070..0e0498b95 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/DetailsOrderElementController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/DetailsOrderElementController.java
@@ -32,7 +32,7 @@ import org.zkoss.zul.Datebox;
import java.util.Date;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Controller for {@link OrderElement} details.
@@ -117,7 +117,7 @@ public class DetailsOrderElementController extends GenericForwardComposer {
if ( startBefore2010 ) {
initDate.setValue(null);
getOrderElement().setInitDate(null);
- throw new WrongValueException(comp, _("Must be after 2010!"));
+ throw new WrongValueException(comp, tr("Must be after 2010!"));
}
}
};
@@ -140,7 +140,7 @@ public class DetailsOrderElementController extends GenericForwardComposer {
if ( deadlineBeforeStart ) {
deadline.setValue(null);
getOrderElement().setDeadline(null);
- throw new WrongValueException(comp, _("must be after starting date"));
+ throw new WrongValueException(comp, tr("must be after starting date"));
}
}
};
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/DynamicDatebox.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/DynamicDatebox.java
index 53fd6a9d5..bcf5df207 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/DynamicDatebox.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/DynamicDatebox.java
@@ -21,7 +21,7 @@
package org.libreplan.web.orders;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.text.DateFormat;
import java.text.ParseException;
@@ -149,7 +149,7 @@ public class DynamicDatebox extends GenericForwardComposer {
} catch (ParseException e) {
throw new WrongValueException(
dateTextBox,
- _("Date format is wrong. Please, use the following format: {0}", asString(new Date())));
+ tr("Date format is wrong. Please, use the following format: {0}", asString(new Date())));
}
}
});
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/JiraSynchronizationController.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/JiraSynchronizationController.java
index 189b89cac..390051f2a 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/JiraSynchronizationController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/JiraSynchronizationController.java
@@ -19,7 +19,7 @@
package org.libreplan.web.orders;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.HashMap;
import java.util.LinkedList;
@@ -172,10 +172,10 @@ public class JiraSynchronizationController extends GenericForwardComposer {
jirasyncPopup.open(syncWithJiraButton, "before_start");
} catch (ConnectorException e) {
- messagesForUser.showMessage(Level.ERROR, _("Failed: {0}", e.getMessage()));
+ messagesForUser.showMessage(Level.ERROR, tr("Failed: {0}", e.getMessage()));
} catch (WebApplicationException e) {
LOG.info(e);
- messagesForUser.showMessage(Level.ERROR, _("Cannot connect to JIRA server"));
+ messagesForUser.showMessage(Level.ERROR, tr("Cannot connect to JIRA server"));
}
}
@@ -192,7 +192,7 @@ public class JiraSynchronizationController extends GenericForwardComposer {
List issues = jiraOrderElementSynchronizer.getJiraIssues(label);
if ( issues == null || issues.isEmpty() ) {
- messagesForUser.showMessage(Level.ERROR, _("No JIRA issues to import"));
+ messagesForUser.showMessage(Level.ERROR, tr("No JIRA issues to import"));
return;
}
@@ -219,10 +219,10 @@ public class JiraSynchronizationController extends GenericForwardComposer {
orderController.initEdit(order);
orderController.selectTab(previousTab.getId());
} catch (ConnectorException e) {
- messagesForUser.showMessage(Level.ERROR, _("Failed: {0}", e.getMessage()));
+ messagesForUser.showMessage(Level.ERROR, tr("Failed: {0}", e.getMessage()));
} catch (WebApplicationException e) {
LOG.info(e);
- messagesForUser.showMessage(Level.ERROR, _("Cannot connect to JIRA server"));
+ messagesForUser.showMessage(Level.ERROR, tr("Cannot connect to JIRA server"));
}
}
@@ -275,12 +275,12 @@ public class JiraSynchronizationController extends GenericForwardComposer {
private void setupJiraSyncPopup(Component comp, ListModel model) {
startJiraSyncButton = (Button) comp.getFellow("startJiraSyncButton");
- startJiraSyncButton.setLabel(_("Start sync"));
+ startJiraSyncButton.setLabel(tr("Start sync"));
startJiraSyncButton.addEventListener(Events.ON_CLICK, event -> startSyncWithJira(comboJiraLabel.getValue()));
cancelJiraSyncButton = (Button) comp.getFellow("cancelJiraSyncButton");
- cancelJiraSyncButton.setLabel(_("Cancel"));
+ cancelJiraSyncButton.setLabel(tr("Cancel"));
cancelJiraSyncButton.addEventListener(Events.ON_CLICK, event -> jirasyncPopup.close());
comboJiraLabel = (Combobox) comp.getFellowIfAny("comboJiraLabel");
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/ManageOrderElementAdvancesController.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/ManageOrderElementAdvancesController.java
index 124580804..7de7c1fe7 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/ManageOrderElementAdvancesController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/ManageOrderElementAdvancesController.java
@@ -22,7 +22,7 @@
package org.libreplan.web.orders;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.math.BigDecimal;
import java.util.Collections;
@@ -137,11 +137,11 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
private void validate() {
if ( !validateDataForm() )
- throw new IllegalSyntaxException(_("values are not valid, the values must not be null"));
+ throw new IllegalSyntaxException(tr("values are not valid, the values must not be null"));
if ( !validateReportGlobalAdvance() )
- throw new IllegalSyntaxException(_("Invalid Spread values. At least one value should be true"));
+ throw new IllegalSyntaxException(tr("Invalid Spread values. At least one value should be true"));
}
public boolean save() {
@@ -151,9 +151,9 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
return true;
} catch (DuplicateAdvanceAssignmentForOrderElementException e) {
- messagesForUser.showMessage(Level.ERROR, _("Cannot create another progress of the same type"));
+ messagesForUser.showMessage(Level.ERROR, tr("Cannot create another progress of the same type"));
} catch (DuplicateValueTrueReportGlobalAdvanceException e) {
- messagesForUser.showMessage(Level.ERROR, _("Invalid Spread values. At least one value should be true"));
+ messagesForUser.showMessage(Level.ERROR, tr("Invalid Spread values. At least one value should be true"));
} catch (IllegalSyntaxException e) {
messagesForUser.showMessage(Level.ERROR, e.getMessage());
} catch (InstanceNotFoundException e) {
@@ -257,7 +257,7 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
private void showInfoAbout(AdvanceAssignment advance) {
if ( manageOrderElementAdvancesModel.isSubcontractedAdvanceTypeAndSubcontractedTask(advance) )
- showErrorMessage(_("Subcontractor values are read only " +
+ showErrorMessage(tr("Subcontractor values are read only " +
"because they were reported by the subcontractor company."));
}
@@ -297,7 +297,7 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
showMessageDeleteSpread();
else if ( manageOrderElementAdvancesModel.hasConsolidatedAdvances(advance) )
- showErrorMessage(_("Progress Assignment cannot be deleted or changed. " +
+ showErrorMessage(tr("Progress Assignment cannot be deleted or changed. " +
"Progress Assignment contains Progress Consolidations values"));
else {
manageOrderElementAdvancesModel.removeLineAdvanceAssignment(advance);
@@ -322,7 +322,7 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
manageOrderElementAdvancesModel.removeLineAdvanceMeasurement(advance);
reloadAdvances();
} else
- showErrorMessage(_("Progress Measurement cannot be deleted. Progress Measurement already consolidated"));
+ showErrorMessage(tr("Progress Measurement cannot be deleted. Progress Measurement already consolidated"));
}
/** It should be public! */
@@ -330,8 +330,8 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
String infoAdvanceAssignment = manageOrderElementAdvancesModel.getInfoAdvanceAssignment();
return infoAdvanceAssignment.isEmpty()
- ? _("Progress measurements")
- : _("Progress measurements") + ": " + infoAdvanceAssignment;
+ ? tr("Progress measurements")
+ : tr("Progress measurements") + ": " + infoAdvanceAssignment;
}
public boolean isReadOnlyAdvanceMeasurements() {
@@ -426,7 +426,7 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
if (manageOrderElementAdvancesModel.hasConsolidatedAdvances(advanceAssignment))
throw new WrongValueException(
maxValue,
- _("Progress Assignment cannot be deleted or changed. " +
+ tr("Progress Assignment cannot be deleted or changed. " +
"Progress Assignment contains Progress Consolidations values"));
else {
setPercentage();
@@ -662,19 +662,19 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
if ( (advance.getAdvanceType() != null) && (advance.getAdvanceType().isQualityForm()) ) {
addMeasurementButton.setDisabled(true);
- addMeasurementButton.setTooltiptext(_("Progress that are reported by quality forms can not be modified"));
+ addMeasurementButton.setTooltiptext(tr("Progress that are reported by quality forms can not be modified"));
} else if ( (advance.getAdvanceType() != null) && (advance.getAdvanceType().isReadOnly()) ) {
addMeasurementButton.setDisabled(true);
- addMeasurementButton.setTooltiptext(_("This progress type cannot be modified"));
+ addMeasurementButton.setTooltiptext(tr("This progress type cannot be modified"));
} else if ( advance instanceof IndirectAdvanceAssignment ) {
addMeasurementButton.setDisabled(true);
- addMeasurementButton.setTooltiptext(_("Calculated progress can not be modified"));
+ addMeasurementButton.setTooltiptext(tr("Calculated progress can not be modified"));
} else if ( readOnly ) {
addMeasurementButton.setDisabled(true);
- addMeasurementButton.setTooltiptext(_("Subcontractor values are read only " +
+ addMeasurementButton.setTooltiptext(tr("Subcontractor values are read only " +
"because they were reported by the subcontractor company."));
}
@@ -690,28 +690,28 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
if ( (advance.getAdvanceType() != null) && (advance.getAdvanceType().isQualityForm()) ) {
removeButton.setDisabled(true);
- removeButton.setTooltiptext(_("Progress that are reported by quality forms cannot be modified"));
+ removeButton.setTooltiptext(tr("Progress that are reported by quality forms cannot be modified"));
} else if ( (advance.getAdvanceType() != null) && (advance.getAdvanceType().isReadOnly()) ) {
removeButton.setDisabled(true);
- removeButton.setTooltiptext(_("This progress type cannot be modified"));
+ removeButton.setTooltiptext(tr("This progress type cannot be modified"));
} else if ( advance instanceof IndirectAdvanceAssignment ) {
removeButton.setDisabled(true);
- removeButton.setTooltiptext(_("Calculated progress cannot be removed"));
+ removeButton.setTooltiptext(tr("Calculated progress cannot be removed"));
} else if ( manageOrderElementAdvancesModel.hasConsolidatedAdvances(advance) ) {
removeButton.setDisabled(true);
- removeButton.setTooltiptext(_("Consolidated progress cannot be removed"));
+ removeButton.setTooltiptext(tr("Consolidated progress cannot be removed"));
} else if ( readOnly ) {
removeButton.setDisabled(true);
- removeButton.setTooltiptext(_("Subcontractor values are read only " +
+ removeButton.setTooltiptext(tr("Subcontractor values are read only " +
"because they were reported by the subcontractor company"));
} else if ( manageOrderElementAdvancesModel.hasReportedProgress(advance) ) {
removeButton.setDisabled(true);
- removeButton.setTooltiptext(_("Advance assignment cannot be removed as " +
+ removeButton.setTooltiptext(tr("Advance assignment cannot be removed as " +
"it has advance measures that have already been reported to the customer"));
}
@@ -722,7 +722,7 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
boolean spread = true;
if ( manageOrderElementAdvancesModel.hasAnyConsolidatedAdvanceCurrentOrderElement() ) {
- showErrorMessage(_("Spread progress cannot be changed " +
+ showErrorMessage(tr("Spread progress cannot be changed " +
"if there is a consolidation in any progress assignment from root task"));
spread = false;
} else if ( !radioSpreadIsConsolidated() )
@@ -745,7 +745,7 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
if ( (advance.getReportGlobalAdvance()) &&
(manageOrderElementAdvancesModel.hasConsolidatedAdvances(advance)) ) {
- showErrorMessage(_("Spread progress cannot be changed " +
+ showErrorMessage(tr("Spread progress cannot be changed " +
"if there is a consolidation in any progress assignment"));
return true;
@@ -781,7 +781,7 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
(value == null || (BigDecimal.ZERO.compareTo((BigDecimal) value) >= 0)) ){
((Decimalbox) comp).setValue(advance.getAdvanceType().getDefaultMaxValue());(comp).invalidate();
- throw new WrongValueException(comp, _("The max value must be greater than 0"));
+ throw new WrongValueException(comp, tr("The max value must be greater than 0"));
}
};
}
@@ -873,7 +873,7 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
if ( advance != null ) {
if (advance.getAdvanceType() == null )
- throw new WrongValueException(getComboboxTypeBy(listItem), _("cannot be empty"));
+ throw new WrongValueException(getComboboxTypeBy(listItem), tr("cannot be empty"));
DirectAdvanceAssignment directAdvanceAssignment;
@@ -885,7 +885,7 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
directAdvanceAssignment = (DirectAdvanceAssignment) advance;
if ( directAdvanceAssignment != null && directAdvanceAssignment.getMaxValue() == null )
- throw new WrongValueException(getDecimalboxMaxValueBy(listItem), _("cannot be empty"));
+ throw new WrongValueException(getDecimalboxMaxValueBy(listItem), tr("cannot be empty"));
}
}
@@ -1004,7 +1004,7 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
updatesValue();
validateMeasurementValue(decimalbox, decimalbox.getValue());
} else
- throw new WrongValueException(decimalbox, _("Progress Measurement cannot be deleted." +
+ throw new WrongValueException(decimalbox, tr("Progress Measurement cannot be deleted." +
" Progress Measurement already consolidated"));
});
@@ -1049,7 +1049,7 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
validateMeasurementDate(date, date.getValue());
setCurrentDate();
} else
- throw new WrongValueException(date, _("Progress Measurement cannot be deleted." +
+ throw new WrongValueException(date, tr("Progress Measurement cannot be deleted." +
" Progress Measurement already consolidated"));
});
@@ -1085,29 +1085,29 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
if ( (advance.getAdvanceType() != null) && (advance.getAdvanceType().isQualityForm()) ) {
removeButton.setDisabled(true);
- removeButton.setTooltiptext(_("Progress measurements that are reported " +
+ removeButton.setTooltiptext(tr("Progress measurements that are reported " +
"by quality forms cannot be removed"));
} else if ( (advance.getAdvanceType() != null) && (advance.getAdvanceType().isReadOnly()) ) {
removeButton.setDisabled(true);
- removeButton.setTooltiptext(_("This progress type cannot cannot be removed"));
+ removeButton.setTooltiptext(tr("This progress type cannot cannot be removed"));
} else if ( advance.isFake() ) {
removeButton.setDisabled(true);
- removeButton.setTooltiptext(_("Calculated progress measurements cannot be removed") );
+ removeButton.setTooltiptext(tr("Calculated progress measurements cannot be removed") );
} else if ( manageOrderElementAdvancesModel.hasConsolidatedAdvances(measure) ) {
removeButton.setDisabled(true);
- removeButton.setTooltiptext(_("Consolidated progress measurement cannot be removed"));
+ removeButton.setTooltiptext(tr("Consolidated progress measurement cannot be removed"));
} else if ( manageOrderElementAdvancesModel.isAlreadyReportedProgress(measure) ) {
removeButton.setDisabled(true);
- removeButton.setTooltiptext(_("Values already sent to the customer. Values cannot be changed "));
+ removeButton.setTooltiptext(tr("Values already sent to the customer. Values cannot be changed "));
} else if ( isReadOnlyAdvanceMeasurements() ) {
removeButton.setDisabled(isReadOnlyAdvanceMeasurements());
- removeButton.setTooltiptext(_("Subcontractor values are read only" +
+ removeButton.setTooltiptext(tr("Subcontractor values are read only" +
" because they were reported by the subcontractor company."));
}
@@ -1128,7 +1128,7 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
}
private void showMessagesConsolidation(LocalDate date) {
- String message = _("Progress measurement cannot be canged to {0}, because it is consolidated", date);
+ String message = tr("Progress measurement cannot be canged to {0}, because it is consolidated", date);
showErrorMessage(message);
}
@@ -1136,9 +1136,9 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
private Button createAddMeasurementButton() {
Button addButton = new Button();
- addButton.setLabel(_("Add measure"));
+ addButton.setLabel(tr("Add measure"));
addButton.setClass("add-button");
- addButton.setTooltiptext(_("Add new progress measurement"));
+ addButton.setTooltiptext(tr("Add new progress measurement"));
return addButton;
}
@@ -1153,7 +1153,7 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
removeButton.setSclass("icono");
removeButton.setImage("/common/img/ico_borrar1.png");
removeButton.setHoverImage("/common/img/ico_borrar.png");
- removeButton.setTooltiptext(_("Delete"));
+ removeButton.setTooltiptext(tr("Delete"));
return removeButton;
}
@@ -1163,7 +1163,7 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
}
private void showMessageNotAddMoreAdvances() {
- String message = _("All progress types have already been assigned.");
+ String message = tr("All progress types have already been assigned.");
increaseScreenHeight();
messagesForUser.showMessage(Level.ERROR, message);
}
@@ -1176,7 +1176,7 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
}
private void showMessageDeleteSpread() {
- String message = _("Spread progress cannot be removed. Please select another progress as spread.");
+ String message = tr("Spread progress cannot be removed. Please select another progress as spread.");
showErrorMessage(message);
}
@@ -1187,14 +1187,14 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
private String validateValueAdvanceMeasurement(AdvanceMeasurement measurement) {
if ( manageOrderElementAdvancesModel.greatThanMaxValue(measurement) )
- return _("Value is not valid. It must be smaller than max value");
+ return tr("Value is not valid. It must be smaller than max value");
if ( !manageOrderElementAdvancesModel.isPrecisionValid(measurement) )
- return _("Value must be a multiple of the precision value of the progress type: {0}",
+ return tr("Value must be a multiple of the precision value of the progress type: {0}",
manageOrderElementAdvancesModel.getUnitPrecision().stripTrailingZeros().toPlainString());
if ( manageOrderElementAdvancesModel.lessThanPreviousMeasurements() )
- return _("Invalid value. Value must be greater than the value of previous progress.");
+ return tr("Invalid value. Value must be greater than the value of previous progress.");
return null;
}
@@ -1204,14 +1204,14 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
measurement.setDate(value);
if ( !manageOrderElementAdvancesModel.isDistinctValidDate(value, measurement))
- return _("Invalid date. Date must be unique for this Progress Assignment");
+ return tr("Invalid date. Date must be unique for this Progress Assignment");
if ( manageOrderElementAdvancesModel.hasConsolidatedAdvances(measurement) )
measurement.setDate(oldDate);
else {
manageOrderElementAdvancesModel.sortListAdvanceMeasurement();
if ( manageOrderElementAdvancesModel.lessThanPreviousMeasurements() )
- return _("Invalid value. Value must be greater than the value of previous progress.");
+ return tr("Invalid value. Value must be greater than the value of previous progress.");
}
if ( !isReadOnlyAdvanceMeasurements() ) {
@@ -1220,10 +1220,10 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
.getLastConsolidatedMeasurementDate(measurement.getAdvanceAssignment());
if ( consolidatedUntil != null && consolidatedUntil.compareTo(measurement.getDate()) >= 0 ) {
- return _("Date is not valid, it must be later than the last progress consolidation");
+ return tr("Date is not valid, it must be later than the last progress consolidation");
}
if ( manageOrderElementAdvancesModel.isAlreadyReportedProgressWith(value) ) {
- return _("Date is not valid, it must be later than the last progress reported to the customer");
+ return tr("Date is not valid, it must be later than the last progress reported to the customer");
}
}
@@ -1284,7 +1284,7 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
if ( value == null && advanceMeasurement != null ) {
advanceMeasurement.setDate(null);
((Datebox) comp).setValue(null);
- throw new WrongValueException(comp, _("cannot be empty"));
+ throw new WrongValueException(comp, tr("cannot be empty"));
} else {
String errorMessage = validateDateAdvanceMeasurement(new LocalDate(value), advanceMeasurement);
@@ -1310,7 +1310,7 @@ public class ManageOrderElementAdvancesController extends GenericForwardComposer
((Decimalbox) comp).setValue((BigDecimal) value);
if ( (value) == null )
- throw new WrongValueException(comp, _("cannot be empty"));
+ throw new WrongValueException(comp, tr("cannot be empty"));
else {
String errorMessage = validateValueAdvanceMeasurement(advanceMeasurement);
if ( errorMessage != null )
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/ManageOrderElementAdvancesModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/ManageOrderElementAdvancesModel.java
index 0f6179a2d..2a6b6c97c 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/ManageOrderElementAdvancesModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/ManageOrderElementAdvancesModel.java
@@ -24,7 +24,7 @@
package org.libreplan.web.orders;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.math.BigDecimal;
import java.math.RoundingMode;
@@ -125,7 +125,7 @@ public class ManageOrderElementAdvancesModel implements IManageOrderElementAdvan
if ((assignment.getAdvanceType() == null) || assignment.getMaxValue() == null) {
return "";
}
- return _("{0} (max: {1})", assignment.getAdvanceType().getUnitName(), assignment.getMaxValue());
+ return tr("{0} (max: {1})", assignment.getAdvanceType().getUnitName(), assignment.getMaxValue());
}
@Override
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderCRUDController.java
index 02bcf9ca3..c3fd0f08d 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderCRUDController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderCRUDController.java
@@ -116,7 +116,7 @@ import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Controller for CRUD actions.
@@ -375,7 +375,7 @@ public class OrderCRUDController extends GenericForwardComposer {
saveOrderAndContinueButton.addEventListener(Events.ON_CLICK, event -> saveAndContinue());
cancelEditionButton.addEventListener(Events.ON_CLICK, event -> Messagebox.show(
- _("Unsaved changes will be lost. Are you sure?"), _("Confirm exit dialog"),
+ tr("Unsaved changes will be lost. Are you sure?"), tr("Confirm exit dialog"),
Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION,
evt -> {
if ( "onOK".equals(evt.getName()) ) {
@@ -441,10 +441,10 @@ public class OrderCRUDController extends GenericForwardComposer {
if ( options != null && options.isEmpty() ) {
schedulingMode.appendChild(createCombo(
- SchedulingMode.FORWARD, _("Forward"), _("Schedule from start to deadline")));
+ SchedulingMode.FORWARD, tr("Forward"), tr("Schedule from start to deadline")));
schedulingMode.appendChild(createCombo(
- SchedulingMode.BACKWARDS, _("Backwards"), _("Schedule from deadline to start")));
+ SchedulingMode.BACKWARDS, tr("Backwards"), tr("Schedule from deadline to start")));
}
}
@@ -489,13 +489,13 @@ public class OrderCRUDController extends GenericForwardComposer {
if (value == null) {
if (mode == SchedulingMode.FORWARD) {
- throw new WrongValueException(comp, _("Starting date cannot be empty in forward mode"));
+ throw new WrongValueException(comp, tr("Starting date cannot be empty in forward mode"));
}
if ( orderModel.isAnyTaskWithConstraint(PositionConstraintType.AS_SOON_AS_POSSIBLE) ) {
throw new WrongValueException(
comp,
- _("Starting date cannot be empty because there is a task with constraint " +
+ tr("Starting date cannot be empty because there is a task with constraint " +
"\"as soon as possible\""));
}
}
@@ -504,13 +504,13 @@ public class OrderCRUDController extends GenericForwardComposer {
deadline.setConstraint((comp, value) -> {
if (value == null) {
if (mode == SchedulingMode.BACKWARDS) {
- throw new WrongValueException(comp, _("Deadline cannot be empty in backwards mode"));
+ throw new WrongValueException(comp, tr("Deadline cannot be empty in backwards mode"));
}
if (orderModel.isAnyTaskWithConstraint(PositionConstraintType.AS_LATE_AS_POSSIBLE)) {
throw new WrongValueException(
comp,
- _("Deadline cannot be empty because there is a task with constraint " +
+ tr("Deadline cannot be empty because there is a task with constraint " +
"\"as late as possible\""));
}
}
@@ -531,7 +531,7 @@ public class OrderCRUDController extends GenericForwardComposer {
deadline.setValue(null);
getOrder().setDeadline(null);
- throw new WrongValueException(comp, _("must be after start date"));
+ throw new WrongValueException(comp, tr("must be after start date"));
}
};
}
@@ -545,7 +545,7 @@ public class OrderCRUDController extends GenericForwardComposer {
initDate.setValue(null);
getOrder().setInitDate(null);
- throw new WrongValueException(comp, _("must be lower than end date"));
+ throw new WrongValueException(comp, tr("must be lower than end date"));
}
};
}
@@ -885,7 +885,7 @@ public class OrderCRUDController extends GenericForwardComposer {
}
} else {
Messagebox.show(
- _("You don't have read access to this project"), _(INFORMATION),
+ tr("You don't have read access to this project"), tr(INFORMATION),
Messagebox.OK, Messagebox.INFORMATION);
goToList();
@@ -1015,7 +1015,7 @@ public class OrderCRUDController extends GenericForwardComposer {
if ( orderModel.userCanWrite(order) ) {
int status = Messagebox.show(
- _("Confirm deleting {0}. Are you sure?", order.getName()), DELETE,
+ tr("Confirm deleting {0}. Are you sure?", order.getName()), DELETE,
Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
if ( Messagebox.OK == status ) {
@@ -1024,7 +1024,7 @@ public class OrderCRUDController extends GenericForwardComposer {
}
else {
Messagebox.show(
- _("Not enough permissions to edit this project"), _(INFORMATION),
+ tr("Not enough permissions to edit this project"), tr(INFORMATION),
Messagebox.OK, Messagebox.INFORMATION);
}
}
@@ -1036,7 +1036,7 @@ public class OrderCRUDController extends GenericForwardComposer {
messagesForUser.showMessage(
Level.ERROR,
- _("You can not remove the project \"{0}\" because this one has imputed expense sheets.",
+ tr("You can not remove the project \"{0}\" because this one has imputed expense sheets.",
order.getName()));
return;
}
@@ -1046,15 +1046,15 @@ public class OrderCRUDController extends GenericForwardComposer {
messagesForUser.showMessage(
Level.ERROR,
- _("You can not remove the project \"{0}\" because it has time tracked at some of its tasks",
+ tr("You can not remove the project \"{0}\" because it has time tracked at some of its tasks",
order.getName()));
} else {
if ( !StringUtils.isBlank(order.getExternalCode()) ) {
if ( Messagebox.show(
- _("This project is a subcontracted project. If you delete it, " +
+ tr("This project is a subcontracted project. If you delete it, " +
"you won't be able to report progress anymore. Are you sure?"),
- _("Confirm"),
+ tr("Confirm"),
Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION) == Messagebox.CANCEL ) {
return;
}
@@ -1064,7 +1064,7 @@ public class OrderCRUDController extends GenericForwardComposer {
Util.reloadBindings(self);
messagesForUser.clearMessages();
- messagesForUser.showMessage(Level.INFO, _("Removed {0}", order.getName()));
+ messagesForUser.showMessage(Level.INFO, tr("Removed {0}", order.getName()));
}
}
@@ -1078,12 +1078,12 @@ public class OrderCRUDController extends GenericForwardComposer {
} else {
Messagebox.show(
- _("The project has no scheduled elements"), _(INFORMATION),
+ tr("The project has no scheduled elements"), tr(INFORMATION),
Messagebox.OK, Messagebox.INFORMATION);
}
} else {
Messagebox.show(
- _("You don't have read access to this project"), _(INFORMATION),
+ tr("You don't have read access to this project"), tr(INFORMATION),
Messagebox.OK, Messagebox.INFORMATION);
}
}
@@ -1111,7 +1111,7 @@ public class OrderCRUDController extends GenericForwardComposer {
public void checkUserCanRead(Order order) {
if ( !orderModel.userCanRead(order, SecurityUtils.getSessionUserLoginName()) ) {
Messagebox.show(
- _("Sorry, you do not have permissions to access this project"), _(INFORMATION),
+ tr("Sorry, you do not have permissions to access this project"), tr(INFORMATION),
Messagebox.OK, Messagebox.INFORMATION);
}
}
@@ -1296,7 +1296,7 @@ public class OrderCRUDController extends GenericForwardComposer {
appendObject(row, Util.addCurrencySymbol(order.getTotalManualBudget()));
appendObject(row, Util.addCurrencySymbol(order.getTotalBudget()));
appendObject(row, order.getTotalHours());
- appendObject(row, _(order.getState().toString()));
+ appendObject(row, tr(order.getState().toString()));
appendOperations(row, order);
row.setTooltiptext(getTooltipText(order));
@@ -1346,7 +1346,7 @@ public class OrderCRUDController extends GenericForwardComposer {
buttonEdit.setSclass(ICONO_CLASS);
buttonEdit.setImage("/common/img/ico_editar1.png");
buttonEdit.setHoverImage("/common/img/ico_editar.png");
- buttonEdit.setTooltiptext(_("Edit"));
+ buttonEdit.setTooltiptext(tr("Edit"));
buttonEdit.addEventListener(ON_CLICK_EVENT, event -> goToEditForm(order));
hbox.appendChild(buttonEdit);
}
@@ -1357,7 +1357,7 @@ public class OrderCRUDController extends GenericForwardComposer {
buttonDelete.setSclass(ICONO_CLASS);
buttonDelete.setImage("/common/img/ico_borrar1.png");
buttonDelete.setHoverImage("/common/img/ico_borrar.png");
- buttonDelete.setTooltiptext(_(DELETE));
+ buttonDelete.setTooltiptext(tr(DELETE));
buttonDelete.addEventListener(ON_CLICK_EVENT, event -> confirmRemove(order));
hbox.appendChild(buttonDelete);
}
@@ -1368,7 +1368,7 @@ public class OrderCRUDController extends GenericForwardComposer {
buttonPlan.setSclass(ICONO_CLASS);
buttonPlan.setImage("/common/img/ico_planificador1.png");
buttonPlan.setHoverImage("/common/img/ico_planificador.png");
- buttonPlan.setTooltiptext(_("See scheduling"));
+ buttonPlan.setTooltiptext(tr("See scheduling"));
buttonPlan.addEventListener(ON_CLICK_EVENT, event -> schedule(order));
hbox.appendChild(buttonPlan);
}
@@ -1378,12 +1378,12 @@ public class OrderCRUDController extends GenericForwardComposer {
buttonDerived.setSclass(ICONO_CLASS);
buttonDerived.setImage("/common/img/ico_derived1.png");
buttonDerived.setHoverImage("/common/img/ico_derived.png");
- buttonDerived.setTooltiptext(_("Create Template"));
+ buttonDerived.setTooltiptext(tr("Create Template"));
buttonDerived.addEventListener(ON_CLICK_EVENT, event -> createTemplate(order));
if ( !SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_TEMPLATES) ) {
buttonDerived.setDisabled(true);
- buttonDerived.setTooltiptext(_("Not enough permissions to create templates"));
+ buttonDerived.setTooltiptext(tr("Not enough permissions to create templates"));
}
hbox.appendChild(buttonDerived);
@@ -1409,7 +1409,7 @@ public class OrderCRUDController extends GenericForwardComposer {
if ( (finishDate != null) && (filterStartDate.getRawValue() != null) &&
(finishDate.compareTo((Date) filterStartDate.getRawValue()) < 0) ) {
- throw new WrongValueException(comp, _("must be after start date"));
+ throw new WrongValueException(comp, tr("must be after start date"));
}
};
}
@@ -1421,7 +1421,7 @@ public class OrderCRUDController extends GenericForwardComposer {
if ( (startDate != null) && (filterFinishDate.getRawValue() != null) &&
(startDate.compareTo((Date) filterFinishDate.getRawValue()) > 0) ) {
- throw new WrongValueException(comp, _("must be lower than end date"));
+ throw new WrongValueException(comp, tr("must be lower than end date"));
}
};
}
@@ -1609,13 +1609,13 @@ public class OrderCRUDController extends GenericForwardComposer {
return (comp, value) -> {
if ( StringUtils.isBlank((String) value) ) {
- throw new WrongValueException(comp, _("cannot be empty"));
+ throw new WrongValueException(comp, tr("cannot be empty"));
}
try {
Order found = orderDAO.findByNameAnotherTransaction((String) value);
if ( !found.getId().equals(getOrder().getId()) ) {
- throw new WrongValueException(comp, _("project name already being used"));
+ throw new WrongValueException(comp, tr("project name already being used"));
}
} catch (InstanceNotFoundException ignored) {}
};
@@ -1625,13 +1625,13 @@ public class OrderCRUDController extends GenericForwardComposer {
return (comp, value) -> {
if ( StringUtils.isBlank((String) value) ) {
- throw new WrongValueException(comp, _("cannot be empty"));
+ throw new WrongValueException(comp, tr("cannot be empty"));
}
try {
Order found = orderDAO.findByCodeAnotherTransaction((String) value);
if ( !found.getId().equals(getOrder().getId()) ) {
- throw new WrongValueException(comp, _("project code already being used"));
+ throw new WrongValueException(comp, tr("project code already being used"));
}
} catch (InstanceNotFoundException ignored) {}
};
@@ -1642,7 +1642,7 @@ public class OrderCRUDController extends GenericForwardComposer {
}
public String getProjectType() {
- return isSubcontractedProject() ? _("Subcontracted by client") : _("Regular project");
+ return isSubcontractedProject() ? tr("Subcontracted by client") : tr("Regular project");
}
public void setCurrentDeliveryDate(Grid listDeliveryDates) {
@@ -1676,7 +1676,7 @@ public class OrderCRUDController extends GenericForwardComposer {
public void addAskedEndDate(Datebox newEndDate) {
if ( newEndDate == null || newEndDate.getValue() == null ) {
- messagesForUser.showMessage(Level.ERROR, _("You must select a valid date. "));
+ messagesForUser.showMessage(Level.ERROR, tr("You must select a valid date. "));
return;
}
@@ -1684,13 +1684,13 @@ public class OrderCRUDController extends GenericForwardComposer {
if ( thereIsSomeCommunicationDateEmpty() ) {
messagesForUser.showMessage(
Level.ERROR,
- _("It will only be possible to add an end date if all the exiting ones in the table " +
+ tr("It will only be possible to add an end date if all the exiting ones in the table " +
"have already been sent to the customer."));
return;
}
if ( orderModel.alreadyExistsRepeatedEndDate(newEndDate.getValue()) ) {
- messagesForUser.showMessage(Level.ERROR, _("It already exists a end date with the same date. "));
+ messagesForUser.showMessage(Level.ERROR, tr("It already exists a end date with the same date. "));
return;
}
@@ -1745,7 +1745,7 @@ public class OrderCRUDController extends GenericForwardComposer {
deleteButton.setSclass(ICONO_CLASS);
deleteButton.setImage("/common/img/ico_borrar1.png");
deleteButton.setHoverImage("/common/img/ico_borrar.png");
- deleteButton.setTooltiptext(_(DELETE));
+ deleteButton.setTooltiptext(tr(DELETE));
deleteButton.addEventListener(Events.ON_CLICK, event -> removeAskedEndDate(endDate));
return deleteButton;
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderElementController.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderElementController.java
index 592458884..6ca962181 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderElementController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderElementController.java
@@ -43,7 +43,7 @@ import org.zkoss.zul.Tab;
import org.zkoss.zul.Tabpanel;
import org.zkoss.zul.Window;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Controller for {@link OrderElement} view of {@link Order} entities.
@@ -130,7 +130,7 @@ public class OrderElementController extends GenericForwardComposer {
name = ": " + getOrderElement().getName();
}
- return _("Edit task {0}", name);
+ return tr("Edit task {0}", name);
}
public void setupManageOrderElementAdvancesController() {
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderElementTreeController.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderElementTreeController.java
index 21364d729..24b6cfa50 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderElementTreeController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderElementTreeController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.orders;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.math.BigDecimal;
import java.util.ArrayList;
@@ -317,7 +317,7 @@ public class OrderElementTreeController extends TreeController {
if ( createTemplateButton != null ) {
if ( !SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_TEMPLATES) ) {
createTemplateButton.setDisabled(true);
- createTemplateButton.setTooltiptext(_("Not enough permissions to create templates"));
+ createTemplateButton.setTooltiptext(tr("Not enough permissions to create templates"));
}
}
}
@@ -339,7 +339,7 @@ public class OrderElementTreeController extends TreeController {
final Button expandAllButton = new Button();
expandAllButton.setId("expandAllButton");
expandAllButton.setClass("planner-command");
- expandAllButton.setTooltiptext(_("Expand/Collapse all"));
+ expandAllButton.setTooltiptext(tr("Expand/Collapse all"));
expandAllButton.setImage("/common/img/ico_expand.png");
expandAllButton.addEventListener("onClick", event -> {
@@ -412,7 +412,7 @@ public class OrderElementTreeController extends TreeController {
textBox.setDisabled(true);
}
- textBox.setConstraint("no empty:" + _("cannot be empty"));
+ textBox.setConstraint("no empty:" + tr("cannot be empty"));
addCell(cssClass, textBox);
putNameTextbox(orderElementForThisRow, textBox);
}
@@ -452,7 +452,7 @@ public class OrderElementTreeController extends TreeController {
throw new WrongValueException(
comp,
- _("Value is not valid.\n Code cannot contain chars like '_' \n " +
+ tr("Value is not valid.\n Code cannot contain chars like '_' \n " +
"and should not be empty"));
}
});
@@ -536,7 +536,7 @@ public class OrderElementTreeController extends TreeController {
return createButton(
"/common/img/ico_editar1.png",
- _("Edit"),
+ tr("Edit"),
"/common/img/ico_editar.png",
"icono",
event -> showEditionOrderElement(item));
@@ -678,7 +678,7 @@ public class OrderElementTreeController extends TreeController {
}
if ( (elem.getLabels() != null) && (!elem.getLabels().isEmpty()) ) {
- tooltipText.append(" ").append(_("Labels")).append(":");
+ tooltipText.append(" ").append(tr("Labels")).append(":");
tooltipText.append(StringUtils.join(elem.getLabels(), ","));
tooltipText.append(".");
}
@@ -694,13 +694,13 @@ public class OrderElementTreeController extends TreeController {
}
if ( !criterionNames.isEmpty() ) {
- tooltipText.append(" " + _("Criteria") + ":");
+ tooltipText.append(" " + tr("Criteria") + ":");
tooltipText.append(StringUtils.join(criterionNames, ","));
tooltipText.append(".");
}
}
// To calculate other unit advances implement getOtherAdvancesPercentage()
- tooltipText.append(" ").append(_("Progress")).append(":").append(elem.getAdvancePercentage());
+ tooltipText.append(" ").append(tr("Progress")).append(":").append(elem.getAdvancePercentage());
tooltipText.append(".");
return tooltipText.toString();
@@ -747,7 +747,7 @@ public class OrderElementTreeController extends TreeController {
(finishDate.compareTo(filterStartDateOrderElement.getValue()) < 0) ) {
filterFinishDateOrderElement.setValue(null);
- throw new WrongValueException(comp, _("must be after start date"));
+ throw new WrongValueException(comp, tr("must be after start date"));
}
};
}
@@ -761,7 +761,7 @@ public class OrderElementTreeController extends TreeController {
(startDate.compareTo(filterFinishDateOrderElement.getValue()) > 0) ) {
filterStartDateOrderElement.setValue(null);
- throw new WrongValueException(comp, _("must be lower than end date"));
+ throw new WrongValueException(comp, tr("must be lower than end date"));
}
};
}
@@ -773,7 +773,7 @@ public class OrderElementTreeController extends TreeController {
if ( hasImputedExpenseSheets ) {
messagesForUser.showMessage(
Level.ERROR,
- _("You can not remove the project \"{0}\" because this one has imputed expense sheets.",
+ tr("You can not remove the project \"{0}\" because this one has imputed expense sheets.",
element.getName()));
return;
}
@@ -782,7 +782,7 @@ public class OrderElementTreeController extends TreeController {
if ( alreadyInUse ) {
messagesForUser.showMessage(
Level.ERROR,
- _("You cannot remove the task \"{0}\" because it has work reported on it or any of its children",
+ tr("You cannot remove the task \"{0}\" because it has work reported on it or any of its children",
element.getName()));
return;
}
@@ -793,7 +793,7 @@ public class OrderElementTreeController extends TreeController {
if ( onlyChildAndParentAlreadyInUseByHoursOrExpenses ) {
messagesForUser.showMessage(
Level.ERROR,
- _("You cannot remove the task \"{0}\" because it is the only child of its parent " +
+ tr("You cannot remove the task \"{0}\" because it is the only child of its parent " +
"and its parent has tracked time or imputed expenses",
element.getName()));
return;
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderElementTreeModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderElementTreeModel.java
index 6b43e19bd..769b99954 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderElementTreeModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderElementTreeModel.java
@@ -21,7 +21,7 @@
package org.libreplan.web.orders;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.List;
@@ -50,7 +50,7 @@ public class OrderElementTreeModel extends EntitiesTree {
protected OrderElement createNewElement() {
OrderElement newOrderElement = OrderLine
.createOrderLineWithUnfixedPercentage(0);
- newOrderElement.setName(_("New task"));
+ newOrderElement.setName(tr("New task"));
return newOrderElement;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderModel.java
index 6a8cd1780..74110ee82 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderModel.java
@@ -21,7 +21,7 @@
package org.libreplan.web.orders;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.math.BigDecimal;
import java.util.ArrayList;
@@ -749,16 +749,16 @@ public class OrderModel extends IntegrationEntityModel implements IOrderModel {
public String gettooltipText(Order order) {
orderDAO.reattachUnmodifiedEntity(order);
StringBuilder result = new StringBuilder();
- result.append(_("Progress") + ": ").append(getEstimatedAdvance(order)).append("% , ");
- result.append(_("Hours invested")).append(": ").append(getHoursAdvancePercentage(order)).append("%\n");
+ result.append(tr("Progress") + ": ").append(getEstimatedAdvance(order)).append("% , ");
+ result.append(tr("Hours invested")).append(": ").append(getHoursAdvancePercentage(order)).append("%\n");
if (!getDescription(order).equals("")) {
- result.append(" , " + _("Description") + ": " + getDescription(order) + "\n");
+ result.append(" , " + tr("Description") + ": " + getDescription(order) + "\n");
}
String labels = buildLabelsText(order);
if (!labels.equals("")) {
- result.append(" , " + _("Labels") + ": " + labels);
+ result.append(" , " + tr("Labels") + ": " + labels);
}
return result.toString();
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrdersTreeComponent.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrdersTreeComponent.java
index 3e2afb111..f2bf2b81d 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrdersTreeComponent.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrdersTreeComponent.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.web.orders;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.List;
@@ -66,14 +66,14 @@ public class OrdersTreeComponent extends TreeComponent {
columns.add(codeColumn);
columns.add(nameAndDescriptionColumn);
- columns.add(new OrdersTreeColumn(_("Hours"), "hours", _("Total task hours")) {
+ columns.add(new OrdersTreeColumn(tr("Hours"), "hours", tr("Total task hours")) {
@Override
protected void doCell(OrderElementTreeitemRenderer treeRenderer, OrderElement currentElement) {
treeRenderer.addHoursCell(currentElement);
}
});
- columns.add(new OrdersTreeColumn(_("Budget"), "budget", _("Total task budget")) {
+ columns.add(new OrdersTreeColumn(tr("Budget"), "budget", tr("Total task budget")) {
@Override
protected void doCell(OrderElementTreeitemRenderer treeRenderer, OrderElement currentElement) {
treeRenderer.addBudgetCell(currentElement);
@@ -81,7 +81,7 @@ public class OrdersTreeComponent extends TreeComponent {
});
if (resourcesBudgetEnabled) {
- columns.add(new OrdersTreeColumn(_("Expenses"), "budget", _("Budget minus resources costs")) {
+ columns.add(new OrdersTreeColumn(tr("Expenses"), "budget", tr("Budget minus resources costs")) {
@Override
protected void doCell(OrderElementTreeitemRenderer treeRenderer, OrderElement currentElement) {
treeRenderer.addResourcesBudgetCell(currentElement);
@@ -90,9 +90,9 @@ public class OrdersTreeComponent extends TreeComponent {
}
columns.add(new OrdersTreeColumn(
- _("Must start after"),
+ tr("Must start after"),
"estimated_init",
- _("Estimated start date for the task " +
+ tr("Estimated start date for the task " +
"(press enter in textbox to open calendar popup or type in date directly)")) {
@Override
@@ -102,9 +102,9 @@ public class OrdersTreeComponent extends TreeComponent {
});
columns.add(new OrdersTreeColumn(
- _("Deadline"),
+ tr("Deadline"),
"estimated_end",
- _("Estimated end date for the task " +
+ tr("Estimated end date for the task " +
"(press enter in textbox to open calendar popup or type in date directly)")) {
@Override
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/ProjectDetailsController.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/ProjectDetailsController.java
index 0d9b2798c..b30076576 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/ProjectDetailsController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/ProjectDetailsController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.orders;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.Date;
import java.util.HashMap;
@@ -162,11 +162,11 @@ public class ProjectDetailsController extends GenericForwardComposer
}
private void showWrongValue() {
- throw new WrongValueException(initDate, _("cannot be empty"));
+ throw new WrongValueException(initDate, tr("cannot be empty"));
}
private void showWrongName() {
- throw new WrongValueException(txtName, _("project name already being used"));
+ throw new WrongValueException(txtName, tr("project name already being used"));
}
private void close() {
@@ -234,7 +234,7 @@ public class ProjectDetailsController extends GenericForwardComposer
if ( deadlineBeforeStart ) {
deadline.setValue(null);
getOrder().setDeadline(null);
- throw new WrongValueException(comp, _("must be after start date"));
+ throw new WrongValueException(comp, tr("must be after start date"));
}
};
}
@@ -250,7 +250,7 @@ public class ProjectDetailsController extends GenericForwardComposer
if ( startAfterDeadline ) {
initDate.setValue(null);
getOrder().setInitDate(null);
- throw new WrongValueException(comp, _("must be lower than end date"));
+ throw new WrongValueException(comp, tr("must be lower than end date"));
}
Date year2010 = new Date(1262296800000L);
@@ -259,7 +259,7 @@ public class ProjectDetailsController extends GenericForwardComposer
if ( startBefore2010 ) {
initDate.setValue(null);
getOrder().setInitDate(null);
- throw new WrongValueException(comp, _("Must be after 2010!"));
+ throw new WrongValueException(comp, tr("Must be after 2010!"));
}
};
}
@@ -296,7 +296,7 @@ public class ProjectDetailsController extends GenericForwardComposer
setCodeAutogenerated(true);
}
generateCode.setDisabled(true);
- generateCode.setTooltiptext(_("Set Code as autogenerated to create a new project from templates"));
+ generateCode.setTooltiptext(tr("Set Code as autogenerated to create a new project from templates"));
generateCode.setChecked(true);
calculateProjectDates(template);
setCalendarFromTemplate(template);
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/TimSynchronizationController.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/TimSynchronizationController.java
index 637b617e5..59723ad84 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/TimSynchronizationController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/TimSynchronizationController.java
@@ -19,7 +19,7 @@
package org.libreplan.web.orders;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.HashMap;
import java.util.Map;
@@ -135,7 +135,7 @@ class TimSynchronizationController extends GenericForwardComposer {
public void startExportToTim() {
- txtProductCode.setConstraint("no empty:" + _("cannot be empty"));
+ txtProductCode.setConstraint("no empty:" + tr("cannot be empty"));
try {
exportTimesheetsToTim.exportTimesheets(txtProductCode.getValue(), getOrder());
@@ -144,7 +144,7 @@ class TimSynchronizationController extends GenericForwardComposer {
shwoImpExpInfo();
} catch (ConnectorException e) {
- messagesForUser.showMessage(Level.ERROR, _("Exporting timesheets to Tim failed. Check the Tim connector"));
+ messagesForUser.showMessage(Level.ERROR, tr("Exporting timesheets to Tim failed. Check the Tim connector"));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/TreeElementOperationsController.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/TreeElementOperationsController.java
index 962f4ee85..d7795f64e 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/TreeElementOperationsController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/TreeElementOperationsController.java
@@ -28,7 +28,7 @@ import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Tree;
import org.zkoss.zul.Treeitem;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Encapsulates the operations (up, down, indent, unindent, etc) for an element of the tree.
@@ -49,7 +49,7 @@ public abstract class TreeElementOperationsController {
}
protected void showSelectAnElementError() {
- Messagebox.show(_("Please select a task"));
+ Messagebox.show(tr("Please select a task"));
}
protected abstract void showEditElement(Treeitem treeitem);
@@ -236,16 +236,16 @@ class OrderElementOperations extends TreeElementOperationsController onAccept());
cancelButton = (Button) getFellow("cancelButton");
- cancelButton.setLabel(_("Cancel"));
+ cancelButton.setLabel(tr("Cancel"));
cancelButton.setClass("add-button");
cancelButton.addEventListener(Events.ON_CLICK, event -> onCancel());
@@ -131,7 +131,7 @@ public class TemplateFinderPopup extends HtmlMacroComponent {
popup = (Popup) getFellow("finderPopup");
caption = (Caption) getFellow("finderCaption");
- caption.setLabel(_("Choosing Template"));
+ caption.setLabel(tr("Choosing Template"));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/criterionrequirements/AssignedCriterionRequirementController.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/criterionrequirements/AssignedCriterionRequirementController.java
index e87105fcb..f93e5e642 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/criterionrequirements/AssignedCriterionRequirementController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/criterionrequirements/AssignedCriterionRequirementController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.orders.criterionrequirements;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.math.BigDecimal;
import java.util.ArrayList;
@@ -256,7 +256,7 @@ public abstract class AssignedCriterionRequirementController extends Gener
if (combobox.getSelectedItem() != null) {
int status = Messagebox.show(
- _("Are you sure of changing the resource type? " +
+ tr("Are you sure of changing the resource type? " +
"You will lose the criteria with different resource type."),
"Question", Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
@@ -329,7 +329,7 @@ public abstract class AssignedCriterionRequirementController extends Gener
if (row != null) {
Bandbox bandType = getBandType(requirementWrapper, row);
bandType.setValue(null);
- throw new WrongValueException(bandType, _("cannot be empty"));
+ throw new WrongValueException(bandType, tr("cannot be empty"));
}
}
@@ -408,8 +408,8 @@ public abstract class AssignedCriterionRequirementController extends Gener
if (getHoursGroupWrappers().size() < 2) {
Messagebox.show(
- _("At least one HoursGroup is needed"),
- _("Error"), Messagebox.OK, Messagebox.ERROR);
+ tr("At least one HoursGroup is needed"),
+ tr("Error"), Messagebox.OK, Messagebox.ERROR);
return;
}
@@ -497,7 +497,7 @@ public abstract class AssignedCriterionRequirementController extends Gener
private void showInvalidConstraint(Bandbox bandbox, IllegalStateException e) {
bandbox.setValue("");
- throw new WrongValueException(bandbox, _(e.getMessage()));
+ throw new WrongValueException(bandbox, tr(e.getMessage()));
}
/**
@@ -526,7 +526,7 @@ public abstract class AssignedCriterionRequirementController extends Gener
((OrderLine) getElement()).setWorkHours(intValue);
}
} catch (IllegalArgumentException e) {
- throw new WrongValueException(comp, _(e.getMessage()));
+ throw new WrongValueException(comp, tr(e.getMessage()));
}
}
};
@@ -538,7 +538,7 @@ public abstract class AssignedCriterionRequirementController extends Gener
try {
hoursGroupWrapper.setPercentage((BigDecimal) value);
} catch (IllegalArgumentException e) {
- throw new WrongValueException(comp, _(e.getMessage()));
+ throw new WrongValueException(comp, tr(e.getMessage()));
}
};
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/criterionrequirements/AssignedCriterionRequirementModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/criterionrequirements/AssignedCriterionRequirementModel.java
index cd70106bc..cc69f82f6 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/criterionrequirements/AssignedCriterionRequirementModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/criterionrequirements/AssignedCriterionRequirementModel.java
@@ -21,7 +21,7 @@
package org.libreplan.web.orders.criterionrequirements;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.List;
@@ -184,7 +184,7 @@ public abstract class AssignedCriterionRequirementModel implements IAssign
// Set generated name
int number = (asOrderLine()).getHoursGroups().size() - 1;
- newHoursGroup.setCode(_("New hours group ") + number);
+ newHoursGroup.setCode(tr("New hours group ") + number);
return newHoursGroup;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/files/OrderFilesController.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/files/OrderFilesController.java
index eb640ec0b..3583976b8 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/files/OrderFilesController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/files/OrderFilesController.java
@@ -57,7 +57,7 @@ import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Controller for managing Order files.
@@ -180,7 +180,7 @@ public class OrderFilesController extends GenericForwardComposer {
public void confirmRemove(OrderFile file){
int status = Messagebox.show(
- _("Confirm deleting this file. Are you sure?"), _("Delete"),
+ tr("Confirm deleting this file. Are you sure?"), tr("Delete"),
Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
if ( Messagebox.OK != status ) {
@@ -280,7 +280,7 @@ public class OrderFilesController extends GenericForwardComposer {
updateListbox();
}
- } else messages.showMessage(Level.ERROR, _("Please, make repository"));
+ } else messages.showMessage(Level.ERROR, tr("Please, make repository"));
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/labels/AssignedLabelsController.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/labels/AssignedLabelsController.java
index c9edd1e3f..c933402bb 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/labels/AssignedLabelsController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/labels/AssignedLabelsController.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.web.orders.labels;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.List;
@@ -81,10 +81,10 @@ public abstract class AssignedLabelsController extends GenericForwardCompo
public void onAssignLabel() {
Label label = (Label) bdLabels.getSelectedElement();
if (label == null) {
- throw new WrongValueException(bdLabels, _("please, select a label"));
+ throw new WrongValueException(bdLabels, tr("please, select a label"));
}
if (isAssigned(label)) {
- throw new WrongValueException(bdLabels, _("already assigned"));
+ throw new WrongValueException(bdLabels, tr("already assigned"));
}
try {
assignLabel(label);
@@ -103,19 +103,19 @@ public abstract class AssignedLabelsController extends GenericForwardCompo
// Check if user has permissions to create labels
if (!SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_LABELS)) {
throw new WrongValueException(buttonCreateAndAssign,
- _("you do not have permissions to create new labels"));
+ tr("you do not have permissions to create new labels"));
}
// Check LabelType is not null
final Comboitem comboitem = cbLabelType.getSelectedItem();
if (comboitem == null || comboitem.getValue() == null) {
- throw new WrongValueException(cbLabelType, _("please, select an item"));
+ throw new WrongValueException(cbLabelType, tr("please, select an item"));
}
// Check Label is not null or empty
final String labelName = txtLabelName.getValue();
if (labelName == null || labelName.isEmpty()) {
- throw new WrongValueException(txtLabelName, _("cannot be empty"));
+ throw new WrongValueException(txtLabelName, tr("cannot be empty"));
}
// Label does not exist, create
@@ -125,7 +125,7 @@ public abstract class AssignedLabelsController extends GenericForwardCompo
label = addLabel(labelName, labelType);
} else {
if (isAssigned(label)) {
- throw new WrongValueException(txtLabelName, _("already assigned"));
+ throw new WrongValueException(txtLabelName, tr("already assigned"));
}
}
try {
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/materials/AssignedMaterialsController.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/materials/AssignedMaterialsController.java
index eb5dd2124..c7c51a1da 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/materials/AssignedMaterialsController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/materials/AssignedMaterialsController.java
@@ -58,7 +58,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* @author Óscar González Fernández
@@ -377,8 +377,8 @@ public abstract class AssignedMaterialsController extends GenericForwardCo
*/
public void showRemoveMaterialAssignmentDlg(A materialAssignment) {
int status = Messagebox.show(
- _("Delete item {0}. Are you sure?", getMaterial(materialAssignment).getCode()),
- _("Delete"), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
+ tr("Delete item {0}. Are you sure?", getMaterial(materialAssignment).getCode()),
+ tr("Delete"), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
if ( Messagebox.OK == status ) {
removeMaterialAssignment(materialAssignment);
@@ -447,11 +447,11 @@ public abstract class AssignedMaterialsController extends GenericForwardCo
MessageboxDlg dialogSplitAssignment;
final String message =
- _("Do you want to split the material assignment {0}?", getMaterial(materialAssignment).getCode());
+ tr("Do you want to split the material assignment {0}?", getMaterial(materialAssignment).getCode());
Map args = new HashMap<>();
args.put("message", message);
- args.put("title", _("Split new assignment"));
+ args.put("title", tr("Split new assignment"));
args.put("OK", Messagebox.OK);
args.put("CANCEL", Messagebox.CANCEL);
args.put("icon", Messagebox.QUESTION);
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/TaskElementAdapter.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/TaskElementAdapter.java
index 6bd7d34be..c7bf16abf 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/TaskElementAdapter.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/TaskElementAdapter.java
@@ -21,7 +21,7 @@
package org.libreplan.web.planner;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import static org.libreplan.web.common.Util.addCurrencySymbol;
import static org.zkoss.ganttz.data.constraint.ConstraintOnComparableValues.biggerOrEqualThan;
import static org.zkoss.ganttz.data.constraint.ConstraintOnComparableValues.equalTo;
@@ -795,7 +795,7 @@ public class TaskElementAdapter {
forCriterionRepresentations.add(c.getName());
}
} else {
- forCriterionRepresentations.add(_("All workers"));
+ forCriterionRepresentations.add(tr("All workers"));
}
return "[" + StringUtils.join(forCriterionRepresentations, ", ") + "]";
@@ -843,13 +843,13 @@ public class TaskElementAdapter {
.append("
");
result
- .append(_("Progress"))
+ .append(tr("Progress"))
.append(": ")
.append(progressPercentage)
.append("% , ");
result
- .append(_("Hours invested"))
+ .append(tr("Hours invested"))
.append(": ")
.append(getHoursAdvanceBarPercentage().multiply(new BigDecimal(100)))
.append("%
");
@@ -857,7 +857,7 @@ public class TaskElementAdapter {
if ( taskElement.getOrderElement() instanceof Order ) {
result
- .append(_("State"))
+ .append(tr("State"))
.append(": ")
.append(getOrderState());
} else {
@@ -868,11 +868,11 @@ public class TaskElementAdapter {
String costExpenses = addCurrencySymbol(getExpensesMoneyCost());
result
- .append(_("Budget: {0}, Consumed: {1} ({2}%)",
+ .append(tr("Budget: {0}, Consumed: {1} ({2}%)",
budget, moneyCost, getMoneyCostBarPercentage().multiply(new BigDecimal(100))))
.append("
");
- result.append(_("Hours cost: {0}, Expenses cost: {1}", costHours, costExpenses));
+ result.append(tr("Hours cost: {0}, Expenses cost: {1}", costHours, costExpenses));
}
String labels = buildLabelsText();
@@ -880,7 +880,7 @@ public class TaskElementAdapter {
result
.append("")
- .append(_("Labels"))
+ .append(tr("Labels"))
.append(": ")
.append(labels)
.append("
");
@@ -911,7 +911,7 @@ public class TaskElementAdapter {
} else {
cssClass = "order-closed";
}
- return "" + _(state.toString()) + "";
+ return "" + tr(state.toString()) + "";
}
@Override
@@ -1210,14 +1210,14 @@ public class TaskElementAdapter {
boolean condition = orderElement.getOrder().getHoursMargin() != null;
Integer margin = condition ? orderElement.getOrder().getHoursMargin() : 0;
- result.append(_("Hours-status")).append("\n");
+ result.append(tr("Hours-status")).append("\n");
- result.append(_("Project margin: {0}% ({1} hours)={2} hours",
+ result.append(tr("Project margin: {0}% ({1} hours)={2} hours",
margin, orderElement.getWorkHours(), orderElement.getWithMarginCalculatedHours()));
String totalEffortHours = orderElement.getEffortAsString();
- result.append(_(". Already registered: {0} hours", totalEffortHours));
+ result.append(tr(". Already registered: {0} hours", totalEffortHours));
return result.toString();
}
@@ -1229,16 +1229,16 @@ public class TaskElementAdapter {
Integer margin = condition ? orderElement.getOrder().getBudgetMargin() : 0;
- result.append(_("Budget-status")).append("\n");
+ result.append(tr("Budget-status")).append("\n");
- result.append(_("Project margin: {0}% ({1})={2}",
+ result.append(tr("Project margin: {0}% ({1})={2}",
margin,
addCurrencySymbol(orderElement.getBudget()),
addCurrencySymbol(orderElement.getWithMarginCalculatedBudget())));
BigDecimal totalExpense = getTotalExpense(orderElement);
- result.append(_(". Already spent: {0}", addCurrencySymbol(totalExpense)));
+ result.append(tr(". Already spent: {0}", addCurrencySymbol(totalExpense)));
return result.toString();
}
@@ -1288,7 +1288,7 @@ public class TaskElementAdapter {
return DependencyType.END_END;
default:
- throw new RuntimeException(_("{0} not supported yet", type));
+ throw new RuntimeException(tr("{0} not supported yet", type));
}
}
@@ -1308,7 +1308,7 @@ public class TaskElementAdapter {
return Type.END_END;
default:
- throw new RuntimeException(_("{0} not supported yet", type));
+ throw new RuntimeException(tr("{0} not supported yet", type));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/adaptplanning/AdaptPlanningCommand.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/adaptplanning/AdaptPlanningCommand.java
index 74600e140..19743497d 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/adaptplanning/AdaptPlanningCommand.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/adaptplanning/AdaptPlanningCommand.java
@@ -18,7 +18,7 @@
*/
package org.libreplan.web.planner.adaptplanning;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.Date;
import java.util.List;
@@ -57,7 +57,7 @@ public class AdaptPlanningCommand implements IAdaptPlanningCommand {
@Override
public String getName() {
- return _("Adapt planning according to timesheets");
+ return tr("Adapt planning according to timesheets");
}
@Override
@@ -67,7 +67,7 @@ public class AdaptPlanningCommand implements IAdaptPlanningCommand {
@Override
public String getName() {
- return _("Adapting planning according to timesheets");
+ return tr("Adapting planning according to timesheets");
}
@Override
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/advances/AdvanceAssignmentPlanningCommand.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/advances/AdvanceAssignmentPlanningCommand.java
index 230a8a615..ead6cea84 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/advances/AdvanceAssignmentPlanningCommand.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/advances/AdvanceAssignmentPlanningCommand.java
@@ -21,7 +21,7 @@
package org.libreplan.web.planner.advances;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import org.libreplan.business.planner.entities.Task;
import org.libreplan.business.planner.entities.TaskElement;
@@ -66,7 +66,7 @@ public class AdvanceAssignmentPlanningCommand implements IAdvanceAssignmentPlann
@Override
public String getName() {
- return _("Progress assignment");
+ return tr("Progress assignment");
}
@Override
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/AdvancedAllocationCommand.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/AdvancedAllocationCommand.java
index 886633ea8..cdd96472c 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/AdvancedAllocationCommand.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/AdvancedAllocationCommand.java
@@ -19,7 +19,7 @@
package org.libreplan.web.planner.allocation;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import org.libreplan.business.planner.entities.Task;
import org.libreplan.business.planner.entities.TaskElement;
@@ -44,7 +44,7 @@ public class AdvancedAllocationCommand implements IAdvancedAllocationCommand {
@Override
public String getName() {
- return _("Advanced allocation");
+ return tr("Advanced allocation");
}
@Override
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/AdvancedAllocationController.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/AdvancedAllocationController.java
index 62e571e5a..2b4452782 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/AdvancedAllocationController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/AdvancedAllocationController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.planner.allocation;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.Arrays;
@@ -761,7 +761,7 @@ public class AdvancedAllocationController extends GenericForwardComposer {
for (AllocationInput allocationInput : allocationInputs)
allocationInput.getResultReceiver().accepted(allocationInput.getAggregate());
- Messagebox.show(_("Changes applied"), _("Information"), Messagebox.OK, Messagebox.INFORMATION);
+ Messagebox.show(tr("Changes applied"), tr("Information"), Messagebox.OK, Messagebox.INFORMATION);
}
/**
@@ -1010,7 +1010,7 @@ public class AdvancedAllocationController extends GenericForwardComposer {
private List getColumnsForLeft() {
List result = new ArrayList<>();
- result.add(new ColumnOnRow(_("Name")) {
+ result.add(new ColumnOnRow(tr("Name")) {
@Override
public Component cellFor(Row row) {
@@ -1018,14 +1018,14 @@ public class AdvancedAllocationController extends GenericForwardComposer {
}
});
- result.add(new ColumnOnRow(_("Efforts"), "52px") {
+ result.add(new ColumnOnRow(tr("Efforts"), "52px") {
@Override
public Component cellFor(Row row) {
return row.getAllEffort();
}
});
- result.add(new ColumnOnRow(_("Function"), "130px") {
+ result.add(new ColumnOnRow(tr("Function"), "130px") {
@Override
public Component cellFor(Row row) {
return row.getFunction();
@@ -1104,7 +1104,7 @@ abstract class ColumnOnRow implements IConvertibleToColumn {
@Override
public Column toColumn() {
Column column = new Column();
- column.setLabel(_(columnName));
+ column.setLabel(tr(columnName));
column.setSclass(columnName.toLowerCase());
if ( width != null )
@@ -1259,7 +1259,7 @@ class Row {
@Override
protected String getTitle() {
- return _("Stretches list");
+ return tr("Stretches list");
}
@Override
@@ -1282,7 +1282,7 @@ class Row {
@Override
protected String getTitle() {
- return _("Stretches with Interpolation");
+ return tr("Stretches with Interpolation");
}
@Override
@@ -1514,7 +1514,7 @@ class Row {
return new Label();
else if ( isLimiting )
- return new Label(_("Queue-based assignment"));
+ return new Label(tr("Queue-based assignment"));
else {
if ( hboxAssignmentFunctionsCombo == null )
@@ -1571,7 +1571,7 @@ class Row {
}
private Listitem listItem(IAssignmentFunctionConfiguration assignmentFunction) {
- Listitem listitem = new Listitem(_(assignmentFunction.getName()));
+ Listitem listitem = new Listitem(tr(assignmentFunction.getName()));
listitem.setValue(assignmentFunction);
return listitem;
@@ -1617,13 +1617,13 @@ class Row {
private void showCannotApplySigmoidFunction() {
Messagebox.show(
- _("Task contains consolidated progress. Cannot apply sigmoid function."), _("Error"),
+ tr("Task contains consolidated progress. Cannot apply sigmoid function."), tr("Error"),
Messagebox.OK, Messagebox.ERROR);
}
private int showConfirmChangeFunctionDialog() throws InterruptedException {
return Messagebox.show(
- _("Assignment function will be changed. Are you sure?"), _("Confirm change"),
+ tr("Assignment function will be changed. Are you sure?"), tr("Confirm change"),
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
}
@@ -1656,10 +1656,10 @@ class Row {
private void updateAssignmentFunctionsConfigureButton(Button button, boolean configurable) {
if ( configurable ) {
- button.setTooltiptext(_("Configure"));
+ button.setTooltiptext(tr("Configure"));
button.setDisabled(false);
} else {
- button.setTooltiptext(_("Not configurable"));
+ button.setTooltiptext(tr("Not configurable"));
button.setDisabled(true);
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/AllocationRow.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/AllocationRow.java
index 637b577e3..952823c17 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/AllocationRow.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/AllocationRow.java
@@ -82,7 +82,7 @@ import java.util.List;
import com.libreplan.java.zk.components.customdetailrowcomponent.Detail;
import static org.libreplan.business.workingday.EffortDuration.zero;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* It connects the GUI widgets of the allocation row in the GUI with the
@@ -409,7 +409,7 @@ public abstract class AllocationRow {
AssignmentFunction function = getAssignmentFunction();
if (function != null) {
- Listitem listitem = new Listitem(_(function.getName()));
+ Listitem listitem = new Listitem(tr(function.getName()));
listitem.setDisabled(true);
assignmentFunctionListbox.appendChild(listitem);
assignmentFunctionListbox.setSelectedItem(listitem);
@@ -417,7 +417,7 @@ public abstract class AllocationRow {
}
private void initializeAndAppendFlatFunction() {
- Listitem listitem = new Listitem(_(AssignmentFunctionName.FLAT.toString()));
+ Listitem listitem = new Listitem(tr(AssignmentFunctionName.FLAT.toString()));
assignmentFunctionListbox.getChildren().clear();
assignmentFunctionListbox.appendChild(listitem);
assignmentFunctionListbox.setSelectedItem(listitem);
@@ -442,7 +442,7 @@ public abstract class AllocationRow {
private void onDifferentRealResourcesPerDay(ResourcesPerDay realResourcesPerDay) {
this.realResourcesPerDay.setSclass("assigned-resources-label");
- this.realResourcesPerDay.setTooltiptext(_(
+ this.realResourcesPerDay.setTooltiptext(tr(
"Only {0} resources per day were achieved for current allocation",
realResourcesPerDay.getAmount().toPlainString()));
@@ -625,7 +625,7 @@ public abstract class AllocationRow {
@Override
public Void onHours(EffortModification modification) {
EffortDuration goal = modification.getEffort();
- Clients.response(new AuWrongValue(effortInput, _("{0} cannot be fulfilled", goal.toFormattedString())));
+ Clients.response(new AuWrongValue(effortInput, tr("{0} cannot be fulfilled", goal.toFormattedString())));
return null;
}
@@ -811,7 +811,7 @@ public abstract class AllocationRow {
AvailabilityTimeLine otherAvailability = result.getSpecifiedAdditionalAvailability();
if (calendarValidPeriods.isEmpty()) {
- throw new WrongValueException(row, _("there are no valid periods for this calendar"));
+ throw new WrongValueException(row, tr("there are no valid periods for this calendar"));
} else if (otherAvailability.getValidPeriods().isEmpty()) {
throw new WrongValueException(row, allocationAttempt.getNoValidPeriodsMessage());
} else {
@@ -825,23 +825,23 @@ public abstract class AllocationRow {
EffortDuration sumReached = result.getSumReached();
List validPeriods = result.getValidPeriods();
- String firstLine = _(
+ String firstLine = tr(
"In the available periods {0} only {1} hours are available.",
validPeriods,
sumReached.getHours());
String secondLine = isGeneric()
- ? _("Periods available depend on the satisfaction of " +
+ ? tr("Periods available depend on the satisfaction of " +
"the criteria of resources and their calendars.")
- : _("Periods available depend on resources' calendar.");
+ : tr("Periods available depend on resources' calendar.");
throw new WrongValueException(effortInput, firstLine + "\n" + secondLine);
}
@Override
public Void on(ResourcesPerDayIsZero result) {
- throw new WrongValueException(intendedResourcesPerDayInput, _("Resources per day are zero"));
+ throw new WrongValueException(intendedResourcesPerDayInput, tr("Resources per day are zero"));
}
});
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/FormBinder.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/FormBinder.java
index b3925ccc6..12920aadf 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/FormBinder.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/FormBinder.java
@@ -23,7 +23,7 @@ package org.libreplan.web.planner.allocation;
import static org.libreplan.business.workingday.EffortDuration.hours;
import static org.libreplan.business.workingday.EffortDuration.zero;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import static org.libreplan.web.planner.allocation.AllocationRow.assignEfforts;
import static org.libreplan.web.planner.allocation.AllocationRow.sumAllEffortFromInputs;
import static org.libreplan.web.planner.allocation.AllocationRow.sumAllOriginalEffort;
@@ -336,7 +336,7 @@ public class FormBinder {
Clients.response(new AuWrongValue(
taskWorkableDays,
- _("The original workable days value {0} cannot be modified as it has consolidations",
+ tr("The original workable days value {0} cannot be modified as it has consolidations",
specifiedWorkableDays)) );
taskWorkableDays.setValue(effectiveWorkableDays);
@@ -631,13 +631,13 @@ public class FormBinder {
}
void markAssignedHoursMustBePositive() {
- throw new WrongValueException(effortInput, _("it must be greater than zero"));
+ throw new WrongValueException(effortInput, tr("it must be greater than zero"));
}
void markRepeatedResources(List resources) {
messagesForUser.showMessage(
Level.ERROR,
- _("{0} already assigned to resource allocation list",
+ tr("{0} already assigned to resource allocation list",
StringUtils.join(getResourcesDescriptions(resources), ", ")));
}
@@ -652,18 +652,18 @@ public class FormBinder {
void markNoResourcesMatchedByCriterions(ResourceEnum resourceType, Collection extends Criterion> criterions) {
messagesForUser.showMessage(Level.ERROR,
- _("there are no resources for required criteria: {0}. So the generic allocation can't be added",
+ tr("there are no resources for required criteria: {0}. So the generic allocation can't be added",
Criterion.getCaptionFor(resourceType, criterions)));
}
void markThereisAlreadyAssignmentWith(ResourceEnum resourceType, Collection extends Criterion> criterions) {
messagesForUser.showMessage(Level.ERROR,
- _("already exists an allocation for criteria {0}", Criterion.getCaptionFor(resourceType, criterions)));
+ tr("already exists an allocation for criteria {0}", Criterion.getCaptionFor(resourceType, criterions)));
}
void markNoEmptyResourcesPerDay(List rows) {
Validate.isTrue(!rows.isEmpty());
- final String message = _("resources per day cannot be empty or less than zero");
+ final String message = tr("resources per day cannot be empty or less than zero");
if ( !recommendedAllocation ) {
AllocationRow first = rows.get(0);
throw new WrongValueException(first.getIntendedResourcesPerDayInput(), message);
@@ -896,7 +896,7 @@ public class FormBinder {
public void cannotAllocateMoreThanOneResource(List resources) {
messagesForUser.showMessage(Level.ERROR,
- _("{0} could not be allocated. " + "Cannot allocate more than one resource",
+ tr("{0} could not be allocated. " + "Cannot allocate more than one resource",
Resource.getCaptionFor(resources)));
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/GenericAllocationRow.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/GenericAllocationRow.java
index c8ed1146e..c743e8d88 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/GenericAllocationRow.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/GenericAllocationRow.java
@@ -21,7 +21,7 @@
package org.libreplan.web.planner.allocation;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.Collection;
@@ -52,7 +52,7 @@ public class GenericAllocationRow extends AllocationRow {
private static GenericAllocationRow initializeDefault(
GenericAllocationRow result, ResourceEnum resourceType) {
Validate.notNull(resourceType);
- result.setName(_("Generic"));
+ result.setName(tr("Generic"));
result.resourceType = resourceType;
return result;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/ResourceAllocationCommand.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/ResourceAllocationCommand.java
index e6ea85c99..684b0ce3f 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/ResourceAllocationCommand.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/ResourceAllocationCommand.java
@@ -21,7 +21,7 @@
package org.libreplan.web.planner.allocation;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import org.libreplan.business.planner.entities.Task;
import org.libreplan.business.planner.entities.TaskElement;
@@ -68,7 +68,7 @@ public class ResourceAllocationCommand implements IResourceAllocationCommand {
@Override
public String getName() {
- return _("Resource allocation");
+ return tr("Resource allocation");
}
@Override
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/ResourceAllocationController.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/ResourceAllocationController.java
index e1ff55c77..aeecfa804 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/ResourceAllocationController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/ResourceAllocationController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.planner.allocation;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.Arrays;
@@ -287,7 +287,7 @@ public class ResourceAllocationController extends GenericForwardComposer {
case MACHINE:
case WORKER:
- return _(resourceType.getDisplayName());
+ return tr(resourceType.getDisplayName());
default:
LOG.warn("no i18n for " + resourceType.name());
@@ -365,7 +365,7 @@ public class ResourceAllocationController extends GenericForwardComposer {
WORKABLE_DAYS(CalculatedValue.END_DATE) {
@Override
public String getName() {
- return _("Calculate Workable Days");
+ return tr("Calculate Workable Days");
}
@Override
@@ -377,7 +377,7 @@ public class ResourceAllocationController extends GenericForwardComposer {
NUMBER_OF_HOURS(CalculatedValue.NUMBER_OF_HOURS) {
@Override
public String getName() {
- return _("Calculate Number of Hours");
+ return tr("Calculate Number of Hours");
}
@Override
@@ -389,7 +389,7 @@ public class ResourceAllocationController extends GenericForwardComposer {
RESOURCES_PER_DAY(CalculatedValue.RESOURCES_PER_DAY) {
@Override
public String getName() {
- return _("Calculate Resources per Day");
+ return tr("Calculate Resources per Day");
}
@Override
@@ -435,21 +435,21 @@ public class ResourceAllocationController extends GenericForwardComposer {
}
public enum DerivedAllocationColumn implements IConvertibleToColumn {
- NAME(_("Name")) {
+ NAME(tr("Name")) {
@Override
public Component cellFor(DerivedAllocation data) {
return new Label(data.getName());
}
},
- ALPHA(_("Alpha")) {
+ ALPHA(tr("Alpha")) {
@Override
public Component cellFor(DerivedAllocation data) {
return new Label(String.format("%3.2f", data.getAlpha()));
}
},
- HOURS(_("Total Hours")) {
+ HOURS(tr("Total Hours")) {
@Override
public Component cellFor(DerivedAllocation data) {
return new Label(Integer.toString(data.getHours()));
@@ -468,12 +468,12 @@ public class ResourceAllocationController extends GenericForwardComposer {
/**
* Forces to mark the string as needing translation.
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
public String getName() {
- return I18nHelper._(name);
+ return I18nHelper.tr(name);
}
@Override
@@ -605,7 +605,7 @@ public class ResourceAllocationController extends GenericForwardComposer {
private void renderAggregatingRow(Row row) {
ResourceAllocationController controller = ResourceAllocationController.this;
append(row, new Label());
- append(row, new Label(_("Total")));
+ append(row, new Label(tr("Total")));
append(row, allOriginalEffort);
append(row, allTotalEffort);
append(row, allConsolidatedEffort);
@@ -626,7 +626,7 @@ public class ResourceAllocationController extends GenericForwardComposer {
button.setSclass("icono");
button.setImage("/common/img/ico_borrar1.png");
button.setHoverImage("/common/img/ico_borrar.png");
- button.setTooltiptext(_("Delete"));
+ button.setTooltiptext(tr("Delete"));
return append(row, button);
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/stretches/StretchesFunctionController.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/stretches/StretchesFunctionController.java
index a8a98e3e8..29ffe05e9 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/stretches/StretchesFunctionController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/stretches/StretchesFunctionController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.planner.allocation.stretches;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.math.BigDecimal;
import java.math.RoundingMode;
@@ -118,13 +118,13 @@ public class StretchesFunctionController extends GenericForwardComposer {
stretchesFunctionModel.confirm();
exit();
} catch (ValidationException e) {
- Messagebox.show(e.getMessage(), _("Error"), Messagebox.OK, Messagebox.ERROR);
+ Messagebox.show(e.getMessage(), tr("Error"), Messagebox.OK, Messagebox.ERROR);
}
}
public void cancel() throws InterruptedException {
- int status = Messagebox.show(_("All changes will be lost. Are you sure?"),
- _("Confirm cancel"), Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
+ int status = Messagebox.show(tr("All changes will be lost. Are you sure?"),
+ tr("Confirm cancel"), Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
if ( Messagebox.YES == status ) {
stretchesFunctionModel.cancel();
close();
@@ -325,7 +325,7 @@ public class StretchesFunctionController extends GenericForwardComposer {
private void checkBetweenZeroAndOneHundred(BigDecimal percent) {
if (percent.toBigInteger().intValue() > 100 || percent.toBigInteger().intValue() < 0) {
throw new WrongValueException(tempDecimalbox,
- _("Length percentage should be between 0 and 100"));
+ tr("Length percentage should be between 0 and 100"));
}
}
@@ -364,7 +364,7 @@ public class StretchesFunctionController extends GenericForwardComposer {
} catch (IllegalArgumentException e) {
throw new WrongValueException(
decimalBox,
- _("Amount work percentage should be between 0 and 100"));
+ tr("Amount work percentage should be between 0 and 100"));
}
});
@@ -384,7 +384,7 @@ public class StretchesFunctionController extends GenericForwardComposer {
button = new Button("", "/common/img/ico_borrar1.png");
button.setHoverImage("/common/img/ico_borrar.png");
button.setSclass("icono");
- button.setTooltiptext(_("Delete"));
+ button.setTooltiptext(tr("Delete"));
button.addEventListener(Events.ON_CLICK, event -> {
stretchesFunctionModel.removeStretch(stretch);
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/stretches/StretchesFunctionModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/stretches/StretchesFunctionModel.java
index d9392626c..f8cca2ce3 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/stretches/StretchesFunctionModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/allocation/stretches/StretchesFunctionModel.java
@@ -21,7 +21,7 @@
package org.libreplan.web.planner.allocation.stretches;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.math.BigDecimal;
import java.text.DateFormat;
@@ -162,21 +162,21 @@ public class StretchesFunctionModel implements IStretchesFunctionModel {
if (stretchesFunction != null) {
if (!stretchesFunction.isNoEmptyConstraint()) {
throw new ValidationException(
- _("At least one stretch is needed"));
+ tr("At least one stretch is needed"));
}
if (!stretchesFunction.isStretchesOrderConstraint()) {
throw new ValidationException(
- _("Some stretch has higher or equal values than the "
+ tr("Some stretch has higher or equal values than the "
+ "previous stretch"));
}
if (!stretchesFunction.isOneHundredPercentConstraint()) {
throw new ValidationException(
- _("Last stretch should have 100% for length and amount of work"));
+ tr("Last stretch should have 100% for length and amount of work"));
}
if (stretchesFunction.isInterpolated()) {
if (!stretchesFunction.checkHasAtLeastTwoStretches()) {
throw new ValidationException(
- _("There must be at least 2 stretches for doing interpolation"));
+ tr("There must be at least 2 stretches for doing interpolation"));
}
}
if (originalStretchesFunction != null) {
@@ -275,13 +275,13 @@ public class StretchesFunctionModel implements IStretchesFunctionModel {
throws IllegalArgumentException {
if (date.compareTo(task.getStartDate()) < 0) {
throw new IllegalArgumentException(
- _("Stretch date must not be before task start date: "
+ tr("Stretch date must not be before task start date: "
+ sameFormatAsDefaultZK(task.getStartDate())));
}
if (date.compareTo(taskEndDate) > 0) {
throw new IllegalArgumentException(
- _("Stretch date must be earlier than End date: "
+ tr("Stretch date must be earlier than End date: "
+ sameFormatAsDefaultZK(taskEndDate)));
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/calendar/CalendarAllocationCommand.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/calendar/CalendarAllocationCommand.java
index 2a7a10916..ef0347eff 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/calendar/CalendarAllocationCommand.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/calendar/CalendarAllocationCommand.java
@@ -21,7 +21,7 @@
package org.libreplan.web.planner.calendar;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import org.libreplan.business.planner.entities.Task;
import org.libreplan.business.planner.entities.TaskElement;
@@ -52,7 +52,7 @@ public class CalendarAllocationCommand implements ICalendarAllocationCommand {
@Override
public String getName() {
- return _("Calendar allocation");
+ return tr("Calendar allocation");
}
@Override
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/chart/EarnedValueChartFiller.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/chart/EarnedValueChartFiller.java
index 069cf8fbd..f81488a29 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/chart/EarnedValueChartFiller.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/chart/EarnedValueChartFiller.java
@@ -242,23 +242,23 @@ public abstract class EarnedValueChartFiller extends ChartFiller {
*/
public enum EarnedValueType {
- BCWS(_("BCWS"), _("Budgeted Cost Work Scheduled"), "#0000FF"), ACWP(
- _("ACWP"), _("Actual Cost Work Performed"), "#FF0000"), BCWP(
- _("BCWP"), _("Budgeted Cost Work Performed"), "#00FF00"), CV(
- _("CV"), _("Cost Variance"), "#FF8800"), SV(_("SV"),
- _("Schedule Variance"), "#00FFFF"), BAC(_("BAC"),
- _("Budget At Completion"), "#FF00FF"), EAC(_("EAC"),
- _("Estimate At Completion"), "#880000"), VAC(_("VAC"),
- _("Variance At Completion"), "#000088"), ETC(_("ETC"),
- _("Estimate To Complete"), "#008800"), CPI(_("CPI"),
- _("Cost Performance Index"), "#888800"), SPI(_("SPI"),
- _("Schedule Performance Index"), "#008888")
+ BCWS(tr("BCWS"), tr("Budgeted Cost Work Scheduled"), "#0000FF"), ACWP(
+ tr("ACWP"), tr("Actual Cost Work Performed"), "#FF0000"), BCWP(
+ tr("BCWP"), tr("Budgeted Cost Work Performed"), "#00FF00"), CV(
+ tr("CV"), tr("Cost Variance"), "#FF8800"), SV(tr("SV"),
+ tr("Schedule Variance"), "#00FFFF"), BAC(tr("BAC"),
+ tr("Budget At Completion"), "#FF00FF"), EAC(tr("EAC"),
+ tr("Estimate At Completion"), "#880000"), VAC(tr("VAC"),
+ tr("Variance At Completion"), "#000088"), ETC(tr("ETC"),
+ tr("Estimate To Complete"), "#008800"), CPI(tr("CPI"),
+ tr("Cost Performance Index"), "#888800"), SPI(tr("SPI"),
+ tr("Schedule Performance Index"), "#008888")
;
/**
* Forces to mark the string as needing translation
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
@@ -273,11 +273,11 @@ public abstract class EarnedValueChartFiller extends ChartFiller {
}
public String getAcronym() {
- return I18nHelper._(acronym);
+ return I18nHelper.tr(acronym);
}
public String getName() {
- return I18nHelper._(name);
+ return I18nHelper.tr(name);
}
public String getColor() {
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/company/CompanyPlanningController.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/company/CompanyPlanningController.java
index 828d82c50..b8394d8b1 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/company/CompanyPlanningController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/company/CompanyPlanningController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.planner.company;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.Date;
@@ -241,7 +241,7 @@ public class CompanyPlanningController implements Composer {
public void render(Comboitem item, Object data, int i) {
final ProgressType progressType = (ProgressType) data;
item.setValue(progressType);
- item.setLabel(_(progressType.getValue()));
+ item.setLabel(tr(progressType.getValue()));
ProgressType configuredProgressType = getProgressTypeFromConfiguration();
if ( (configuredProgressType != null) && configuredProgressType.equals(progressType) ) {
@@ -290,7 +290,7 @@ public class CompanyPlanningController implements Composer {
(finishDate.compareTo((Date) filterStartDate.getRawValue()) < 0)) {
filterFinishDate.setValue(null);
- throw new WrongValueException(comp, _("must be after start date"));
+ throw new WrongValueException(comp, tr("must be after start date"));
}
}
};
@@ -306,7 +306,7 @@ public class CompanyPlanningController implements Composer {
(startDate.compareTo((Date) filterFinishDate.getRawValue()) > 0)) {
filterStartDate.setValue(null);
- throw new WrongValueException(comp, _("must be lower than end date"));
+ throw new WrongValueException(comp, tr("must be lower than end date"));
}
}
};
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/company/CompanyPlanningModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/company/CompanyPlanningModel.java
index 648189be3..4a0862b5e 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/company/CompanyPlanningModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/company/CompanyPlanningModel.java
@@ -21,7 +21,7 @@
package org.libreplan.web.planner.company;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.io.IOException;
import java.io.StringWriter;
@@ -344,8 +344,8 @@ public class CompanyPlanningModel implements ICompanyPlanningModel {
private void appendTabs(Tabbox chartComponent) {
Tabs chartTabs = new Tabs();
- chartTabs.appendChild(new Tab(_("Load")));
- chartTabs.appendChild(new Tab(_("Earned value")));
+ chartTabs.appendChild(new Tab(tr("Load")));
+ chartTabs.appendChild(new Tab(tr("Earned value")));
chartComponent.appendChild(chartTabs);
chartTabs.setWidth("124px");
@@ -385,7 +385,7 @@ public class CompanyPlanningModel implements ICompanyPlanningModel {
Date today = LocalDate.fromDateFields(new Date()).toDateTimeAtStartOfDay().toDate();
if ( value != null && (value.compareTo(today) > 0) ) {
- throw new WrongValueException(datebox, _("date in the future"));
+ throw new WrongValueException(datebox, tr("date in the future"));
}
}
@@ -439,7 +439,7 @@ public class CompanyPlanningModel implements ICompanyPlanningModel {
vbox.setPack(CENTER);
Hbox dateHbox = new Hbox();
- dateHbox.appendChild(new Label(_("Select date")));
+ dateHbox.appendChild(new Label(tr("Select date")));
LocalDate initialDate = earnedValueChartFiller.initialDateForIndicatorValues();
Datebox datebox = new Datebox(initialDate.toDateTimeAtStartOfDay().toDate());
@@ -535,7 +535,7 @@ public class CompanyPlanningModel implements ICompanyPlanningModel {
? earnedValueChartFiller.getIndicator(type, date)
: BigDecimal.ZERO;
- String units = _("h");
+ String units = tr("h");
if (type.equals(EarnedValueType.CPI) || type.equals(EarnedValueType.SPI)) {
value = value.multiply(new BigDecimal(100));
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/consolidations/AdvanceConsolidationCommand.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/consolidations/AdvanceConsolidationCommand.java
index 69523d046..62c1ef3f3 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/consolidations/AdvanceConsolidationCommand.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/consolidations/AdvanceConsolidationCommand.java
@@ -21,7 +21,7 @@
package org.libreplan.web.planner.consolidations;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import org.libreplan.business.planner.entities.Task;
import org.libreplan.business.planner.entities.TaskElement;
@@ -64,7 +64,7 @@ public class AdvanceConsolidationCommand implements
@Override
public String getName() {
- return _("Progress consolidation");
+ return tr("Progress consolidation");
}
@Override
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/consolidations/AdvanceConsolidationController.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/consolidations/AdvanceConsolidationController.java
index bd0557471..9964d6b19 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/consolidations/AdvanceConsolidationController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/consolidations/AdvanceConsolidationController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.planner.consolidations;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.List;
@@ -106,8 +106,8 @@ public class AdvanceConsolidationController extends GenericForwardComposer {
String infoAdvanceAssignment = advanceConsolidationModel.getInfoAdvanceAssignment();
return infoAdvanceAssignment.isEmpty()
- ? _("Progress measurements")
- : _("Progress measurements") + ": " + infoAdvanceAssignment;
+ ? tr("Progress measurements")
+ : tr("Progress measurements") + ": " + infoAdvanceAssignment;
}
public List getAdvances() {
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/consolidations/AdvanceConsolidationModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/consolidations/AdvanceConsolidationModel.java
index fe31525f4..44dcbafbe 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/consolidations/AdvanceConsolidationModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/consolidations/AdvanceConsolidationModel.java
@@ -21,7 +21,7 @@
package org.libreplan.web.planner.consolidations;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.Collection;
@@ -455,7 +455,7 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
}
private String getInfoAdvanceAssignment(DirectAdvanceAssignment assignment) {
- return assignment == null || assignment.getMaxValue() == null ? "" : _("( max: {0} )", assignment.getMaxValue());
+ return assignment == null || assignment.getMaxValue() == null ? "" : tr("( max: {0} )", assignment.getMaxValue());
}
private List getAdvances() {
@@ -478,8 +478,8 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
public String infoMessages() {
return !getAdvances().isEmpty()
- ? _("Progress cannot be consolidated.")
- : _("There is not any assigned progress to current task");
+ ? tr("Progress cannot be consolidated.")
+ : tr("There is not any assigned progress to current task");
}
public void setConsolidationDTOs(List consolidationDTOs) {
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/limiting/allocation/LimitingResourceAllocationModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/limiting/allocation/LimitingResourceAllocationModel.java
index bf7829a89..199df62f1 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/limiting/allocation/LimitingResourceAllocationModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/limiting/allocation/LimitingResourceAllocationModel.java
@@ -21,7 +21,7 @@
package org.libreplan.web.planner.limiting.allocation;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.Collection;
@@ -150,7 +150,7 @@ public class LimitingResourceAllocationModel implements ILimitingResourceAllocat
if (resources.isEmpty()) {
getMessagesForUser()
.showMessage(Level.ERROR,
- _("there are no resources for required criteria: {0}. " +
+ tr("there are no resources for required criteria: {0}. " +
"So the generic allocation can't be added",
Criterion.getCaptionFor(resourceType, criteria)));
}
@@ -219,7 +219,7 @@ public class LimitingResourceAllocationModel implements ILimitingResourceAllocat
if (!areAllLimitingResources(resources)) {
getMessagesForUser().showMessage(Level.ERROR,
- _("All resources must be queue-based"));
+ tr("All resources must be queue-based"));
return;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/milestone/AddMilestoneCommand.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/milestone/AddMilestoneCommand.java
index e2afa7ea6..0ed4ceec7 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/milestone/AddMilestoneCommand.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/milestone/AddMilestoneCommand.java
@@ -21,7 +21,7 @@
package org.libreplan.web.planner.milestone;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import org.libreplan.business.planner.daos.ITaskElementDAO;
import org.libreplan.business.planner.entities.TaskElement;
@@ -51,7 +51,7 @@ public class AddMilestoneCommand implements IAddMilestoneCommand {
@Transactional(readOnly = true)
public void doAction(IContextWithPlannerTask context, TaskElement task) {
TaskMilestone milestone = TaskMilestone.create(task.getEndDate());
- milestone.setName(_("new milestone"));
+ milestone.setName(tr("new milestone"));
taskElementDAO.reattach(task);
Position taskPosition = context.getMapper().findPositionFor(task);
@@ -64,7 +64,7 @@ public class AddMilestoneCommand implements IAddMilestoneCommand {
@Override
public String getName() {
- return _("Add Milestone");
+ return tr("Add Milestone");
}
@Override
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/milestone/DeleteMilestoneCommand.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/milestone/DeleteMilestoneCommand.java
index 8a68a7e8e..d71c9c590 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/milestone/DeleteMilestoneCommand.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/milestone/DeleteMilestoneCommand.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.web.planner.milestone;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import org.libreplan.business.planner.entities.TaskElement;
import org.libreplan.business.planner.entities.TaskMilestone;
@@ -56,7 +56,7 @@ public class DeleteMilestoneCommand implements IDeleteMilestoneCommand {
@Override
public String getName() {
- return (_("Delete Milestone"));
+ return (tr("Delete Milestone"));
}
@Override
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/order/OrderPlanningController.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/order/OrderPlanningController.java
index c1db3aa38..efe398e84 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/order/OrderPlanningController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/order/OrderPlanningController.java
@@ -22,7 +22,7 @@
package org.libreplan.web.planner.order;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.Arrays;
@@ -308,7 +308,7 @@ public class OrderPlanningController implements Composer {
@Override
public String getName() {
- return _("filtering");
+ return tr("filtering");
}
});
@@ -342,7 +342,7 @@ public class OrderPlanningController implements Composer {
(finishDate.compareTo(filterStartDateOrderElement.getValue()) < 0)) {
filterFinishDateOrderElement.setRawValue(null);
- throw new WrongValueException(comp, _("must be after start date"));
+ throw new WrongValueException(comp, tr("must be after start date"));
}
}
@@ -358,7 +358,7 @@ public class OrderPlanningController implements Composer {
(startDate.compareTo(filterFinishDateOrderElement.getValue()) > 0)) {
filterStartDateOrderElement.setRawValue(null);
- throw new WrongValueException(comp, _("must be lower than end date"));
+ throw new WrongValueException(comp, tr("must be lower than end date"));
}
}
};
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/order/OrderPlanningModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/order/OrderPlanningModel.java
index df90a3607..4dbd6ed50 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/order/OrderPlanningModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/order/OrderPlanningModel.java
@@ -134,7 +134,7 @@ import org.zkoss.zul.Vbox;
import static org.libreplan.business.planner.chart.ContiguousDaysLine.toSortedMap;
import static org.libreplan.business.planner.chart.ContiguousDaysLine.min;
import static org.libreplan.business.planner.chart.ContiguousDaysLine.sum;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* @author Óscar González Fernández
@@ -517,7 +517,7 @@ public class OrderPlanningModel implements IOrderPlanningModel {
vbox.setPack(CENTER);
Hbox dateHbox = new Hbox();
- dateHbox.appendChild(new Label(_("Select date")));
+ dateHbox.appendChild(new Label(tr("Select date")));
LocalDate initialDateForIndicatorValues = earnedValueChartFiller.initialDateForIndicatorValues();
@@ -701,8 +701,8 @@ public class OrderPlanningModel implements IOrderPlanningModel {
private void appendTabs(Tabbox chartComponent) {
Tabs chartTabs = new Tabs();
- chartTabs.appendChild(createTab(_("Load"), "load_tab"));
- chartTabs.appendChild(createTab(_("Earned value"), "earned_value_tab"));
+ chartTabs.appendChild(createTab(tr("Load"), "load_tab"));
+ chartTabs.appendChild(createTab(tr("Earned value"), "earned_value_tab"));
chartComponent.appendChild(chartTabs);
chartTabs.setSclass("charts-tabbox");
@@ -736,7 +736,7 @@ public class OrderPlanningModel implements IOrderPlanningModel {
if ( value != null && !EarnedValueChartFiller.includes(
earnedValueChartFiller.getIndicatorsDefinitionInterval(), LocalDate.fromDateFields(value)) ) {
- throw new WrongValueException(comp, _("Date must be inside visualization area"));
+ throw new WrongValueException(comp, tr("Date must be inside visualization area"));
}
};
@@ -746,7 +746,7 @@ public class OrderPlanningModel implements IOrderPlanningModel {
Date value = datebox.getValue();
Date today = LocalDate.fromDateFields(new Date()).toDateTimeAtStartOfDay().toDate();
if ( value != null && (value.compareTo(today) > 0) ) {
- throw new WrongValueException(datebox, _("date in the future"));
+ throw new WrongValueException(datebox, tr("date in the future"));
}
}
@@ -846,7 +846,7 @@ public class OrderPlanningModel implements IOrderPlanningModel {
LocalDate date) {
BigDecimal value = earnedValueChartFiller.getIndicator(type, date);
- String units = _("h");
+ String units = tr("h");
if ( type.equals(EarnedValueType.CPI) || type.equals(EarnedValueType.SPI) ) {
value = value.multiply(new BigDecimal(100));
units = "%";
@@ -1017,14 +1017,14 @@ public class OrderPlanningModel implements IOrderPlanningModel {
@Override
public String getName() {
- return _("Cancel");
+ return tr("Cancel");
}
@Override
public void doAction(IContext context) {
Messagebox.show(
- _("Unsaved changes will be lost. Are you sure?"), _("Confirm exit dialog"),
+ tr("Unsaved changes will be lost. Are you sure?"), tr("Confirm exit dialog"),
Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION,
evt -> {
if ("onOK".equals(evt.getName())) {
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/order/SaveCommandBuilder.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/order/SaveCommandBuilder.java
index 3f5261e65..d72f2a5b4 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/order/SaveCommandBuilder.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/order/SaveCommandBuilder.java
@@ -109,7 +109,7 @@ import java.util.Set;
import java.util.SortedSet;
import static org.libreplan.business.planner.limiting.entities.LimitingResourceQueueDependency.toQueueDependencyType;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Builds a command that saves the changes in the taskElements.
@@ -325,8 +325,8 @@ public class SaveCommandBuilder {
LOG.warn("Error saving the project", validationException);
Messagebox.show(
- _("Error saving the project\n{0}", message.toString()),
- _("Error"), Messagebox.OK, Messagebox.ERROR);
+ tr("Error saving the project\n{0}", message.toString()),
+ tr("Error"), Messagebox.OK, Messagebox.ERROR);
}
@@ -344,7 +344,7 @@ public class SaveCommandBuilder {
return;
}
- Messagebox.show(_("Project saved"), _("Information"), Messagebox.OK, Messagebox.INFORMATION);
+ Messagebox.show(tr("Project saved"), tr("Information"), Messagebox.OK, Messagebox.INFORMATION);
if ( Executions.getCurrent() != null ) {
// Reset timer of warning on leaving page
ConfirmCloseUtil.resetConfirmClose();
@@ -352,7 +352,7 @@ public class SaveCommandBuilder {
if ( SecurityUtils.loggedUserCanWrite(state.getOrder()) )
ConfirmCloseUtil.setConfirmClose(
Executions.getCurrent().getDesktop(),
- _("You are about to leave the planning editing. Unsaved changes will be lost!"));
+ tr("You are about to leave the planning editing. Unsaved changes will be lost!"));
}
@@ -491,7 +491,7 @@ public class SaveCommandBuilder {
repeatedOrder = ((OrderLineGroup) order).findRepeatedOrderCode();
if (repeatedOrder != null)
- throw new ValidationException(_("Repeated Project code {0} in Project {1}", repeatedOrder.getCode(),
+ throw new ValidationException(tr("Repeated Project code {0} in Project {1}", repeatedOrder.getCode(),
repeatedOrder.getName()));
}
@@ -500,7 +500,7 @@ public class SaveCommandBuilder {
repeatedOrder = Registry.getOrderElementDAO().findRepeatedOrderCodeInDB(order);
if (repeatedOrder != null)
- throw new ValidationException(_(
+ throw new ValidationException(tr(
"Repeated Project code {0} in Project {1}", repeatedOrder.getCode(), repeatedOrder.getName()));
}
@@ -512,7 +512,7 @@ public class SaveCommandBuilder {
repeatedHoursGroup = (order).findRepeatedHoursGroupCode();
if (repeatedHoursGroup != null)
- throw new ValidationException(_(
+ throw new ValidationException(tr(
"Repeated Hours Group code {0} in Project {1}",
repeatedHoursGroup.getCode(),
repeatedHoursGroup.getParentOrderLine().getName()));
@@ -522,7 +522,7 @@ public class SaveCommandBuilder {
repeatedHoursGroup = Registry.getHoursGroupDAO().findRepeatedHoursGroupCodeInDB(order.getHoursGroups());
if (repeatedHoursGroup != null)
- throw new ValidationException(_(
+ throw new ValidationException(tr(
"Repeated Hours Group code {0} in Project {1}",
repeatedHoursGroup.getCode(),
repeatedHoursGroup.getParentOrderLine().getName()));
@@ -840,7 +840,7 @@ public class SaveCommandBuilder {
@Override
public String getName() {
- return _("Save");
+ return tr("Save");
}
@Override
@@ -860,8 +860,8 @@ public class SaveCommandBuilder {
private boolean userAcceptsCreateANewOrderVersion() {
int status = Messagebox.show(
- _("Confirm creating a new project version for this scenario and derived. Are you sure?"),
- _("New project version"), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
+ tr("Confirm creating a new project version for this scenario and derived. Are you sure?"),
+ tr("New project version"), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
return Messagebox.OK == status;
}
@@ -1005,12 +1005,12 @@ public class SaveCommandBuilder {
String orderElementName;
if ( invalidValue.getRootBean() instanceof Order )
- orderElementName = _("Project");
+ orderElementName = tr("Project");
else
- orderElementName = _("Task {0}", ((OrderElement) invalidValue.getRootBean()).getName());
+ orderElementName = tr("Task {0}", ((OrderElement) invalidValue.getRootBean()).getName());
- result.setValue(orderElementName + ": " + _(invalidValue.getMessage()));
+ result.setValue(orderElementName + ": " + tr(invalidValue.getMessage()));
return result;
@@ -1019,7 +1019,7 @@ public class SaveCommandBuilder {
HoursGroup hoursGroup = (HoursGroup) invalidValue.getRootBean();
result.setValue(
- _("Hours Group at {0}", getParentName(hoursGroup)) + ": " + _(invalidValue.getMessage()));
+ tr("Hours Group at {0}", getParentName(hoursGroup)) + ": " + tr(invalidValue.getMessage()));
return result;
} else {
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/order/SubcontractCommand.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/order/SubcontractCommand.java
index 40b73963a..964f1e601 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/order/SubcontractCommand.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/order/SubcontractCommand.java
@@ -21,7 +21,7 @@
package org.libreplan.web.planner.order;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import org.libreplan.business.planner.entities.Task;
import org.libreplan.business.planner.entities.TaskElement;
@@ -50,7 +50,7 @@ public class SubcontractCommand implements ISubcontractCommand {
@Override
public String getName() {
- return _("Subcontract");
+ return tr("Subcontract");
}
@Override
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/order/SubcontractController.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/order/SubcontractController.java
index 32c2ddd6c..e65864875 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/order/SubcontractController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/order/SubcontractController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.planner.order;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.Date;
import java.util.List;
@@ -136,7 +136,7 @@ public class SubcontractController extends GenericForwardComposer {
public void addDeliverDate(Datebox newDeliverDate){
if ( newDeliverDate == null || newDeliverDate.getValue() == null ) {
- messagesForUser.showMessage(Level.ERROR, _("You must select a valid date. "));
+ messagesForUser.showMessage(Level.ERROR, tr("You must select a valid date. "));
return;
}
@@ -144,14 +144,14 @@ public class SubcontractController extends GenericForwardComposer {
if ( thereIsSomeCommunicationDateEmpty() ) {
messagesForUser.showMessage(
Level.ERROR,
- _("It will only be possible to add a Deliver Date if " +
+ tr("It will only be possible to add a Deliver Date if " +
"all the deliver date exiting in the table have a CommunicationDate not empty. "));
return;
}
if ( subcontractModel.alreadyExistsRepeatedDeliverDate(newDeliverDate.getValue()) ) {
messagesForUser.showMessage(
Level.ERROR,
- _("It already exists a deliver date with the same date. "));
+ tr("It already exists a deliver date with the same date. "));
return;
}
@@ -204,7 +204,7 @@ public class SubcontractController extends GenericForwardComposer {
deleteButton.setSclass("icono");
deleteButton.setImage("/common/img/ico_borrar1.png");
deleteButton.setHoverImage("/common/img/ico_borrar.png");
- deleteButton.setTooltiptext(_("Delete"));
+ deleteButton.setTooltiptext(tr("Delete"));
deleteButton.addEventListener(
Events.ON_CLICK, (EventListener) event -> removeRequiredDeliverDate(subcontractorDeliverDate));
@@ -267,10 +267,10 @@ public class SubcontractController extends GenericForwardComposer {
private Button getUpdateButton(final EndDateCommunication endDateFromSubcontractor) {
- Button updateButton = new Button(_("Update task end"));
+ Button updateButton = new Button(tr("Update task end"));
updateButton.setDisabled(!isUpgradeable(endDateFromSubcontractor));
- updateButton.setTooltiptext(_("Update task end"));
+ updateButton.setTooltiptext(tr("Update task end"));
updateButton.setSclass("add-button");
updateButton.addEventListener(
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/pert/IPertChartModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/pert/IPertChartModel.java
new file mode 100644
index 000000000..c97b6efd8
--- /dev/null
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/pert/IPertChartModel.java
@@ -0,0 +1,23 @@
+/*
+ * This file is part of TASKPM
+ *
+ * Copyright (C) 2026 TASKPM Contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ */
+
+package org.libreplan.web.planner.pert;
+
+import org.libreplan.business.orders.entities.Order;
+
+import java.util.List;
+
+public interface IPertChartModel {
+
+ List getOrders();
+
+ Order getOrderWithTasks(Long orderId);
+}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/pert/PertChartController.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/pert/PertChartController.java
new file mode 100644
index 000000000..d71c48e6a
--- /dev/null
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/pert/PertChartController.java
@@ -0,0 +1,230 @@
+/*
+ * This file is part of TASKPM
+ *
+ * Copyright (C) 2026 TASKPM Contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package org.libreplan.web.planner.pert;
+
+import org.libreplan.business.orders.entities.Order;
+import org.libreplan.business.planner.entities.Dependency;
+import org.libreplan.business.planner.entities.Task;
+import org.libreplan.business.planner.entities.TaskElement;
+import org.libreplan.business.planner.entities.TaskGroup;
+import org.zkoss.json.JSONArray;
+import org.zkoss.json.JSONObject;
+import org.zkoss.zk.ui.event.Event;
+import org.zkoss.zk.ui.select.SelectorComposer;
+import org.zkoss.zk.ui.select.annotation.Listen;
+import org.zkoss.zk.ui.select.annotation.Wire;
+import org.zkoss.zk.ui.util.Clients;
+import org.zkoss.zkplus.spring.SpringUtil;
+import org.zkoss.zul.Button;
+import org.zkoss.zul.Checkbox;
+import org.zkoss.zul.Listbox;
+import org.zkoss.zul.Listitem;
+import org.zkoss.zul.Window;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Controller for the PERT Chart visualization.
+ *
+ * This controller loads project tasks and dependencies and renders them
+ * as a PERT/CPM network diagram using vis.js.
+ */
+public class PertChartController extends SelectorComposer {
+
+ private IPertChartModel pertChartModel;
+
+ @Wire
+ private Listbox projectSelector;
+
+ @Wire
+ private Button btnRefresh;
+
+ @Wire
+ private Button btnFit;
+
+ @Wire
+ private Checkbox chkCriticalPath;
+
+ private Long currentOrderId;
+
+ @Override
+ public void doAfterCompose(Window comp) throws Exception {
+ super.doAfterCompose(comp);
+ pertChartModel = (IPertChartModel) SpringUtil.getBean("pertChartModel");
+ loadProjects();
+ }
+
+ private void loadProjects() {
+ List orders = pertChartModel.getOrders();
+ projectSelector.getItems().clear();
+
+ for (Order order : orders) {
+ Listitem item = new Listitem(order.getName());
+ item.setValue(order.getId());
+ projectSelector.appendChild(item);
+ }
+
+ if (!orders.isEmpty()) {
+ projectSelector.setSelectedIndex(0);
+ }
+ }
+
+ @Listen("onSelect = #projectSelector")
+ public void onProjectSelect(Event event) {
+ Listitem selected = projectSelector.getSelectedItem();
+ if (selected != null) {
+ currentOrderId = selected.getValue();
+ loadPertChart();
+ }
+ }
+
+ @Listen("onClick = #btnRefresh")
+ public void onRefresh(Event event) {
+ loadPertChart();
+ }
+
+ @Listen("onClick = #btnFit")
+ public void onFit(Event event) {
+ Clients.evalJavaScript("fitPertChart()");
+ }
+
+ @Listen("onCheck = #chkCriticalPath")
+ public void onCriticalPathToggle(Event event) {
+ boolean show = chkCriticalPath.isChecked();
+ Clients.evalJavaScript("toggleCriticalPath(" + show + ")");
+ }
+
+ private void loadPertChart() {
+ if (currentOrderId == null) {
+ return;
+ }
+
+ Order order = pertChartModel.getOrderWithTasks(currentOrderId);
+ if (order == null) {
+ return;
+ }
+
+ TaskGroup rootTask = order.getAssociatedTaskElement();
+ if (rootTask == null) {
+ return;
+ }
+
+ JSONObject chartData = buildChartData(rootTask);
+ String json = chartData.toJSONString();
+
+ Clients.evalJavaScript("initPertChart(" + json + ")");
+ }
+
+ private JSONObject buildChartData(TaskGroup rootTask) {
+ JSONArray nodes = new JSONArray();
+ JSONArray edges = new JSONArray();
+ Set processedTasks = new HashSet<>();
+
+ // Recursively collect tasks
+ collectTasks(rootTask, nodes, edges, processedTasks);
+
+ JSONObject result = new JSONObject();
+ result.put("nodes", nodes);
+ result.put("edges", edges);
+ return result;
+ }
+
+ private void collectTasks(TaskElement element, JSONArray nodes, JSONArray edges, Set processed) {
+ if (element == null || processed.contains(element.getId())) {
+ return;
+ }
+ processed.add(element.getId());
+
+ // Add node
+ JSONObject node = new JSONObject();
+ node.put("id", element.getId());
+ node.put("name", element.getName());
+ node.put("startDate", formatDate(element));
+ node.put("endDate", formatEndDate(element));
+ node.put("progress", element.getAdvancePercentage() != null ?
+ element.getAdvancePercentage().doubleValue() : 0.0);
+ node.put("status", getTaskStatus(element));
+ node.put("milestone", element instanceof org.libreplan.business.planner.entities.TaskMilestone);
+ node.put("critical", false); // TODO: implement critical path detection
+
+ nodes.add(node);
+
+ // Add dependencies (edges)
+ for (Dependency dep : element.getDependenciesWithThisOrigin()) {
+ JSONObject edge = new JSONObject();
+ edge.put("from", element.getId());
+ edge.put("to", dep.getDestination().getId());
+ edge.put("type", mapDependencyType(dep.getType()));
+ edge.put("critical", false); // TODO: implement critical path detection
+ edges.add(edge);
+ }
+
+ // Recurse into children if TaskGroup
+ if (element instanceof TaskGroup) {
+ TaskGroup group = (TaskGroup) element;
+ for (TaskElement child : group.getChildren()) {
+ collectTasks(child, nodes, edges, processed);
+ }
+ }
+ }
+
+ private String formatDate(TaskElement element) {
+ if (element.getStartDate() != null) {
+ return new java.text.SimpleDateFormat("yyyy-MM-dd").format(element.getStartDate());
+ }
+ return "N/A";
+ }
+
+ private String formatEndDate(TaskElement element) {
+ if (element.getEndDate() != null) {
+ return new java.text.SimpleDateFormat("yyyy-MM-dd").format(element.getEndDate());
+ }
+ return "N/A";
+ }
+
+ private String getTaskStatus(TaskElement element) {
+ if (element instanceof Task) {
+ Task task = (Task) element;
+ if (task.isFinished()) return "FINISHED";
+ if (task.isInProgress()) return "IN_PROGRESS";
+ // Check if blocked by examining dependencies
+ for (Dependency dep : element.getDependenciesWithThisDestination()) {
+ TaskElement origin = dep.getOrigin();
+ if (!origin.isFinished()) {
+ return "BLOCKED";
+ }
+ }
+ return "READY";
+ }
+ return "UNKNOWN";
+ }
+
+ private String mapDependencyType(Dependency.Type type) {
+ switch (type) {
+ case END_START: return "FS";
+ case START_START: return "SS";
+ case END_END: return "FF";
+ case START_END: return "SF";
+ default: return "FS";
+ }
+ }
+}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/pert/PertChartModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/pert/PertChartModel.java
new file mode 100644
index 000000000..be82ff207
--- /dev/null
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/pert/PertChartModel.java
@@ -0,0 +1,77 @@
+/*
+ * This file is part of TASKPM
+ *
+ * Copyright (C) 2026 TASKPM Contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ */
+
+package org.libreplan.web.planner.pert;
+
+import org.libreplan.business.orders.daos.IOrderDAO;
+import org.libreplan.business.orders.entities.Order;
+import org.libreplan.business.planner.entities.Dependency;
+import org.libreplan.business.planner.entities.TaskElement;
+import org.libreplan.business.planner.entities.TaskGroup;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+@Service
+@Scope(BeanDefinition.SCOPE_SINGLETON)
+public class PertChartModel implements IPertChartModel {
+
+ @Autowired
+ private IOrderDAO orderDAO;
+
+ @Override
+ @Transactional(readOnly = true)
+ public List getOrders() {
+ return orderDAO.getOrders();
+ }
+
+ @Override
+ @Transactional(readOnly = true)
+ public Order getOrderWithTasks(Long orderId) {
+ try {
+ Order order = orderDAO.find(orderId);
+ // Force load the task tree
+ TaskGroup rootTask = order.getAssociatedTaskElement();
+ if (rootTask != null) {
+ forceLoadTasks(rootTask);
+ }
+ return order;
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ private void forceLoadTasks(TaskElement element) {
+ // Force load basic properties
+ element.getName();
+ element.getStartDate();
+ element.getEndDate();
+ element.getAdvancePercentage();
+
+ // Force load dependencies
+ for (Dependency dep : element.getDependenciesWithThisOrigin()) {
+ dep.getDestination().getId();
+ dep.getType();
+ }
+
+ // Recurse into children
+ if (element instanceof TaskGroup) {
+ TaskGroup group = (TaskGroup) element;
+ for (TaskElement child : group.getChildren()) {
+ forceLoadTasks(child);
+ }
+ }
+ }
+}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/reassign/ReassignCommand.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/reassign/ReassignCommand.java
index 8e93cc19e..73f0b2060 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/reassign/ReassignCommand.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/reassign/ReassignCommand.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.web.planner.reassign;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import static org.zkoss.ganttz.util.LongOperationFeedback.and;
import java.util.ArrayList;
@@ -126,11 +126,11 @@ public class ReassignCommand implements IReassignCommand {
doNotifications(notifications),
reloadCharts(context),
busyEnd(),
- tellUserOnEnd(context, () -> _("{0} reassignations finished", reassignations.size()))));
+ tellUserOnEnd(context, () -> tr("{0} reassignations finished", reassignations.size()))));
} else {
updater.doUpdate(and(
busyEnd(),
- tellUserOnEnd(context, () -> _("Assignments could not be completed"))));
+ tellUserOnEnd(context, () -> tr("Assignments could not be completed"))));
}
}
};
@@ -160,11 +160,11 @@ public class ReassignCommand implements IReassignCommand {
}
private IDesktopUpdate busyStart(final int total) {
- return () -> Clients.showBusy(_("Doing {0} reassignations", total));
+ return () -> Clients.showBusy(tr("Doing {0} reassignations", total));
}
private IDesktopUpdate showCompleted(final int number, final int total) {
- return () -> Clients.showBusy(_("Done {0} of {1}", number, total));
+ return () -> Clients.showBusy(tr("Done {0} of {1}", number, total));
}
private IDesktopUpdate reloadCharts(final IContext> context) {
@@ -206,7 +206,7 @@ public class ReassignCommand implements IReassignCommand {
try {
Messagebox.show(
resolve(message),
- _("Reassignation"),
+ tr("Reassignation"),
Messagebox.OK, Messagebox.INFORMATION);
} catch (Exception e) {
throw new RuntimeException(e);
@@ -310,7 +310,7 @@ public class ReassignCommand implements IReassignCommand {
@Override
public String getName() {
- return _("Reassign");
+ return tr("Reassign");
}
@Override
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/reassign/ReassignController.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/reassign/ReassignController.java
index 9ac2c928c..06efdd795 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/reassign/ReassignController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/reassign/ReassignController.java
@@ -41,7 +41,7 @@ import org.zkoss.zul.Window;
import java.util.Collections;
import java.util.Date;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* When you are pushing reassign button ( green button on Project Scheduling page ), it will open Reassign window.
* This controller handles that window.
@@ -125,7 +125,7 @@ public class ReassignController extends GenericForwardComposer {
if (currentType.needsAssociatedDate()) {
Date value = associatedDate.getValue();
if (value == null) {
- throw new WrongValueException(associatedDate, _("cannot be empty"));
+ throw new WrongValueException(associatedDate, tr("cannot be empty"));
}
}
window.setVisible(false);
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/reassign/Type.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/reassign/Type.java
index c0f6117db..3d839cf10 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/reassign/Type.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/reassign/Type.java
@@ -22,13 +22,13 @@ package org.libreplan.web.planner.reassign;
import org.zkoss.zul.Radio;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
public enum Type {
ALL {
@Override
public String getName() {
- return _("All project tasks");
+ return tr("All project tasks");
}
@Override
@@ -40,7 +40,7 @@ public enum Type {
FROM_TODAY {
@Override
public String getName() {
- return _("From today");
+ return tr("From today");
}
@Override
@@ -52,7 +52,7 @@ public enum Type {
FROM_CHOSEN {
@Override
public String getName() {
- return _("From chosen date");
+ return tr("From chosen date");
}
@Override
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/AdvancedAllocationTabCreator.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/AdvancedAllocationTabCreator.java
index e3a518b1f..3b508a863 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/AdvancedAllocationTabCreator.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/AdvancedAllocationTabCreator.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.web.planner.tabs;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import static org.libreplan.web.planner.tabs.MultipleTabsPlannerController.BREADCRUMBS_SEPARATOR;
import static org.libreplan.web.planner.tabs.MultipleTabsPlannerController.getSchedulingLabel;
@@ -150,7 +150,7 @@ public class AdvancedAllocationTabCreator {
}
}
- private final String ADVANCED_ALLOCATION_VIEW = _("Advanced Allocation");
+ private final String ADVANCED_ALLOCATION_VIEW = tr("Advanced Allocation");
private final Mode mode;
@@ -235,7 +235,7 @@ public class AdvancedAllocationTabCreator {
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
breadcrumbs.appendChild(new Label(getSchedulingLabel()));
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
- breadcrumbs.appendChild(new Label(_("Advanced Allocation")));
+ breadcrumbs.appendChild(new Label(tr("Advanced Allocation")));
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
breadcrumbs.appendChild(new Label(mode.getOrder().getName()));
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/DashboardTabCreator.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/DashboardTabCreator.java
index 21ecc1c92..2bb5b7047 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/DashboardTabCreator.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/DashboardTabCreator.java
@@ -18,7 +18,7 @@
*/
package org.libreplan.web.planner.tabs;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import static org.libreplan.web.planner.tabs.MultipleTabsPlannerController.BREADCRUMBS_SEPARATOR;
import static org.libreplan.web.planner.tabs.MultipleTabsPlannerController.getSchedulingLabel;
@@ -110,7 +110,7 @@ public class DashboardTabCreator {
}
};
- return new CreatedOnDemandTab(_("Dashboard"), "order-dashboard",
+ return new CreatedOnDemandTab(tr("Dashboard"), "order-dashboard",
componentCreator) {
@Override
@@ -128,7 +128,7 @@ public class DashboardTabCreator {
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
breadcrumbs.appendChild(new Label(getSchedulingLabel()));
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
- breadcrumbs.appendChild(new Label(_("Dashboard")));
+ breadcrumbs.appendChild(new Label(tr("Dashboard")));
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
breadcrumbs.appendChild(new Label(currentOrder.getName()));
}
@@ -148,7 +148,7 @@ public class DashboardTabCreator {
}
};
- return new CreatedOnDemandTab(_("Dashboard"), "global-dashboard",
+ return new CreatedOnDemandTab(tr("Dashboard"), "global-dashboard",
componentCreator) {
@Override
@@ -157,7 +157,7 @@ public class DashboardTabCreator {
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
breadcrumbs.appendChild(new Label(getSchedulingLabel()));
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
- breadcrumbs.appendChild(new Label(_("Dashboard")));
+ breadcrumbs.appendChild(new Label(tr("Dashboard")));
}
};
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/LimitingResourcesTabCreator.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/LimitingResourcesTabCreator.java
index 49aaaca60..786b708f9 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/LimitingResourcesTabCreator.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/LimitingResourcesTabCreator.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.web.planner.tabs;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import static org.libreplan.web.planner.tabs.MultipleTabsPlannerController.BREADCRUMBS_SEPARATOR;
import static org.libreplan.web.planner.tabs.MultipleTabsPlannerController.getSchedulingLabel;
@@ -81,7 +81,7 @@ public class LimitingResourcesTabCreator {
return Executions.createComponents("/limitingresources/_limitingresources.zul", parent, arguments);
};
- return new CreatedOnDemandTab(_("Queue-based Resources Planning"), "limiting-resources", componentCreator) {
+ return new CreatedOnDemandTab(tr("Queue-based Resources Planning"), "limiting-resources", componentCreator) {
@Override
protected void beforeShowAction() {
if (!SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_PLANNING)) {
@@ -100,7 +100,7 @@ public class LimitingResourcesTabCreator {
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
breadcrumbs.appendChild(new Label(getSchedulingLabel()));
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
- breadcrumbs.appendChild(new Label(_("Queue-based Resources Planning")));
+ breadcrumbs.appendChild(new Label(tr("Queue-based Resources Planning")));
}
};
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/LogsTabCreator.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/LogsTabCreator.java
index 67fea9d1d..e22f90b6a 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/LogsTabCreator.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/LogsTabCreator.java
@@ -18,7 +18,7 @@
*/
package org.libreplan.web.planner.tabs;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import static org.libreplan.web.planner.tabs.MultipleTabsPlannerController.BREADCRUMBS_SEPARATOR;
import static org.libreplan.web.planner.tabs.MultipleTabsPlannerController.getSchedulingLabel;
@@ -86,7 +86,7 @@ public class LogsTabCreator {
}
};
- return new CreatedOnDemandTab(_("Logs"), "logs-global", componentCreator) {
+ return new CreatedOnDemandTab(tr("Logs"), "logs-global", componentCreator) {
@Override
protected void beforeShowAction() {
if (!SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_PLANNING)) {
@@ -103,7 +103,7 @@ public class LogsTabCreator {
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
breadcrumbs.appendChild(new Label(getSchedulingLabel()));
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
- breadcrumbs.appendChild(new Label(_("Logs")));
+ breadcrumbs.appendChild(new Label(tr("Logs")));
}
};
}
@@ -118,7 +118,7 @@ public class LogsTabCreator {
}
};
- return new CreatedOnDemandTab(_("Logs"), "logs-order", componentCreator) {
+ return new CreatedOnDemandTab(tr("Logs"), "logs-order", componentCreator) {
@Override
protected void beforeShowAction() {
if (!SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_PLANNING)) {
@@ -135,7 +135,7 @@ public class LogsTabCreator {
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
breadcrumbs.appendChild(new Label(getSchedulingLabel()));
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
- breadcrumbs.appendChild(new Label(_("Logs")));
+ breadcrumbs.appendChild(new Label(tr("Logs")));
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
breadcrumbs.appendChild(new Label(mode.getOrder().getName()));
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/MonteCarloTabCreator.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/MonteCarloTabCreator.java
index 8727279c0..75afb5958 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/MonteCarloTabCreator.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/MonteCarloTabCreator.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.web.planner.tabs;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import static org.libreplan.web.planner.tabs.MultipleTabsPlannerController.BREADCRUMBS_SEPARATOR;
import static org.libreplan.web.planner.tabs.MultipleTabsPlannerController.getSchedulingLabel;
@@ -48,7 +48,7 @@ import org.zkoss.zul.Label;
*/
public class MonteCarloTabCreator {
- private String ORDER_LIMITING_RESOURCES_VIEW = _("MonteCarlo Method");
+ private String ORDER_LIMITING_RESOURCES_VIEW = tr("MonteCarlo Method");
public static ITab create(Mode mode,
PlanningStateCreator planningStateCreator,
@@ -156,7 +156,7 @@ public class MonteCarloTabCreator {
}
};
- return new CreatedOnDemandTab(_("MonteCarlo Method"),
+ return new CreatedOnDemandTab(tr("MonteCarlo Method"),
"montecarlo-simulation", componentCreator) {
@Override
protected void afterShowAction() {
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/MultipleTabsPlannerController.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/MultipleTabsPlannerController.java
index 9ad8b71ed..cf3ebd318 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/MultipleTabsPlannerController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/MultipleTabsPlannerController.java
@@ -74,7 +74,7 @@ import org.zkoss.zkplus.spring.SpringUtil;
import java.util.Map;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import static org.zkoss.ganttz.adapters.TabsConfiguration.configure;
/**
@@ -210,7 +210,7 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
LongOperationFeedback.execute(tabsSwitcher, new ILongOperation() {
@Override
public String getName() {
- return _("changing perspective");
+ return tr("changing perspective");
}
@Override
@@ -234,7 +234,7 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
}
public static String getSchedulingLabel() {
- return _("Planning");
+ return tr("Planning");
}
public MultipleTabsPlannerController() {
@@ -259,7 +259,7 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
if ( SecurityUtils.loggedUserCanWrite(mode.getOrder()) ) {
ConfirmCloseUtil.setConfirmClose(
desktop,
- _("You are about to leave the planning editing. Unsaved changes will be lost!"));
+ tr("You are about to leave the planning editing. Unsaved changes will be lost!"));
}
break;
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/OrdersTabCreator.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/OrdersTabCreator.java
index 898655355..2d88d5537 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/OrdersTabCreator.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/OrdersTabCreator.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.web.planner.tabs;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import static org.libreplan.web.planner.tabs.MultipleTabsPlannerController.BREADCRUMBS_SEPARATOR;
import static org.libreplan.web.planner.tabs.MultipleTabsPlannerController.getSchedulingLabel;
@@ -47,7 +47,7 @@ import org.zkoss.zul.Label;
*/
public class OrdersTabCreator {
- private final String PROJECT_DETAILS = _("Project Details");
+ private final String PROJECT_DETAILS = tr("Project Details");
public static ITab create(Mode mode,
OrderCRUDController orderCRUDController, Component breadcrumbs,
@@ -102,7 +102,7 @@ public class OrdersTabCreator {
}
private ITab createGlobalOrdersTab() {
- return new CreatedOnDemandTab(_("Projects List"), "orders",
+ return new CreatedOnDemandTab(tr("Projects List"), "orders",
ordersTabCreator) {
@Override
protected void beforeShowAction() {
@@ -134,7 +134,7 @@ public class OrdersTabCreator {
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
breadcrumbs.appendChild(new Label(getSchedulingLabel()));
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
- breadcrumbs.appendChild(new Label(_("Projects List")));
+ breadcrumbs.appendChild(new Label(tr("Projects List")));
}
};
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/PlanningTabCreator.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/PlanningTabCreator.java
index ba02790d8..262c1dff8 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/PlanningTabCreator.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/PlanningTabCreator.java
@@ -44,7 +44,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import static org.libreplan.web.planner.tabs.MultipleTabsPlannerController.BREADCRUMBS_SEPARATOR;
import static org.libreplan.web.planner.tabs.MultipleTabsPlannerController.getSchedulingLabel;
@@ -148,7 +148,7 @@ public class PlanningTabCreator {
@Override
public String getName() {
- return _("Schedule");
+ return tr("Schedule");
}
@Override
@@ -178,7 +178,7 @@ public class PlanningTabCreator {
@Override
public String getName() {
- return _("Project Details");
+ return tr("Project Details");
}
@Override
@@ -194,7 +194,7 @@ public class PlanningTabCreator {
}
};
- return new CreatedOnDemandTab(_("Projects Planning"), "company-scheduling", componentCreator) {
+ return new CreatedOnDemandTab(tr("Projects Planning"), "company-scheduling", componentCreator) {
@Override
protected void beforeShowAction() {
if (!SecurityUtils.isSuperuserOrRolePlanningOrHasAnyAuthorization()) {
@@ -222,7 +222,7 @@ public class PlanningTabCreator {
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
breadcrumbs.appendChild(new Label(getSchedulingLabel()));
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
- breadcrumbs.appendChild(new Label(_("Projects Planning")));
+ breadcrumbs.appendChild(new Label(tr("Projects Planning")));
}
};
}
@@ -237,7 +237,7 @@ public class PlanningTabCreator {
Util.createBindingsFor(result);
return result;
};
- return new CreatedOnDemandTab(_("Project Scheduling"), "order-scheduling", componentCreator) {
+ return new CreatedOnDemandTab(tr("Project Scheduling"), "order-scheduling", componentCreator) {
@Override
protected void afterShowAction() {
@@ -254,7 +254,7 @@ public class PlanningTabCreator {
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
breadcrumbs.appendChild(new Label(getSchedulingLabel()));
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
- breadcrumbs.appendChild(new Label(_("Project Scheduling")));
+ breadcrumbs.appendChild(new Label(tr("Project Scheduling")));
if (mode.isOf(ModeType.ORDER)) {
orderPlanningController.getOrderCRUDController().checkUserCanRead(order);
@@ -262,10 +262,10 @@ public class PlanningTabCreator {
nameLabel.setTooltiptext(order.getName() + "." + order.getDescription());
nameLabel.setMaxlength(MAX_ORDERNAME_LENGTH);
- Label schedulingStateLabel = new Label(_(order.getState().toString()));
+ Label schedulingStateLabel = new Label(tr(order.getState().toString()));
schedulingStateLabel.setSclass("scheduling-state " + order.getSchedulingState().getCssClass());
- schedulingStateLabel.setTooltiptext(_(order.getSchedulingState().getStateName()));
+ schedulingStateLabel.setTooltiptext(tr(order.getSchedulingState().getStateName()));
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
breadcrumbs.appendChild(nameLabel);
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/ResourcesLoadTabCreator.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/ResourcesLoadTabCreator.java
index 550c0a7e6..4d82caec8 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/ResourcesLoadTabCreator.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/ResourcesLoadTabCreator.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.web.planner.tabs;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import static org.libreplan.web.planner.tabs.MultipleTabsPlannerController.BREADCRUMBS_SEPARATOR;
import static org.libreplan.web.planner.tabs.MultipleTabsPlannerController.getSchedulingLabel;
@@ -99,7 +99,7 @@ public class ResourcesLoadTabCreator {
return Executions.createComponents("/resourceload/_resourceloadfororder.zul", parent, arguments);
};
- return new CreatedOnDemandTab(_(RESOURCES_LOAD), "order-load", componentCreator) {
+ return new CreatedOnDemandTab(tr(RESOURCES_LOAD), "order-load", componentCreator) {
@Override
protected void afterShowAction() {
@@ -107,7 +107,7 @@ public class ResourcesLoadTabCreator {
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
breadcrumbs.appendChild(new Label(getSchedulingLabel()));
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
- breadcrumbs.appendChild(new Label(_(RESOURCES_LOAD)));
+ breadcrumbs.appendChild(new Label(tr(RESOURCES_LOAD)));
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
Order currentOrder = mode.getOrder();
@@ -129,7 +129,7 @@ public class ResourcesLoadTabCreator {
return Executions.createComponents("/resourceload/_resourceload.zul", parent, arguments);
};
- return new CreatedOnDemandTab(_(RESOURCES_LOAD), "company-load", componentCreator) {
+ return new CreatedOnDemandTab(tr(RESOURCES_LOAD), "company-load", componentCreator) {
@Override
protected void beforeShowAction() {
if (!SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_PLANNING)) {
@@ -150,7 +150,7 @@ public class ResourcesLoadTabCreator {
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
breadcrumbs.appendChild(new Label(getSchedulingLabel()));
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
- breadcrumbs.appendChild(new Label(_(RESOURCES_LOAD)));
+ breadcrumbs.appendChild(new Label(tr(RESOURCES_LOAD)));
}
};
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/taskedition/AdvancedAllocationTaskController.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/taskedition/AdvancedAllocationTaskController.java
index fa5fb5619..705fa1b29 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/taskedition/AdvancedAllocationTaskController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/taskedition/AdvancedAllocationTaskController.java
@@ -39,7 +39,7 @@ import org.zkoss.ganttz.extensions.IContextWithPlannerTask;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Messagebox;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Controller for advanced allocation of a {@link Task}.
@@ -69,7 +69,7 @@ public class AdvancedAllocationTaskController extends GenericForwardComposer {
planningState.getCurrentScenario(), task);
if (allocationResult.getAggregate().isEmpty()) {
- Messagebox.show(_("Some allocations needed"), _("Warning"),
+ Messagebox.show(tr("Some allocations needed"), tr("Warning"),
Messagebox.OK, Messagebox.EXCLAMATION);
return;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/taskedition/EditTaskController.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/taskedition/EditTaskController.java
index 13a7f6b4e..95b690eaa 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/taskedition/EditTaskController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/taskedition/EditTaskController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.planner.taskedition;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import org.libreplan.business.common.exceptions.ValidationException;
import org.libreplan.business.planner.entities.Task;
@@ -161,7 +161,7 @@ public class EditTaskController extends GenericForwardComposer {
taskPropertiesController.init(this, context, taskElement);
- window.setTitle(_("Edit task: {0}", taskElement.getName()));
+ window.setTitle(tr("Edit task: {0}", taskElement.getName()));
showSelectedTabPanel();
Util.createBindingsFor(window);
Util.reloadBindings(window);
@@ -368,10 +368,10 @@ public class EditTaskController extends GenericForwardComposer {
}
void showNonPermitChangeResourceAllocationType() {
- String message = _("The task has got progress consolidations. " +
+ String message = tr("The task has got progress consolidations. " +
"To change resource allocation type all consolidations must be removed before");
- Messagebox.show(message, _("Information"), Messagebox.OK, Messagebox.INFORMATION);
+ Messagebox.show(message, tr("Information"), Messagebox.OK, Messagebox.INFORMATION);
}
public void close(Event event) {
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/taskedition/TaskPropertiesCommand.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/taskedition/TaskPropertiesCommand.java
index 1f34d7a69..40728159e 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/taskedition/TaskPropertiesCommand.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/taskedition/TaskPropertiesCommand.java
@@ -21,7 +21,7 @@
package org.libreplan.web.planner.taskedition;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import org.libreplan.business.planner.entities.TaskElement;
import org.libreplan.web.planner.order.IEditTaskUtilities;
@@ -57,7 +57,7 @@ public class TaskPropertiesCommand implements ITaskPropertiesCommand {
@Override
public String getName() {
- return _("Task Properties");
+ return tr("Task Properties");
}
@Override
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/taskedition/TaskPropertiesController.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/taskedition/TaskPropertiesController.java
index e67edf56e..7a5db6bc8 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/taskedition/TaskPropertiesController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/taskedition/TaskPropertiesController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.planner.taskedition;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.Arrays;
@@ -206,7 +206,7 @@ public class TaskPropertiesController extends GenericForwardComposer
boolean thirdCondition = type == PositionConstraintType.AS_SOON_AS_POSSIBLE && order.getInitDate() != null;
if (firstCondition || secondCondition || thirdCondition) {
- Comboitem comboitem = new Comboitem(_(type.getName()));
+ Comboitem comboitem = new Comboitem(tr(type.getName()));
comboitem.setValue(type);
startConstraintTypes.appendChild(comboitem);
}
@@ -384,9 +384,9 @@ public class TaskPropertiesController extends GenericForwardComposer
} else {
if( newState.equals(ResourceAllocationTypeEnum.SUBCONTRACT ) && !checkCompatibleAllocation()){
restoreOldState();
- Messagebox.show(_("This resource allocation type is incompatible. The task has " +
+ Messagebox.show(tr("This resource allocation type is incompatible. The task has " +
"an associated order element which has a progress that is of type subcontractor. "),
- _("Error"), Messagebox.OK , Messagebox.ERROR);
+ tr("Error"), Messagebox.OK , Messagebox.ERROR);
} else {
changeResourceAllocationType(oldState,newState);
editTaskController.selectAssignmentTab(lbResourceAllocationType.getSelectedIndex() + 1);
@@ -478,9 +478,9 @@ public class TaskPropertiesController extends GenericForwardComposer
* @author Diego Pino Garcia
*/
enum ResourceAllocationTypeEnum {
- NON_LIMITING_RESOURCES(_("Normal resource assignment")),
- LIMITING_RESOURCES(_("Queue-based resource assignation")),
- SUBCONTRACT(_("Subcontract"));
+ NON_LIMITING_RESOURCES(tr("Normal resource assignment")),
+ LIMITING_RESOURCES(tr("Queue-based resource assignation")),
+ SUBCONTRACT(tr("Subcontract"));
private String option;
@@ -499,13 +499,13 @@ public class TaskPropertiesController extends GenericForwardComposer
/**
* Forces to mark the string as needing translation.
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
@Override
public String toString() {
- return I18nHelper._(option);
+ return I18nHelper.tr(option);
}
public static List getOptionList() {
@@ -613,8 +613,8 @@ public class TaskPropertiesController extends GenericForwardComposer
Task task = asTask(currentTaskElement);
if ( task.hasResourceAllocations() ) {
if ( Messagebox.show(
- _("Assigned resources for this task will be deleted. Are you sure?"),
- _(WARNING), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION) == Messagebox.OK) {
+ tr("Assigned resources for this task will be deleted. Are you sure?"),
+ tr(WARNING), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION) == Messagebox.OK) {
task.removeAllResourceAllocations();
setStateTo(newState);
} else {
@@ -649,8 +649,8 @@ public class TaskPropertiesController extends GenericForwardComposer
Task task = asTask(currentTaskElement);
if (task.hasResourceAllocations()) {
if (Messagebox.show(
- _("Assigned resources for this task will be deleted. Are you sure?"),
- _(WARNING), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION) == Messagebox.OK ) {
+ tr("Assigned resources for this task will be deleted. Are you sure?"),
+ tr(WARNING), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION) == Messagebox.OK ) {
task.removeAllResourceAllocations();
setStateTo(newState);
} else {
@@ -679,8 +679,8 @@ public class TaskPropertiesController extends GenericForwardComposer
if ( communicationDate != null ) {
if ( Messagebox.show(
- _("IMPORTANT: Don't forget to communicate to subcontractor that his contract has been cancelled"),
- _(WARNING), Messagebox.OK, Messagebox.EXCLAMATION) == Messagebox.OK ) {
+ tr("IMPORTANT: Don't forget to communicate to subcontractor that his contract has been cancelled"),
+ tr(WARNING), Messagebox.OK, Messagebox.EXCLAMATION) == Messagebox.OK ) {
setStateTo(newState);
} else {
@@ -805,7 +805,7 @@ public class TaskPropertiesController extends GenericForwardComposer
emailNotificationModel.confirmSave();
} catch (DataIntegrityViolationException e) {
Messagebox.show(
- _("You cannot email user twice with the same info"), _("Error"),
+ tr("You cannot email user twice with the same info"), tr("Error"),
Messagebox.OK, Messagebox.ERROR);
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/qualityforms/QualityFormCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/qualityforms/QualityFormCRUDController.java
index 6ef70239d..ad39a2200 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/qualityforms/QualityFormCRUDController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/qualityforms/QualityFormCRUDController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.qualityforms;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.math.BigDecimal;
import java.util.List;
@@ -152,7 +152,7 @@ public class QualityFormCRUDController extends BaseCRUDController {
if (qualityFormModel.isTotalPercentage(item)) {
if (Messagebox.show(
- _("Deleting this item will disable the report progress option. Are you sure?"), _("Confirm"),
+ tr("Deleting this item will disable the report progress option. Are you sure?"), tr("Confirm"),
Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION) == Messagebox.OK) {
Checkbox reportProgress = (Checkbox) editWindow.getFellowIfAny("checkBoxReportProgress");
@@ -184,10 +184,10 @@ public class QualityFormCRUDController extends BaseCRUDController {
return (comp, value) -> {
getQualityForm().setName((String) value);
if ((value == null) || ((String)value).isEmpty()) {
- throw new WrongValueException(comp, _(CANNOT_BE_EMPTY));
+ throw new WrongValueException(comp, tr(CANNOT_BE_EMPTY));
} else if (!qualityFormModel.checkConstraintUniqueQualityFormName()) {
getQualityForm().setName(null);
- throw new WrongValueException(comp, _("{0} already exists", value));
+ throw new WrongValueException(comp, tr("{0} already exists", value));
}
};
}
@@ -198,10 +198,10 @@ public class QualityFormCRUDController extends BaseCRUDController {
item.setName((String)value);
if ((value == null) || ((String) value).isEmpty()) {
item.setName(null);
- throw new WrongValueException(comp, _(CANNOT_BE_EMPTY));
+ throw new WrongValueException(comp, tr(CANNOT_BE_EMPTY));
} else if (!qualityFormModel.checkConstraintUniqueQualityFormItemName()) {
item.setName(null);
- throw new WrongValueException(comp, _("{0} already exists", value));
+ throw new WrongValueException(comp, tr("{0} already exists", value));
}
};
}
@@ -215,15 +215,15 @@ public class QualityFormCRUDController extends BaseCRUDController {
if (newPercentage == null) {
item.setPercentage(null);
- throw new WrongValueException(comp, _(CANNOT_BE_EMPTY));
+ throw new WrongValueException(comp, tr(CANNOT_BE_EMPTY));
}
if (qualityFormModel.checkConstraintOutOfRangeQualityFormItemPercentage(item)) {
item.setPercentage(null);
- throw new WrongValueException(comp, _("percentage should be between 1 and 100"));
+ throw new WrongValueException(comp, tr("percentage should be between 1 and 100"));
}
if (!qualityFormModel.checkConstraintUniqueQualityFormItemPercentage()) {
item.setPercentage(null);
- throw new WrongValueException(comp, _("percentage must be unique"));
+ throw new WrongValueException(comp, tr("percentage must be unique"));
}
};
}
@@ -269,7 +269,7 @@ public class QualityFormCRUDController extends BaseCRUDController {
throw new WrongValueException(
checkBoxReportProgress,
- _("Quality form should include an item with a value of 100% in order to report progress"));
+ tr("Quality form should include an item with a value of 100% in order to report progress"));
}
}
@@ -287,12 +287,12 @@ public class QualityFormCRUDController extends BaseCRUDController {
@Override
protected String getEntityType() {
- return _("Quality Form");
+ return tr("Quality Form");
}
@Override
protected String getPluralEntityType() {
- return _("Quality Forms");
+ return tr("Quality Forms");
}
@Override
@@ -336,6 +336,6 @@ public class QualityFormCRUDController extends BaseCRUDController {
}
private void showCannotDeleteQualityFormDialog(String message) {
- Messagebox.show(_(message), _("Warning"), Messagebox.OK, Messagebox.EXCLAMATION);
+ Messagebox.show(tr(message), tr("Warning"), Messagebox.OK, Messagebox.EXCLAMATION);
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/reports/CompletedEstimatedHoursPerTaskController.java b/libreplan-webapp/src/main/java/org/libreplan/web/reports/CompletedEstimatedHoursPerTaskController.java
index 2154bee04..8addc606b 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/reports/CompletedEstimatedHoursPerTaskController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/reports/CompletedEstimatedHoursPerTaskController.java
@@ -38,7 +38,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* @author Diego Pino Garcia
@@ -119,7 +119,7 @@ public class CompletedEstimatedHoursPerTaskController extends LibrePlanReportCon
public void showReport(JasperreportComponent jasperreport) {
final Order order = getSelectedOrder();
if (order == null) {
- throw new WrongValueException(bandboxSelectOrder, _("Please, select a project"));
+ throw new WrongValueException(bandboxSelectOrder, tr("Please, select a project"));
}
super.showReport(jasperreport);
}
@@ -131,12 +131,12 @@ public class CompletedEstimatedHoursPerTaskController extends LibrePlanReportCon
public void onSelectLabel() {
Label label = (Label) bdLabels.getSelectedElement();
if (label == null) {
- throw new WrongValueException(bdLabels, _("please, select a label"));
+ throw new WrongValueException(bdLabels, tr("please, select a label"));
}
boolean result = completedEstimatedHoursPerTaskModel.addSelectedLabel(label);
if (!result) {
- throw new WrongValueException(bdLabels, _("Label has already been added."));
+ throw new WrongValueException(bdLabels, tr("Label has already been added."));
} else {
Util.reloadBindings(lbLabels);
}
@@ -163,13 +163,13 @@ public class CompletedEstimatedHoursPerTaskController extends LibrePlanReportCon
public void onSelectCriterion() {
Criterion criterion = (Criterion) bdCriterions.getSelectedElement();
if (criterion == null) {
- throw new WrongValueException(bdCriterions, _("please, select a Criterion"));
+ throw new WrongValueException(bdCriterions, tr("please, select a Criterion"));
}
boolean result = completedEstimatedHoursPerTaskModel.addSelectedCriterion(criterion);
if (!result) {
- throw new WrongValueException(bdCriterions, _("This Criterion has already been added."));
+ throw new WrongValueException(bdCriterions, tr("This Criterion has already been added."));
} else {
Util.reloadBindings(lbCriterions);
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/reports/HoursWorkedPerWorkerController.java b/libreplan-webapp/src/main/java/org/libreplan/web/reports/HoursWorkedPerWorkerController.java
index 0c4f2badb..e9680aa85 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/reports/HoursWorkedPerWorkerController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/reports/HoursWorkedPerWorkerController.java
@@ -52,7 +52,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Controller for page Hours Worked Per Resource.
@@ -191,7 +191,7 @@ public class HoursWorkedPerWorkerController extends LibrePlanReportController {
boolean result = hoursWorkedPerWorkerModel.addSelectedResource(resource);
if ( !result ) {
- throw new WrongValueException(filterResource, _("This resource has already been added."));
+ throw new WrongValueException(filterResource, tr("This resource has already been added."));
} else {
Util.reloadBindings(lbResources);
}
@@ -277,7 +277,7 @@ public class HoursWorkedPerWorkerController extends LibrePlanReportController {
Button delete = new Button("", "/common/img/ico_borrar1.png");
delete.setHoverImage("/common/img/ico_borrar.png");
delete.setSclass("icono");
- delete.setTooltiptext(_("Delete"));
+ delete.setTooltiptext(tr("Delete"));
delete.addEventListener(Events.ON_CLICK, event -> onRemoveResource(item.getValue()));
Listcell deleteResourceCell = new Listcell();
@@ -294,9 +294,9 @@ public class HoursWorkedPerWorkerController extends LibrePlanReportController {
private String getType(Resource resource) {
if ( resource instanceof Worker )
if ( ((Worker) resource).isReal() )
- return _("Worker");
+ return tr("Worker");
else
- return _("Virtual worker");
+ return tr("Virtual worker");
return "Machine";
}
@@ -309,13 +309,13 @@ public class HoursWorkedPerWorkerController extends LibrePlanReportController {
Label label = (Label) bdLabels.getSelectedElement();
if ( label == null ) {
- throw new WrongValueException(bdLabels, _("please, select a label"));
+ throw new WrongValueException(bdLabels, tr("please, select a label"));
}
boolean result = hoursWorkedPerWorkerModel.addSelectedLabel(label);
if ( !result ) {
- throw new WrongValueException(bdLabels, _("Label has already been added."));
+ throw new WrongValueException(bdLabels, tr("Label has already been added."));
} else {
Util.reloadBindings(lbLabels);
}
@@ -339,13 +339,13 @@ public class HoursWorkedPerWorkerController extends LibrePlanReportController {
Criterion criterion = (Criterion) bdCriterions.getSelectedElement();
if ( criterion == null )
- throw new WrongValueException(bdCriterions, _("please, select a Criterion"));
+ throw new WrongValueException(bdCriterions, tr("please, select a Criterion"));
boolean result = hoursWorkedPerWorkerModel.addSelectedCriterion(criterion);
if ( !result ) {
- throw new WrongValueException(bdCriterions, _("This Criterion has already been added."));
+ throw new WrongValueException(bdCriterions, tr("This Criterion has already been added."));
} else {
Util.reloadBindings(lbCriterions);
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/reports/OrderCostsPerResourceController.java b/libreplan-webapp/src/main/java/org/libreplan/web/reports/OrderCostsPerResourceController.java
index 8c017fc8d..cbfe88ffc 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/reports/OrderCostsPerResourceController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/reports/OrderCostsPerResourceController.java
@@ -39,7 +39,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* @author Lorenzo Tilve Álvaro
@@ -110,11 +110,11 @@ public class OrderCostsPerResourceController extends LibrePlanReportController {
public void onSelectOrder() {
Order order = (Order) bdOrders.getSelectedElement();
if (order == null) {
- throw new WrongValueException(bdOrders, _("please, select a project"));
+ throw new WrongValueException(bdOrders, tr("please, select a project"));
}
boolean result = orderCostsPerResourceModel.addSelectedOrder(order);
if (!result) {
- throw new WrongValueException(bdOrders, _("This project has already been added."));
+ throw new WrongValueException(bdOrders, tr("This project has already been added."));
} else {
Util.reloadBindings(lbOrders);
}
@@ -143,7 +143,7 @@ public class OrderCostsPerResourceController extends LibrePlanReportController {
(startDateLine.compareTo(getEndingDate()) > 0)) {
((Datebox) comp).setValue(null);
- throw new WrongValueException(comp, _("must be lower than end date"));
+ throw new WrongValueException(comp, tr("must be lower than end date"));
}
}
};
@@ -157,7 +157,7 @@ public class OrderCostsPerResourceController extends LibrePlanReportController {
if ((endingDate != null) && (getStartingDate() != null) &&
(endingDate.compareTo(getStartingDate()) < 0)) {
((Datebox) comp).setValue(null);
- throw new WrongValueException(comp, _("must be after end date"));
+ throw new WrongValueException(comp, tr("must be after end date"));
}
}
};
@@ -170,11 +170,11 @@ public class OrderCostsPerResourceController extends LibrePlanReportController {
public void onSelectLabel() {
Label label = (Label) bdLabels.getSelectedElement();
if (label == null) {
- throw new WrongValueException(bdLabels, _("please, select a label"));
+ throw new WrongValueException(bdLabels, tr("please, select a label"));
}
boolean result = orderCostsPerResourceModel.addSelectedLabel(label);
if (!result) {
- throw new WrongValueException(bdLabels, _("Label has already been added."));
+ throw new WrongValueException(bdLabels, tr("Label has already been added."));
} else {
Util.reloadBindings(lbLabels);
}
@@ -201,11 +201,11 @@ public class OrderCostsPerResourceController extends LibrePlanReportController {
public void onSelectCriterion() {
Criterion criterion = (Criterion) bdCriterions.getSelectedElement();
if (criterion == null) {
- throw new WrongValueException(bdCriterions, _("please, select a Criterion"));
+ throw new WrongValueException(bdCriterions, tr("please, select a Criterion"));
}
boolean result = orderCostsPerResourceModel.addSelectedCriterion(criterion);
if (!result) {
- throw new WrongValueException(bdCriterions, _("This Criterion has already been added."));
+ throw new WrongValueException(bdCriterions, tr("This Criterion has already been added."));
} else {
Util.reloadBindings(lbCriterions);
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/reports/OrderCostsPerResourceModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/reports/OrderCostsPerResourceModel.java
index cbf710791..025a782b0 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/reports/OrderCostsPerResourceModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/reports/OrderCostsPerResourceModel.java
@@ -21,7 +21,7 @@
package org.libreplan.web.reports;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.math.BigDecimal;
import java.util.ArrayList;
@@ -156,7 +156,7 @@ public class OrderCostsPerResourceModel implements IOrderCostsPerResourceModel {
List listWorkReportLineDTO = mapWRL.get(orderElement);
if (listWorkReportLineDTO == null || listWorkReportLineDTO.isEmpty()) {
Order order = Order.create();
- order.setName(_("All projects"));
+ order.setName(tr("All projects"));
listWorkReportLineDTO = createEmptyWorkReportLineList(order);
}
@@ -259,7 +259,7 @@ public class OrderCostsPerResourceModel implements IOrderCostsPerResourceModel {
private OrderCostMasterDTO createEmptyOrderCostMasterDTO() {
// Create empty order
Order order = Order.create();
- order.setName(_("All projects"));
+ order.setName(tr("All projects"));
// Create empty subreport to expense sheets
JRDataSource emptyES = new JRBeanCollectionDataSource(
@@ -305,7 +305,7 @@ public class OrderCostsPerResourceModel implements IOrderCostsPerResourceModel {
private WorkReportLine createEmptyWorkReportLine(Worker worker) {
OrderLine leaf = OrderLine.create();
- leaf.setCode(_("All project tasks"));
+ leaf.setCode(tr("All project tasks"));
TypeOfWorkHours w = TypeOfWorkHours.create();
w.setDefaultPrice(new BigDecimal(0));
@@ -320,7 +320,7 @@ public class OrderCostsPerResourceModel implements IOrderCostsPerResourceModel {
private Worker createFictitiousWorker() {
Worker unassigned = new Worker();
- unassigned.setFirstName(_("Total dedication"));
+ unassigned.setFirstName(tr("Total dedication"));
unassigned.setSurname(" ");
return unassigned;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/reports/ProjectStatusReportController.java b/libreplan-webapp/src/main/java/org/libreplan/web/reports/ProjectStatusReportController.java
index 37c4ebbfc..4ffad58f6 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/reports/ProjectStatusReportController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/reports/ProjectStatusReportController.java
@@ -19,7 +19,7 @@
package org.libreplan.web.reports;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.List;
@@ -111,7 +111,7 @@ public class ProjectStatusReportController extends LibrePlanReportController {
public void showReport(JasperreportComponent jasperreport) {
final Order order = getSelectedOrder();
if (order == null && projectStatusReportModel.isNotFiltering()) {
- messagesForUser.showMessage(Level.ERROR, _("You should filter the report by project, labels or criteria"));
+ messagesForUser.showMessage(Level.ERROR, tr("You should filter the report by project, labels or criteria"));
} else {
super.showReport(jasperreport);
}
@@ -164,7 +164,7 @@ public class ProjectStatusReportController extends LibrePlanReportController {
for (Label label : labels) {
labelNames.add(label.getName());
}
- filter += _("Labels") + ": " + StringUtils.join(labelNames.toArray(), ", ");
+ filter += tr("Labels") + ": " + StringUtils.join(labelNames.toArray(), ", ");
}
Set criteria = projectStatusReportModel.getSelectedCriteria();
@@ -176,7 +176,7 @@ public class ProjectStatusReportController extends LibrePlanReportController {
if (!filter.isEmpty()) {
filter += ". ";
}
- filter += _("Criteria") + ": " + StringUtils.join(criterionNames.toArray(), ", ");
+ filter += tr("Criteria") + ": " + StringUtils.join(criterionNames.toArray(), ", ");
}
return filter;
@@ -189,7 +189,7 @@ public class ProjectStatusReportController extends LibrePlanReportController {
public void addLabel() {
Label label = (Label) bandboxLabels.getSelectedElement();
if (label == null) {
- throw new WrongValueException(bandboxLabels, _("please, select a label"));
+ throw new WrongValueException(bandboxLabels, tr("please, select a label"));
}
projectStatusReportModel.addSelectedLabel(label);
Util.reloadBindings(listboxLabels);
@@ -212,7 +212,7 @@ public class ProjectStatusReportController extends LibrePlanReportController {
public void addCriterion() {
Criterion criterion = (Criterion) bandboxCriteria.getSelectedElement();
if (criterion == null) {
- throw new WrongValueException(bandboxCriteria, _("please, select a criterion"));
+ throw new WrongValueException(bandboxCriteria, tr("please, select a criterion"));
}
projectStatusReportModel.addSelectedCriterion(criterion);
Util.reloadBindings(listboxCriteria);
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/reports/SchedulingProgressPerOrderController.java b/libreplan-webapp/src/main/java/org/libreplan/web/reports/SchedulingProgressPerOrderController.java
index e997f4202..bda1d8192 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/reports/SchedulingProgressPerOrderController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/reports/SchedulingProgressPerOrderController.java
@@ -42,7 +42,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* @author Diego Pino Garcia
@@ -99,12 +99,12 @@ public class SchedulingProgressPerOrderController extends LibrePlanReportControl
public void onSelectOrder() {
Order order = (Order) bdOrders.getSelectedElement();
if (order == null) {
- throw new WrongValueException(bdOrders, _("please, select a project"));
+ throw new WrongValueException(bdOrders, tr("please, select a project"));
}
boolean result = schedulingProgressPerOrderModel.addSelectedOrder(order);
if (!result) {
- throw new WrongValueException(bdOrders, _("This project has already been added."));
+ throw new WrongValueException(bdOrders, tr("This project has already been added."));
} else {
Util.reloadBindings(lbOrders);
}
@@ -166,7 +166,7 @@ public class SchedulingProgressPerOrderController extends LibrePlanReportControl
}
private String asString(AdvanceTypeDTO advanceTypeDTO) {
- return (advanceTypeDTO != null) ? advanceTypeDTO.getName() : _("SPREAD");
+ return (advanceTypeDTO != null) ? advanceTypeDTO.getName() : tr("SPREAD");
}
public AdvanceType getAdvanceType() {
@@ -183,7 +183,7 @@ public class SchedulingProgressPerOrderController extends LibrePlanReportControl
orderNames.add(order.getName());
}
- return (!orderNames.isEmpty()) ? StringUtils.join(orderNames, ",") : _("All");
+ return (!orderNames.isEmpty()) ? StringUtils.join(orderNames, ",") : tr("All");
}
public List getAdvanceTypeDTOs() {
@@ -192,7 +192,7 @@ public class SchedulingProgressPerOrderController extends LibrePlanReportControl
// Add value Spread
AdvanceTypeDTO advanceTypeDTO = new AdvanceTypeDTO();
advanceTypeDTO.setAdvanceType(null);
- advanceTypeDTO.setName(_("SPREAD"));
+ advanceTypeDTO.setName(tr("SPREAD"));
result.add(advanceTypeDTO);
final List advanceTypes = schedulingProgressPerOrderModel.getAdvanceTypes();
@@ -211,7 +211,7 @@ public class SchedulingProgressPerOrderController extends LibrePlanReportControl
final Date endingDate = dbEnding.getValue();
if (endingDate != null && startingDate != null && startingDate.compareTo(endingDate) > 0) {
- throw new WrongValueException(dbStarting, _("Cannot be higher than Ending Date"));
+ throw new WrongValueException(dbStarting, tr("Cannot be higher than Ending Date"));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/reports/TimeLineRequiredMaterialController.java b/libreplan-webapp/src/main/java/org/libreplan/web/reports/TimeLineRequiredMaterialController.java
index f39e6b0c2..aa6ab93cd 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/reports/TimeLineRequiredMaterialController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/reports/TimeLineRequiredMaterialController.java
@@ -51,7 +51,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* @author Susana Montes Pedreira
@@ -104,13 +104,13 @@ public class TimeLineRequiredMaterialController extends LibrePlanReportControlle
public void onSelectOrder() {
Order order = (Order) bdOrders.getSelectedElement();
if (order == null) {
- throw new WrongValueException(bdOrders, _("please, select a project"));
+ throw new WrongValueException(bdOrders, tr("please, select a project"));
}
boolean result = timeLineRequiredMaterialModel.addSelectedOrder(order);
if (!result) {
throw new WrongValueException(bdOrders,
- _("This project has already been added."));
+ tr("This project has already been added."));
} else {
Util.reloadBindings(lbOrders);
}
@@ -209,7 +209,7 @@ public class TimeLineRequiredMaterialController extends LibrePlanReportControlle
}
private String getDefaultStatus() {
- return _("All");
+ return tr("All");
}
public String getSelectedStatus(){
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/reports/WorkingArrangementsPerOrderController.java b/libreplan-webapp/src/main/java/org/libreplan/web/reports/WorkingArrangementsPerOrderController.java
index 0d99aa138..14848d8a0 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/reports/WorkingArrangementsPerOrderController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/reports/WorkingArrangementsPerOrderController.java
@@ -44,7 +44,7 @@ import java.util.Comparator;
import java.util.List;
import java.util.Map;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* @author Diego Pino Garcia
@@ -88,7 +88,7 @@ public class WorkingArrangementsPerOrderController extends LibrePlanReportContro
Listitem item = new Listitem();
item.setParent(lbTaskStatus);
item.setValue(status);
- item.appendChild(new Listcell(_(status.toString())));
+ item.appendChild(new Listcell(tr(status.toString())));
lbTaskStatus.appendChild(item);
if (status.equals(TaskStatusEnum.ALL)) {
@@ -137,14 +137,14 @@ public class WorkingArrangementsPerOrderController extends LibrePlanReportContro
// Task status
final TaskStatusEnum taskStatus = getSelectedTaskStatus();
- result.put("taskStatus", _(taskStatus.toString()));
+ result.put("taskStatus", tr(taskStatus.toString()));
return result;
}
public void showReport(JasperreportComponent jasperreport){
if (getSelectedOrder() == null) {
- throw new WrongValueException(bdOrder, _("Please, select a project"));
+ throw new WrongValueException(bdOrder, tr("Please, select a project"));
}
super.showReport(jasperreport);
}
@@ -171,12 +171,12 @@ public class WorkingArrangementsPerOrderController extends LibrePlanReportContro
public void onSelectLabel() {
Label label = (Label) bdLabels.getSelectedElement();
if (label == null) {
- throw new WrongValueException(bdLabels, _("please, select a label"));
+ throw new WrongValueException(bdLabels, tr("please, select a label"));
}
boolean result = workingArrangementsPerOrderModel.addSelectedLabel(label);
if (!result) {
- throw new WrongValueException(bdLabels, _("Label has already been added."));
+ throw new WrongValueException(bdLabels, tr("Label has already been added."));
} else {
Util.reloadBindings(lbLabels);
}
@@ -203,12 +203,12 @@ public class WorkingArrangementsPerOrderController extends LibrePlanReportContro
public void onSelectCriterion() {
Criterion criterion = (Criterion) bdCriterions.getSelectedElement();
if (criterion == null) {
- throw new WrongValueException(bdCriterions, _("please, select a Criterion"));
+ throw new WrongValueException(bdCriterions, tr("please, select a Criterion"));
}
boolean result = workingArrangementsPerOrderModel.addSelectedCriterion(criterion);
if (!result) {
- throw new WrongValueException(bdCriterions, _("This Criterion has already been added."));
+ throw new WrongValueException(bdCriterions, tr("This Criterion has already been added."));
} else {
Util.reloadBindings(lbCriterions);
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/reports/WorkingArrangementsPerOrderModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/reports/WorkingArrangementsPerOrderModel.java
index 13d8e4e27..6cb586796 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/reports/WorkingArrangementsPerOrderModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/reports/WorkingArrangementsPerOrderModel.java
@@ -21,7 +21,7 @@
package org.libreplan.web.reports;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.math.BigDecimal;
import java.util.ArrayList;
@@ -247,7 +247,7 @@ Order order,
WorkingArrangementPerOrderDTO workingArrangementPerOrderDTO = new WorkingArrangementPerOrderDTO(
deadLineOrder, task, taskStatus, showDependencies
&& !dependencies.isEmpty());
- workingArrangementPerOrderDTO.setStatus(_(workingArrangementPerOrderDTO
+ workingArrangementPerOrderDTO.setStatus(tr(workingArrangementPerOrderDTO
.getStatus()));
result.add(workingArrangementPerOrderDTO);
@@ -263,7 +263,7 @@ Order order,
.getAdvancePercentage());
WorkingArrangementPerOrderDTO dto = new WorkingArrangementPerOrderDTO(
task, taskStatus, dependencyDTO);
- dto.setStatus(_(dto.getStatus()));
+ dto.setStatus(tr(dto.getStatus()));
result.add(dto);
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/reports/WorkingProgressPerTaskController.java b/libreplan-webapp/src/main/java/org/libreplan/web/reports/WorkingProgressPerTaskController.java
index ae0ab34b4..ec6a82947 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/reports/WorkingProgressPerTaskController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/reports/WorkingProgressPerTaskController.java
@@ -38,7 +38,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* @author Diego Pino Garcia
@@ -113,7 +113,7 @@ public class WorkingProgressPerTaskController extends LibrePlanReportController
public void showReport(JasperreportComponent jasperreport){
final Order order = getSelectedOrder();
if (order == null) {
- throw new WrongValueException(bandboxSelectOrder, _("Please, select a project"));
+ throw new WrongValueException(bandboxSelectOrder, tr("Please, select a project"));
}
super.showReport(jasperreport);
}
@@ -125,12 +125,12 @@ public class WorkingProgressPerTaskController extends LibrePlanReportController
public void onSelectLabel() {
Label label = (Label) bdLabels.getSelectedElement();
if (label == null) {
- throw new WrongValueException(bdLabels, _("please, select a label"));
+ throw new WrongValueException(bdLabels, tr("please, select a label"));
}
boolean result = workingProgressPerTaskModel.addSelectedLabel(label);
if (!result) {
- throw new WrongValueException(bdLabels, _("Label has already been added."));
+ throw new WrongValueException(bdLabels, tr("Label has already been added."));
} else {
Util.reloadBindings(lbLabels);
}
@@ -157,12 +157,12 @@ public class WorkingProgressPerTaskController extends LibrePlanReportController
public void onSelectCriterion() {
Criterion criterion = (Criterion) bdCriterions.getSelectedElement();
if (criterion == null) {
- throw new WrongValueException(bdCriterions, _("please, select a Criterion"));
+ throw new WrongValueException(bdCriterions, tr("please, select a Criterion"));
}
boolean result = workingProgressPerTaskModel.addSelectedCriterion(criterion);
if (!result) {
- throw new WrongValueException(bdCriterions, _("This Criterion has already been added."));
+ throw new WrongValueException(bdCriterions, tr("This Criterion has already been added."));
} else {
Util.reloadBindings(lbCriterions);
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/resourceload/ResourceLoadController.java b/libreplan-webapp/src/main/java/org/libreplan/web/resourceload/ResourceLoadController.java
index 4f901c726..b5fbbe566 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/resourceload/ResourceLoadController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/resourceload/ResourceLoadController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.resourceload;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import static org.libreplan.web.resourceload.ResourceLoadModel.asDate;
import static org.libreplan.web.resourceload.ResourceLoadModel.toLocal;
@@ -225,7 +225,7 @@ public class ResourceLoadController implements Composer {
chartComponent.setHeight("200px");
Tabs chartTabs = new Tabs();
- chartTabs.appendChild(new Tab(_("Load")));
+ chartTabs.appendChild(new Tab(tr("Load")));
chartComponent.appendChild(chartTabs);
chartTabs.setWidth("124px");
@@ -452,9 +452,9 @@ public class ResourceLoadController implements Composer {
});
Hbox hbox = new Hbox();
- hbox.appendChild(new Label(_("From") + ":"));
+ hbox.appendChild(new Label(tr("From") + ":"));
hbox.appendChild(startBox);
- hbox.appendChild(new Label(_("To") + ":"));
+ hbox.appendChild(new Label(tr("To") + ":"));
hbox.appendChild(endBox);
hbox.setAlign("center");
@@ -548,9 +548,9 @@ public class ResourceLoadController implements Composer {
private void updateLabelValue() {
if ( isFilteringByResource() ) {
- label.setValue(_("Resources or criteria") + ":");
+ label.setValue(tr("Resources or criteria") + ":");
} else {
- label.setValue(_("Criteria") + ":");
+ label.setValue(tr("Criteria") + ":");
}
}
@@ -724,8 +724,8 @@ public class ResourceLoadController implements Composer {
filterByNameCombo.getChildren().clear();
Comboitem lastItem = new Comboitem();
- lastItem.setLabel(_("All"));
- lastItem.setDescription(_("Show all elements"));
+ lastItem.setLabel(tr("All"));
+ lastItem.setDescription(tr("Show all elements"));
lastItem.setValue(ALL);
pages.add(lastItem);
@@ -1050,12 +1050,12 @@ public class ResourceLoadController implements Composer {
planningControllerEntryPoints.goToTaskResourceAllocation(order, task);
} else {
Messagebox.show(
- _("The project has no scheduled elements"), _("Information"),
+ tr("The project has no scheduled elements"), tr("Information"),
Messagebox.OK, Messagebox.INFORMATION);
}
} else {
Messagebox.show(
- _("You don't have read access to this project"), _("Information"),
+ tr("You don't have read access to this project"), tr("Information"),
Messagebox.OK, Messagebox.INFORMATION);
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/resourceload/ResourceLoadModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/resourceload/ResourceLoadModel.java
index 1bc752904..bb90cdff7 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/resourceload/ResourceLoadModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/resourceload/ResourceLoadModel.java
@@ -22,7 +22,7 @@
package org.libreplan.web.resourceload;
import static org.libreplan.business.planner.entities.TaskElement.justTasks;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import static org.libreplan.web.planner.order.PlanningStateCreator.and;
import java.util.ArrayList;
@@ -691,7 +691,7 @@ public class ResourceLoadModel implements IResourceLoadModel {
TimeLineRole role = getCurrentTimeLineRole(null);
return new LoadTimeLine(
- buildTimeLine(resource, _("Other projects"), resourceAllocations, TYPE_RESOURCE, role),
+ buildTimeLine(resource, tr("Other projects"), resourceAllocations, TYPE_RESOURCE, role),
buildTimeLinesGroupForOrder(resource, byOrder));
}
@@ -981,7 +981,7 @@ public class ResourceLoadModel implements IResourceLoadModel {
ResourceAllocation.getOfType(SpecificResourceAllocation.class, allocations);
LoadTimeLine main = new LoadTimeLine(
- _("Specific Allocations"),
+ tr("Specific Allocations"),
createPeriods(criterion, specific),
"related-specific",
getCurrentTimeLineRole(criterion));
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/resources/criterion/CriterionAdminController.java b/libreplan-webapp/src/main/java/org/libreplan/web/resources/criterion/CriterionAdminController.java
index ff6ce3c50..e4ef4d666 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/resources/criterion/CriterionAdminController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/resources/criterion/CriterionAdminController.java
@@ -45,7 +45,7 @@ import org.zkoss.zkplus.spring.SpringUtil;
import java.util.ConcurrentModificationException;
import java.util.List;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Controller for Criterions.
@@ -93,8 +93,8 @@ public class CriterionAdminController extends BaseCRUDController
private void showConfirmingHierarchyWindow() {
int status = Messagebox.show(
- _("Disable hierarchy will cause criteria tree to be flattened. Are you sure?"),
- _("Question"), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
+ tr("Disable hierarchy will cause criteria tree to be flattened. Are you sure?"),
+ tr("Question"), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
if (Messagebox.OK == status) {
disableHierarchy();
@@ -109,7 +109,7 @@ public class CriterionAdminController extends BaseCRUDController
messagesForUser.showMessage(
Level.INFO,
- _("Tree {0} sucessfully flattened", criterionsModel.getCriterionType().getName()));
+ tr("Tree {0} sucessfully flattened", criterionsModel.getCriterionType().getName()));
Util.reloadBindings(listWindow);
}
@@ -146,7 +146,7 @@ public class CriterionAdminController extends BaseCRUDController
private void setupResourceCombobox(Combobox combo) {
for (ResourceEnum resource : ResourceEnum.values()) {
- Comboitem item = combo.appendItem(_(resource.getDisplayName()));
+ Comboitem item = combo.appendItem(tr(resource.getDisplayName()));
item.setValue(resource);
}
}
@@ -197,12 +197,12 @@ public class CriterionAdminController extends BaseCRUDController
@Override
protected String getEntityType() {
- return _("Criterion Type");
+ return tr("Criterion Type");
}
@Override
protected String getPluralEntityType() {
- return _("Criterion Types");
+ return tr("Criterion Types");
}
@Override
@@ -248,7 +248,7 @@ public class CriterionAdminController extends BaseCRUDController
if (!criterionsModel.canRemove(criterionType)) {
messagesForUser.showMessage(
Level.WARNING,
- _("This criterion type cannot be deleted because it is assigned to projects or resources"));
+ tr("This criterion type cannot be deleted because it is assigned to projects or resources"));
return false;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/resources/criterion/CriterionTreeController.java b/libreplan-webapp/src/main/java/org/libreplan/web/resources/criterion/CriterionTreeController.java
index 5c69353b7..e37e81dfc 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/resources/criterion/CriterionTreeController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/resources/criterion/CriterionTreeController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.resources.criterion;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.HashSet;
import java.util.Set;
@@ -128,7 +128,7 @@ public class CriterionTreeController extends GenericForwardComposer {
criterionForThisRow.setName(value);
}));
- String message = _("cannot be empty");
+ String message = tr("cannot be empty");
textboxName.setConstraint("no empty:"+message);
Treecell cellForActive = new Treecell();
@@ -293,10 +293,10 @@ public class CriterionTreeController extends GenericForwardComposer {
if ( this.criterionsModel.getCriterionType().allowHierarchy()) {
unindentButton = new Button("", "/common/img/ico_izq1.png");
unindentButton.setHoverImage("/common/img/ico_izq.png");
- unindentButton.setTooltiptext(_("Unindent"));
+ unindentButton.setTooltiptext(tr("Unindent"));
} else {
unindentButton = new Button("", "/common/img/ico_izq_out.png");
- unindentButton.setTooltiptext(_("Not indentable"));
+ unindentButton.setTooltiptext(tr("Not indentable"));
}
unindentButton.setSclass("icono");
@@ -308,10 +308,10 @@ public class CriterionTreeController extends GenericForwardComposer {
if ( this.criterionsModel.getCriterionType().allowHierarchy()) {
indentButton = new Button("", "/common/img/ico_derecha1.png");
indentButton.setHoverImage("/common/img/ico_derecha.png");
- indentButton.setTooltiptext(_("Indent"));
+ indentButton.setTooltiptext(tr("Indent"));
} else {
indentButton = new Button("", "/common/img/ico_derecha_out.png");
- indentButton.setTooltiptext(_("Not indentable"));
+ indentButton.setTooltiptext(tr("Not indentable"));
}
indentButton.setSclass("icono");
@@ -326,13 +326,13 @@ public class CriterionTreeController extends GenericForwardComposer {
if (criterionsModel.isDeletable(criterion.getCriterion())) {
removeButton = new Button("", "/common/img/ico_borrar1.png");
removeButton.setHoverImage("/common/img/ico_borrar.png");
- removeButton.setTooltiptext(_("Delete"));
+ removeButton.setTooltiptext(tr("Delete"));
} else {
removeButton = new Button("", "/common/img/ico_borrar_out.png");
removeButton.setTooltiptext(criterion.getCriterion().getChildren().isEmpty()
- ? (num + " " + _("references"))
- : _("Criterion has subelements"));
+ ? (num + " " + tr("references"))
+ : tr("Criterion has subelements"));
}
removeButton.setSclass("icono");
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/resources/criterion/CriterionTreeModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/resources/criterion/CriterionTreeModel.java
index ff81c4889..da8b7e970 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/resources/criterion/CriterionTreeModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/resources/criterion/CriterionTreeModel.java
@@ -27,7 +27,7 @@
package org.libreplan.web.resources.criterion;
import static org.libreplan.business.common.exceptions.ValidationException.invalidValue;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.Arrays;
@@ -120,7 +120,7 @@ public class CriterionTreeModel implements ICriterionTreeModel {
private CriterionDTO createNewCriterion(String name) {
CriterionDTO newCriterion = new CriterionDTO();
- newCriterion.setName(_(name));
+ newCriterion.setName(tr(name));
Criterion criterion = Criterion.create(criterionType);
newCriterion.setCriterion(criterion);
return newCriterion;
@@ -327,7 +327,7 @@ public class CriterionTreeModel implements ICriterionTreeModel {
for(CriterionDTO criterion : criterions){
if(criterion.getName().equals(name)){
throw new ValidationException(invalidValue(
- _("Already exists another "
+ tr("Already exists another "
+ "criterion with the same name"), "name",
criterion.getName(), criterion));
}
@@ -339,7 +339,7 @@ public class CriterionTreeModel implements ICriterionTreeModel {
throws ValidationException{
if(name.isEmpty()){
throw new ValidationException(
- invalidValue(_("Name of criterion is empty."), "name",
+ invalidValue(tr("Name of criterion is empty."), "name",
"",criterionType));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/resources/criterion/CriterionsModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/resources/criterion/CriterionsModel.java
index 708b6090d..191b4a253 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/resources/criterion/CriterionsModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/resources/criterion/CriterionsModel.java
@@ -21,7 +21,7 @@
package org.libreplan.web.resources.criterion;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.Collection;
@@ -176,7 +176,7 @@ public class CriterionsModel extends IntegrationEntityModel implements ICriterio
return each;
}
}
- throw new RuntimeException(_("{0} not found type for criterion ", criterion));
+ throw new RuntimeException(tr("{0} not found type for criterion ", criterion));
}
@Override
@@ -213,8 +213,8 @@ public class CriterionsModel extends IntegrationEntityModel implements ICriterio
private List getResourcesSatisfying(
Class resourceType, Criterion criterion) {
- Validate.notNull(resourceType, _("Resource type cannot be empty"));
- Validate.notNull(criterion, _("Criterion cannot be empty"));
+ Validate.notNull(resourceType, tr("Resource type cannot be empty"));
+ Validate.notNull(criterion, tr("Criterion cannot be empty"));
List result = new ArrayList();
for (T r : resourceDAO.list(resourceType)) {
if (criterion.isSatisfiedBy(r)) {
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/resources/machine/AssignedMachineCriterionsModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/resources/machine/AssignedMachineCriterionsModel.java
index 1b897599c..8d1a44643 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/resources/machine/AssignedMachineCriterionsModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/resources/machine/AssignedMachineCriterionsModel.java
@@ -21,7 +21,7 @@
package org.libreplan.web.resources.machine;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.HashSet;
@@ -395,10 +395,10 @@ public class AssignedMachineCriterionsModel extends IntegrationEntityModel
Criterion criterion = satisfactionDTO.getCriterionWithItsType()
.getCriterion();
if (checkSameCriterionAndSameInterval(satisfactionDTO)) {
- throw new IllegalStateException(_("The {0} can not be assigned to this resource. Its interval overlaps with other criterion", criterion.getName()));
+ throw new IllegalStateException(tr("The {0} can not be assigned to this resource. Its interval overlaps with other criterion", criterion.getName()));
}
if (checkNotAllowSimultaneousCriterionsPerResource(satisfactionDTO)) {
- throw new IllegalStateException(_("The {0} is not valid. Other value exists from the same criterion type", criterion.getName()));
+ throw new IllegalStateException(tr("The {0} is not valid. Other value exists from the same criterion type", criterion.getName()));
}
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/resources/machine/MachineCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/resources/machine/MachineCRUDController.java
index 416461780..f446c60ef 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/resources/machine/MachineCRUDController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/resources/machine/MachineCRUDController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.resources.machine;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ConcurrentModificationException;
import java.util.Date;
@@ -276,7 +276,7 @@ public class MachineCRUDController extends BaseCRUDController {
Combobox combobox = (Combobox) editWindow.getFellow("createDerivedCalendar");
Comboitem selectedItem = combobox.getSelectedItem();
if (selectedItem == null) {
- throw new WrongValueException(combobox, _("Please, select a calendar"));
+ throw new WrongValueException(combobox, tr("Please, select a calendar"));
}
BaseCalendar parentCalendar = combobox.getSelectedItem().getValue();
@@ -404,7 +404,7 @@ public class MachineCRUDController extends BaseCRUDController {
(finishDate.compareTo(filterStartDate.getValue()) < 0)) {
filterFinishDate.setValue(null);
- throw new WrongValueException(comp, _("must be after start date"));
+ throw new WrongValueException(comp, tr("must be after start date"));
}
}
};
@@ -420,7 +420,7 @@ public class MachineCRUDController extends BaseCRUDController {
(startDate.compareTo(filterFinishDate.getValue()) > 0)) {
filterStartDate.setValue(null);
- throw new WrongValueException(comp, _("must be lower than end date"));
+ throw new WrongValueException(comp, tr("must be lower than end date"));
}
}
};
@@ -533,7 +533,7 @@ public class MachineCRUDController extends BaseCRUDController {
messagesForUser.showMessage(
Level.WARNING,
- _("Machine cannot be deleted. Machine is allocated to a project or contains imputed hours"));
+ tr("Machine cannot be deleted. Machine is allocated to a project or contains imputed hours"));
return false;
}
@@ -546,7 +546,7 @@ public class MachineCRUDController extends BaseCRUDController {
try {
machineModel.confirmRemove(machine);
} catch (InstanceNotFoundException e) {
- messagesForUser.showMessage(Level.INFO, _("Machine was already removed"));
+ messagesForUser.showMessage(Level.INFO, tr("Machine was already removed"));
}
}
@@ -560,7 +560,7 @@ public class MachineCRUDController extends BaseCRUDController {
row.appendChild(new Label(machine.getName()));
row.appendChild(new Label(machine.getDescription()));
row.appendChild(new Label(machine.getCode()));
- row.appendChild(new Label((Boolean.TRUE.equals(machine.isLimitingResource())) ? _("yes") : _("no")));
+ row.appendChild(new Label((Boolean.TRUE.equals(machine.isLimitingResource())) ? tr("yes") : tr("no")));
Hbox hbox = new Hbox();
hbox.appendChild(Util.createEditButton(event -> goToEditForm(machine)));
@@ -571,12 +571,12 @@ public class MachineCRUDController extends BaseCRUDController {
@Override
protected String getEntityType() {
- return _("Machine");
+ return tr("Machine");
}
@Override
protected String getPluralEntityType() {
- return _("Machines");
+ return tr("Machines");
}
@Override
@@ -606,15 +606,15 @@ public class MachineCRUDController extends BaseCRUDController {
Limits resourcesTypeLimit = limitsModel.getResourcesType();
if (isNullOrZeroValue(resourcesTypeLimit)) {
- return _("Create");
+ return tr("Create");
}
Integer resources = resourceDAO.getRowCount().intValue();
int resourcesLeft = resourcesTypeLimit.getValue() - resources;
return resources >= resourcesTypeLimit.getValue()
- ? _("Machines limit reached")
- : _("Create") + " ( " + resourcesLeft + " " + _("left") + " )";
+ ? tr("Machines limit reached")
+ : tr("Create") + " ( " + resourcesLeft + " " + tr("left") + " )";
}
private boolean isNullOrZeroValue (Limits resourcesTypeLimit) {
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/resources/machine/MachineConfigurationController.java b/libreplan-webapp/src/main/java/org/libreplan/web/resources/machine/MachineConfigurationController.java
index 46fe1e013..6face06e7 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/resources/machine/MachineConfigurationController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/resources/machine/MachineConfigurationController.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.web.resources.machine;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.math.BigDecimal;
import java.util.Date;
@@ -121,7 +121,7 @@ public class MachineConfigurationController extends GenericForwardComposer {
Autocomplete a = (Autocomplete) c.getPreviousSibling();
Worker worker = (Worker) a.getItemByText(a.getValue());
if (worker == null) {
- messages.showMessage(Level.ERROR, _("No worker selected"));
+ messages.showMessage(Level.ERROR, tr("No worker selected"));
} else {
machineModel.addWorkerAssignmentToConfigurationUnit(unit, worker);
Util.reloadBindings(c.getNextSibling());
@@ -145,7 +145,7 @@ public class MachineConfigurationController extends GenericForwardComposer {
CriterionWithItsType criterionAndType = item.getValue();
bandbox.setValue(criterionAndType.getNameAndType());
if (checkExistingCriterion(unit, criterionAndType.getCriterion())) {
- messages.showMessage(Level.ERROR, _("Criterion previously selected"));
+ messages.showMessage(Level.ERROR, tr("Criterion previously selected"));
} else {
machineModel.addCriterionRequirementToConfigurationUnit(unit, criterionAndType.getCriterion());
bandbox.setValue("");
@@ -203,7 +203,7 @@ public class MachineConfigurationController extends GenericForwardComposer {
private void validateEndDate(Component comp, Object value) {
if (value == null) {
- throw new WrongValueException(comp, _("End date is not valid, the date field can not be blank"));
+ throw new WrongValueException(comp, tr("End date is not valid, the date field can not be blank"));
}
else {
Datebox startDateBox = (Datebox) comp.getPreviousSibling();
@@ -212,7 +212,7 @@ public class MachineConfigurationController extends GenericForwardComposer {
if (startDateBox.getValue().compareTo((Date) value) > 0) {
throw new WrongValueException(
- comp, _("End date is not valid, the new end date must be after start date"));
+ comp, tr("End date is not valid, the new end date must be after start date"));
}
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/resources/search/NewAllocationSelectorController.java b/libreplan-webapp/src/main/java/org/libreplan/web/resources/search/NewAllocationSelectorController.java
index 68b7d2681..f7eea2fab 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/resources/search/NewAllocationSelectorController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/resources/search/NewAllocationSelectorController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.resources.search;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.math.BigDecimal;
import java.util.ArrayList;
@@ -696,9 +696,9 @@ public class NewAllocationSelectorController extends AllocationSelectorControlle
return (comp, value) -> {
if ( value == null ) {
if ( comp.getId().equals("startDateLoadRatiosDatebox") ) {
- throw new WrongValueException(comp, _("Start filtering date cannot be empty"));
+ throw new WrongValueException(comp, tr("Start filtering date cannot be empty"));
} else if ( comp.getId().equals("endDateLoadRatiosDatebox") ) {
- throw new WrongValueException(comp, _("End filtering date cannot be empty"));
+ throw new WrongValueException(comp, tr("End filtering date cannot be empty"));
}
}
@@ -719,7 +719,7 @@ public class NewAllocationSelectorController extends AllocationSelectorControlle
if ( (startDate != null) && (endDate != null) ) {
if ( (startDate.after(endDate)) || (startDate.equals(endDate)) ) {
- throw new WrongValueException(comp, _("Start filtering date must be before than end filtering date"));
+ throw new WrongValueException(comp, tr("Start filtering date must be before than end filtering date"));
}
}
};
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/AssignedCriterionsModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/AssignedCriterionsModel.java
index f5f543dad..ecd3ca7b1 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/AssignedCriterionsModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/AssignedCriterionsModel.java
@@ -25,7 +25,7 @@
package org.libreplan.web.resources.worker;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.HashSet;
@@ -330,12 +330,12 @@ public class AssignedCriterionsModel extends IntegrationEntityModel implements
.getCriterion();
if (checkSameCriterionAndSameInterval(satisfactionDTO)) {
throw new IllegalStateException(
- _("The {0} can not be assigned to this resource. Its interval overlaps with other criterion",
+ tr("The {0} can not be assigned to this resource. Its interval overlaps with other criterion",
criterion.getName()));
}
if (checkNotAllowSimultaneousCriterionsPerResource(satisfactionDTO)) {
throw new IllegalStateException(
- _("The {0} is not valid. Other value exists from the same criterion type",
+ tr("The {0} is not valid. Other value exists from the same criterion type",
criterion.getName()));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/CriterionsController.java b/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/CriterionsController.java
index de7f29ea1..1d7592806 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/CriterionsController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/CriterionsController.java
@@ -24,7 +24,7 @@
*/
package org.libreplan.web.resources.worker;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import static org.libreplan.web.common.InvalidInputsChecker.isInvalid;
import static org.libreplan.web.common.InvalidInputsChecker.thereAreInvalidInputsOn;
@@ -90,7 +90,7 @@ public class CriterionsController extends GenericForwardComposer {
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
if (messagesContainer == null) {
- throw new RuntimeException(_("MessagesContainer is needed"));
+ throw new RuntimeException(tr("MessagesContainer is needed"));
}
messages = new MessagesForUser(messagesContainer);
comp.setAttribute("assignedCriterionsController", this, true);
@@ -189,11 +189,11 @@ public class CriterionsController extends GenericForwardComposer {
}
if (assignedCriterionsModel.checkSameCriterionAndSameInterval(satisfaction)) {
- throw new WrongValueException(comp, _("Criterion already assigned"));
+ throw new WrongValueException(comp, tr("Criterion already assigned"));
}
if (assignedCriterionsModel.checkNotAllowSimultaneousCriterionsPerResource(satisfaction)) {
- throw new WrongValueException(comp, _("This criterion type cannot have multiple values in the same period"));
+ throw new WrongValueException(comp, tr("This criterion type cannot have multiple values in the same period"));
}
}
@@ -215,15 +215,15 @@ public class CriterionsController extends GenericForwardComposer {
private void validateStartDate(Component comp, Object value){
CriterionSatisfactionDTO criterionSatisfactionDTO = ((Row) comp.getParent()).getValue();
if (value == null) {
- throw new WrongValueException(comp, _("cannot be empty"));
+ throw new WrongValueException(comp, tr("cannot be empty"));
}
if (!criterionSatisfactionDTO.isLessToEndDate((Date) value)) {
- throw new WrongValueException(comp, _("Invalid Start Date. New Start Date must be earlier than End Date"));
+ throw new WrongValueException(comp, tr("Invalid Start Date. New Start Date must be earlier than End Date"));
} else if (!criterionSatisfactionDTO.isPreviousStartDate((Date) value)) {
throw new WrongValueException(
- comp, _("Start date is not valid, the new start date must be previous the current start date"));
+ comp, tr("Start date is not valid, the new start date must be previous the current start date"));
}
}
@@ -239,9 +239,9 @@ public class CriterionsController extends GenericForwardComposer {
private void validateEndDate(Component comp, Object value){
CriterionSatisfactionDTO criterionSatisfactionDTO = ((Row) comp.getParent()).getValue();
if (!criterionSatisfactionDTO.isGreaterStartDate((Date) value)){
- throw new WrongValueException(comp, _("End date is not valid, the new end date must be after start date"));
+ throw new WrongValueException(comp, tr("End date is not valid, the new end date must be after start date"));
} else if (!criterionSatisfactionDTO.isPostEndDate((Date) value)) {
- throw new WrongValueException(comp, _("Invaldid End Date. New End Date must be after current End Date "));
+ throw new WrongValueException(comp, tr("Invaldid End Date. New End Date must be after current End Date "));
}
}
@@ -342,7 +342,7 @@ public class CriterionsController extends GenericForwardComposer {
// Value is incorrect, clear
startDate.setValue(null);
- throw new WrongValueException(startDate, _("cannot be empty"));
+ throw new WrongValueException(startDate, tr("cannot be empty"));
}
if (CriterionSatisfactionDTO.CRITERION_WITH_ITS_TYPE.equals(propertyName)) {
@@ -351,7 +351,7 @@ public class CriterionsController extends GenericForwardComposer {
// Value is incorrect, clear
bandType.setValue(null);
- throw new WrongValueException(bandType, _("cannot be empty"));
+ throw new WrongValueException(bandType, tr("cannot be empty"));
}
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/CriterionsMachineController.java b/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/CriterionsMachineController.java
index d30d8b253..a3771a1cc 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/CriterionsMachineController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/CriterionsMachineController.java
@@ -24,7 +24,7 @@
*/
package org.libreplan.web.resources.worker;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import static org.libreplan.web.common.InvalidInputsChecker.isInvalid;
import static org.libreplan.web.common.InvalidInputsChecker.thereAreInvalidInputsOn;
@@ -181,12 +181,12 @@ public class CriterionsMachineController extends GenericForwardComposer {
}
if (assignedMachineCriterionsModel.checkSameCriterionAndSameInterval(satisfaction)) {
- throw new WrongValueException(comp, _("Criterion already assigned"));
+ throw new WrongValueException(comp, tr("Criterion already assigned"));
}
if (assignedMachineCriterionsModel.checkNotAllowSimultaneousCriterionsPerResource(satisfaction)) {
throw new WrongValueException(comp,
- _("This criterion type cannot have multiple values in the same period"));
+ tr("This criterion type cannot have multiple values in the same period"));
}
}
@@ -208,9 +208,9 @@ public class CriterionsMachineController extends GenericForwardComposer {
private void validateEndDate(Component comp, Object value) {
CriterionSatisfactionDTO criterionSatisfactionDTO = ((Row) comp.getParent()).getValue();
if (!criterionSatisfactionDTO.isGreaterStartDate((Date) value)) {
- throw new WrongValueException(comp, _("End date is not valid, the new end date must be after the start date"));
+ throw new WrongValueException(comp, tr("End date is not valid, the new end date must be after the start date"));
} else if (!criterionSatisfactionDTO.isPostEndDate((Date) value)) {
- throw new WrongValueException(comp, _("Invaldid End Date. New End Date must be after current End Date "));
+ throw new WrongValueException(comp, tr("Invaldid End Date. New End Date must be after current End Date "));
}
}
@@ -226,16 +226,16 @@ public class CriterionsMachineController extends GenericForwardComposer {
private void validateStartDate(Component comp, Object value) {
CriterionSatisfactionDTO criterionSatisfactionDTO = ((Row) comp.getParent()).getValue();
if (value == null) {
- throw new WrongValueException(comp, _("cannot be empty"));
+ throw new WrongValueException(comp, tr("cannot be empty"));
}
if (!criterionSatisfactionDTO.isLessToEndDate((Date) value)) {
- throw new WrongValueException(comp, _("Invalid Start Date. New Start Date must be earlier than End Date"));
+ throw new WrongValueException(comp, tr("Invalid Start Date. New Start Date must be earlier than End Date"));
} else if (!criterionSatisfactionDTO.isPreviousStartDate((Date) value)) {
throw new WrongValueException(
- comp, _("Start date is not valid, the new start date must be previous the current start date"));
+ comp, tr("Start date is not valid, the new start date must be previous the current start date"));
}
}
@@ -339,7 +339,7 @@ public class CriterionsMachineController extends GenericForwardComposer {
// Value is incorrect, clear
startDate.setValue(null);
- throw new WrongValueException(startDate, _("cannot be empty"));
+ throw new WrongValueException(startDate, tr("cannot be empty"));
}
if (CriterionSatisfactionDTO.CRITERION_WITH_ITS_TYPE.equals(propertyName)) {
@@ -348,7 +348,7 @@ public class CriterionsMachineController extends GenericForwardComposer {
// Value is incorrect, clear
bandType.setValue(null);
- throw new WrongValueException(bandType, _("cannot be empty"));
+ throw new WrongValueException(bandType, tr("cannot be empty"));
}
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/WorkRelationshipsController.java b/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/WorkRelationshipsController.java
index eb4f80aa5..69509ef5b 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/WorkRelationshipsController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/WorkRelationshipsController.java
@@ -42,7 +42,7 @@ import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Subcontroller for {@link Worker} resource.
@@ -145,22 +145,22 @@ public class WorkRelationshipsController extends GenericForwardComposer {
satisfactionEdited);
switch (addSatisfaction) {
case OK:
- messagesForUser.showMessage(Level.INFO, _("Time period saved"));
+ messagesForUser.showMessage(Level.INFO, tr("Time period saved"));
this.workerCRUDController.goToEditForm();
break;
case SATISFACTION_WRONG:
messagesForUser
.showMessage(Level.WARNING,
- _("Time period contains non valid data. Ending data must be older than starting date"));
+ tr("Time period contains non valid data. Ending data must be older than starting date"));
break;
case DONT_COMPLY_OVERLAPPING_RESTRICTIONS:
messagesForUser
.showMessage(Level.WARNING,
- _("Could not save time period. Time period overlaps with another non-compatible time period"));
+ tr("Could not save time period. Time period overlaps with another non-compatible time period"));
this.workerCRUDController.goToEditForm();
break;
default:
- throw new RuntimeException(_("Unexpected: {0}", addSatisfaction));
+ throw new RuntimeException(tr("Unexpected: {0}", addSatisfaction));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/WorkerCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/WorkerCRUDController.java
index 6c192c2ef..12174e293 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/WorkerCRUDController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/WorkerCRUDController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.resources.worker;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ConcurrentModificationException;
import java.util.Date;
@@ -179,9 +179,9 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
private Textbox passwordConfirmationTextbox;
private enum UserBindingOption {
- NOT_BOUND(_("Not bound")),
- EXISTING_USER(_("Existing user")),
- CREATE_NEW_USER(_("Create new user"));
+ NOT_BOUND(tr("Not bound")),
+ EXISTING_USER(tr("Existing user")),
+ CREATE_NEW_USER(tr("Create new user"));
private String label;
@@ -192,7 +192,7 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
/**
* Helper function to mark text to be translated.
*/
- private static String _(String text) {
+ private static String tr(String text) {
return text;
}
@@ -285,7 +285,7 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
}
workerModel.save();
- messages.showMessage(Level.INFO, _("Worker saved"));
+ messages.showMessage(Level.INFO, tr("Worker saved"));
return true;
} catch (ValidationException e) {
@@ -304,7 +304,7 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
if (UserBindingOption.EXISTING_USER.ordinal() == option) {
if (getWorker().getUser() == null) {
- throw new WrongValueException(userBandbox, _("please select a user to bound"));
+ throw new WrongValueException(userBandbox, tr("please select a user to bound"));
}
getWorker().updateUserData();
}
@@ -317,17 +317,17 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
private User createNewUserForBinding() {
String loginName = loginNameTextbox.getValue();
if (StringUtils.isBlank(loginName)) {
- throw new WrongValueException(loginNameTextbox, _("cannot be empty"));
+ throw new WrongValueException(loginNameTextbox, tr("cannot be empty"));
}
String password = passwordTextbox.getValue();
if (StringUtils.isBlank(loginName)) {
- throw new WrongValueException(passwordTextbox, _("cannot be empty"));
+ throw new WrongValueException(passwordTextbox, tr("cannot be empty"));
}
String passwordConfirmation = passwordConfirmationTextbox.getValue();
if (!password.equals(passwordConfirmation)) {
- throw new WrongValueException(passwordConfirmationTextbox, _("passwords do not match"));
+ throw new WrongValueException(passwordConfirmationTextbox, tr("passwords do not match"));
}
String encodedPassword = dbPasswordEncoderService.encodePassword(password, loginName);
@@ -394,7 +394,7 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
editAssignedCriterions();
updateUserBindingComponents();
- showEditWindow(_("Edit Worker: {0}", worker.getHumanId()));
+ showEditWindow(tr("Edit Worker: {0}", worker.getHumanId()));
Textbox workerFirstname = (Textbox) editWindow.getFellow("workerFirstname");
workerFirstname.focus();
@@ -427,7 +427,7 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
}
editAssignedCriterions();
- showEditWindow(_("Edit Virtual Workers Group: {0}", worker.getHumanId()));
+ showEditWindow(tr("Edit Virtual Workers Group: {0}", worker.getHumanId()));
}
public void goToEditForm() {
@@ -435,7 +435,7 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
if (isCalendarNotNull()) {
editCalendar();
}
- showEditWindow(_("Edit Worker: {0}", getWorker().getHumanId()));
+ showEditWindow(tr("Edit Worker: {0}", getWorker().getHumanId()));
}
@Override
@@ -446,7 +446,7 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
createAssignedCriterions();
resourcesCostCategoryAssignmentController.setResource(workerModel.getWorker());
updateUserBindingComponents();
- showEditWindow(_("Create Worker"));
+ showEditWindow(tr("Create Worker"));
resourceCalendarModel.cancel();
Textbox workerFirstname = (Textbox) editWindow.getFellow("workerFirstname");
workerFirstname.focus();
@@ -475,7 +475,7 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
comp.setAttribute("controller", this, true);
if (messagesContainer == null) {
- throw new RuntimeException(_("MessagesContainer is needed"));
+ throw new RuntimeException(tr("MessagesContainer is needed"));
}
messages = new MessagesForUser(messagesContainer);
@@ -508,13 +508,13 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
private void initUserBindingOptions() {
UserBindingOption[] values = UserBindingOption.values();
for (UserBindingOption option : values) {
- Radio radio = new Radio(_(option.label));
+ Radio radio = new Radio(tr(option.label));
if ( option.equals(UserBindingOption.CREATE_NEW_USER) &&
!SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_USER_ACCOUNTS) ) {
radio.setDisabled(true);
- radio.setTooltiptext(_("You do not have permissions to create new users"));
+ radio.setTooltiptext(tr("You do not have permissions to create new users"));
}
userBindingRadiogroup.appendChild(radio);
}
@@ -738,7 +738,7 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
workerModel.prepareForCreate(true);
createAssignedCriterions();
resourcesCostCategoryAssignmentController.setResource(workerModel.getWorker());
- showEditWindow(_("Create Virtual Workers Group"));
+ showEditWindow(tr("Create Virtual Workers Group"));
resourceCalendarModel.cancel();
}
@@ -781,7 +781,7 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
if ( (finishDate != null) && (filterStartDate.getValue() != null) &&
(finishDate.compareTo(filterStartDate.getValue()) < 0) ) {
filterFinishDate.setValue(null);
- throw new WrongValueException(comp, _("must be after start date"));
+ throw new WrongValueException(comp, tr("must be after start date"));
}
};
}
@@ -791,7 +791,7 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
if ( (startDate != null) && (filterFinishDate.getValue() != null) && (
startDate.compareTo(filterFinishDate.getValue()) > 0) ) {
filterStartDate.setValue(null);
- throw new WrongValueException(comp, _("must be lower than end date"));
+ throw new WrongValueException(comp, tr("must be lower than end date"));
}
};
}
@@ -849,9 +849,9 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
}
public enum LimitingResourceEnum {
- ALL(_("All")),
- LIMITING_RESOURCE(_("Queue-based resource")),
- NON_LIMITING_RESOURCE(_("Normal resource"));
+ ALL(tr("All")),
+ LIMITING_RESOURCE(tr("Queue-based resource")),
+ NON_LIMITING_RESOURCE(tr("Normal resource"));
private String option;
@@ -861,7 +861,7 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
@Override
public String toString() {
- return _(option);
+ return tr(option);
}
public static LimitingResourceEnum valueOf(Boolean isLimitingResource) {
@@ -952,13 +952,13 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
if (!workerModel.canRemove(worker)) {
messages.showMessage(
Level.WARNING,
- _("This worker cannot be deleted because it has assignments to projects or imputed hours"));
+ tr("This worker cannot be deleted because it has assignments to projects or imputed hours"));
return;
}
int status = Messagebox.show(
- _("Confirm deleting this worker. Are you sure?"),
- _("Delete"), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
+ tr("Confirm deleting this worker. Are you sure?"),
+ tr("Delete"), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
if (Messagebox.OK != status) {
return;
@@ -969,17 +969,17 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
if (user != null && !user.isSuperuser()) {
removeBoundUser = Messagebox.show(
- _("Do you want to remove bound user \"{0}\" too?", user.getLoginName()),
- _("Delete bound user"),
+ tr("Do you want to remove bound user \"{0}\" too?", user.getLoginName()),
+ tr("Delete bound user"),
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION) == Messagebox.YES;
}
workerModel.confirmRemove(worker, removeBoundUser);
messages.showMessage(Level.INFO,
- removeBoundUser ? _("Worker and bound user deleted") : _("Worker deleted"));
+ removeBoundUser ? tr("Worker and bound user deleted") : tr("Worker deleted"));
goToList();
} catch (InstanceNotFoundException e) {
- messages.showMessage(Level.INFO, _("This worker was already removed by other user"));
+ messages.showMessage(Level.INFO, tr("This worker was already removed by other user"));
}
}
@@ -994,7 +994,7 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
row.appendChild(new Label(worker.getFirstName()));
row.appendChild(new Label(worker.getNif()));
row.appendChild(new Label(worker.getCode()));
- row.appendChild(new Label(Boolean.TRUE.equals(worker.isLimitingResource()) ? _("yes") : _("no")));
+ row.appendChild(new Label(Boolean.TRUE.equals(worker.isLimitingResource()) ? tr("yes") : tr("no")));
Hbox hbox = new Hbox();
hbox.appendChild(Util.createEditButton(event -> goToEditForm(worker)));
@@ -1007,9 +1007,9 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
if (editWindow != null && state != CRUDControllerState.LIST) {
Worker worker = getWorker();
- String entityType = _("Worker");
+ String entityType = tr("Worker");
if (worker.isVirtual()) {
- entityType = _("Virtual Workers Group");
+ entityType = tr("Virtual Workers Group");
}
String humanId = worker.getHumanId();
@@ -1018,13 +1018,13 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
switch (state) {
case CREATE:
if (StringUtils.isEmpty(humanId))
- title = _("Create {0}", entityType);
+ title = tr("Create {0}", entityType);
else
- title = _("Create {0}: {1}", entityType, humanId);
+ title = tr("Create {0}: {1}", entityType, humanId);
break;
case EDIT:
- title = _("Edit {0}: {1}", entityType, humanId);
+ title = tr("Edit {0}: {1}", entityType, humanId);
break;
default:
@@ -1100,8 +1100,8 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
private int showConfirmUserEditionDialog() {
return Messagebox.show(
- _("Unsaved changes will be lost. Would you like to continue?"),
- _("Confirm editing user"), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
+ tr("Unsaved changes will be lost. Would you like to continue?"),
+ tr("Confirm editing user"), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
}
public boolean isNoRoleUserAccounts() {
@@ -1110,7 +1110,7 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
public String getUserEditionButtonTooltip() {
return isNoRoleUserAccounts()
- ? _("You do not have permissions to go to edit user window")
+ ? tr("You do not have permissions to go to edit user window")
: "";
}
@@ -1136,15 +1136,15 @@ public class WorkerCRUDController extends GenericForwardComposer implements IWor
Limits resourcesTypeLimit = limitsModel.getResourcesType();
if (isNullOrZeroValue(resourcesTypeLimit)) {
- return _("Create");
+ return tr("Create");
}
Integer resources = resourceDAO.getRowCount().intValue();
int resourcesLeft = resourcesTypeLimit.getValue() - resources;
return resources >= resourcesTypeLimit.getValue()
- ? _("Workers limit reached")
- : _("Create") + " ( " + resourcesLeft + " " + _("left") + " )";
+ ? tr("Workers limit reached")
+ : tr("Create") + " ( " + resourcesLeft + " " + tr("left") + " )";
}
private boolean isNullOrZeroValue (Limits resourcesTypeLimit) {
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/WorkerModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/WorkerModel.java
index 0aae70327..59865e011 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/WorkerModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/resources/worker/WorkerModel.java
@@ -21,7 +21,7 @@
package org.libreplan.web.resources.worker;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.Collection;
@@ -251,7 +251,7 @@ public class WorkerModel extends IntegrationEntityModel implements IWorkerModel
@Override
@Transactional(readOnly = true)
public void prepareEditFor(Worker worker) {
- Validate.notNull(worker, _("Worker must be not-null"));
+ Validate.notNull(worker, tr("Worker must be not-null"));
try {
this.worker = (Worker) resourceDAO.find(worker.getId());
forceLoadSatisfactions(this.worker);
@@ -425,7 +425,7 @@ public class WorkerModel extends IntegrationEntityModel implements IWorkerModel
ICriterionType> type) {
Validate.isTrue(type.isAllowSimultaneousCriterionsPerResource(),
- _("Please, allow Multiple Active Criteria in this type " +
+ tr("Please, allow Multiple Active Criteria in this type " +
"in order to use selected Assignment Strategy"));
this.criterionDAO = criterionDAO;
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/scenarios/ScenarioCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/scenarios/ScenarioCRUDController.java
index acc63d831..8f5175e27 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/scenarios/ScenarioCRUDController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/scenarios/ScenarioCRUDController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.scenarios;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.Collections;
import java.util.List;
@@ -126,7 +126,7 @@ public class ScenarioCRUDController extends BaseCRUDController {
Treecell operationsTreecell = new Treecell();
Button createDerivedButton = new Button();
- createDerivedButton.setTooltiptext(_("Create derived"));
+ createDerivedButton.setTooltiptext(tr("Create derived"));
createDerivedButton.setSclass("icono");
createDerivedButton.setImage("/common/img/ico_derived1.png");
createDerivedButton.setHoverImage("/common/img/ico_derived.png");
@@ -168,7 +168,7 @@ public class ScenarioCRUDController extends BaseCRUDController {
}
operationsTreecell.appendChild(removeButton);
- Button connectButton = new Button(_("Connect"));
+ Button connectButton = new Button(tr("Connect"));
connectButton.addEventListener(Events.ON_CLICK,
new EventListener() {
@@ -210,7 +210,7 @@ public class ScenarioCRUDController extends BaseCRUDController {
private void errorHappenedDoingReassignation(Exception exceptionHappened) {
LOG.error("error happened doing reassignation", exceptionHappened);
- messagesForUser.showMessage(Level.ERROR, _("error doing reassignment: {0}", exceptionHappened));
+ messagesForUser.showMessage(Level.ERROR, tr("error doing reassignment: {0}", exceptionHappened));
}
public Set getOrders() {
@@ -224,12 +224,12 @@ public class ScenarioCRUDController extends BaseCRUDController {
@Override
protected String getEntityType() {
- return _("Scenario");
+ return tr("Scenario");
}
@Override
protected String getPluralEntityType() {
- return _("Scenarios");
+ return tr("Scenarios");
}
@Override
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/scenarios/ScenarioModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/scenarios/ScenarioModel.java
index f8b2d9212..915d0e302 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/scenarios/ScenarioModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/scenarios/ScenarioModel.java
@@ -22,7 +22,7 @@
package org.libreplan.web.scenarios;
import static org.libreplan.business.common.exceptions.ValidationException.invalidValue;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.List;
import java.util.Set;
@@ -114,7 +114,7 @@ public class ScenarioModel implements IScenarioModel {
boolean isMainScenario = PredefinedScenarios.MASTER.getScenario().getId().equals(scenario.getId());
if (isMainScenario) {
throw new IllegalArgumentException(
- _("You cannot remove the default scenario \"{0}\"", PredefinedScenarios.MASTER.getName()));
+ tr("You cannot remove the default scenario \"{0}\"", PredefinedScenarios.MASTER.getName()));
}
Scenario currentScenario = scenarioManager.getCurrent();
@@ -122,13 +122,13 @@ public class ScenarioModel implements IScenarioModel {
scenario.getId());
if (isCurrentScenario) {
throw new IllegalArgumentException(
- _("You cannot remove the current scenario"));
+ tr("You cannot remove the current scenario"));
}
List derivedScenarios = getDerivedScenarios(scenario);
if (!derivedScenarios.isEmpty()) {
throw new IllegalArgumentException(
- _("You cannot remove a scenario with derived scenarios"));
+ tr("You cannot remove a scenario with derived scenarios"));
}
List users = userDAO.findByLastConnectedScenario(scenario);
@@ -216,8 +216,8 @@ public class ScenarioModel implements IScenarioModel {
@Transactional
public void confirmSave() throws ValidationException {
if (scenarioDAO.thereIsOtherWithSameName(scenario)) {
- throw new ValidationException(_("Could not save the scenario"),
- invalidValue(_("{0} already exists", scenario.getName()),
+ throw new ValidationException(tr("Could not save the scenario"),
+ invalidValue(tr("{0} already exists", scenario.getName()),
"name", scenario.getName(), scenario));
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/scenarios/TransferOrdersController.java b/libreplan-webapp/src/main/java/org/libreplan/web/scenarios/TransferOrdersController.java
index 4d0f4bb02..481a0b86e 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/scenarios/TransferOrdersController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/scenarios/TransferOrdersController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.scenarios;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.List;
import java.util.Set;
@@ -178,7 +178,7 @@ public class TransferOrdersController extends GenericForwardComposer {
}
private Button getTransferButton(final Order order) {
- Button transferButton = new Button(_("Transfer"));
+ Button transferButton = new Button(tr("Transfer"));
transferButton.addEventListener(Events.ON_CLICK,
new EventListener() {
@Override
@@ -187,7 +187,7 @@ public class TransferOrdersController extends GenericForwardComposer {
transferOrdersModel.transfer(order);
Util.reloadBindings(destinationScenarioOrders);
messagesForUser.showMessage(Level.INFO,
- _("Project {0} transfered", order
+ tr("Project {0} transfered", order
.getName()));
} catch (ValidationException e) {
messagesForUser.showInvalidValues(e);
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/scenarios/TransferOrdersModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/scenarios/TransferOrdersModel.java
index 8c6d45e2e..4425efbfc 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/scenarios/TransferOrdersModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/scenarios/TransferOrdersModel.java
@@ -21,7 +21,7 @@
package org.libreplan.web.scenarios;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.HashMap;
import java.util.HashSet;
@@ -141,16 +141,16 @@ public class TransferOrdersModel implements ITransferOrdersModel {
if (sourceScenario == null) {
throw new ValidationException(
- _("Please select a source scenario"));
+ tr("Please select a source scenario"));
}
if (destinationScenario == null) {
throw new ValidationException(
- _("Please, select a destination scenario"));
+ tr("Please, select a destination scenario"));
}
if (sourceScenario.getId().equals(destinationScenario.getId())) {
throw new ValidationException(
- _("Source and destination scenarios should be different"));
+ tr("Source and destination scenarios should be different"));
}
orderDAO.save(order);
@@ -167,7 +167,7 @@ public class TransferOrdersModel implements ITransferOrdersModel {
&& (sourceOrderVersion.getId().equals(destinationOrderVersion
.getId()))) {
throw new ValidationException(
- _("Project version is the same in source and destination scenarios"));
+ tr("Project version is the same in source and destination scenarios"));
}
order.useSchedulingDataFor(sourceOrderVersion);
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/CustomerCommunicationCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/CustomerCommunicationCRUDController.java
index 15e214eee..0d13f61a4 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/CustomerCommunicationCRUDController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/CustomerCommunicationCRUDController.java
@@ -40,7 +40,7 @@ import org.zkoss.zul.SimpleListModel;
import java.util.List;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Controller for CRUD actions over a {@link CustomerCommunication}.
@@ -193,7 +193,7 @@ public class CustomerCommunicationCRUDController extends GenericForwardComposer
buttonEdit.setSclass("icono");
buttonEdit.setImage("/common/img/ico_editar1.png");
buttonEdit.setHoverImage("/common/img/ico_editar.png");
- buttonEdit.setTooltiptext(_("Edit"));
+ buttonEdit.setTooltiptext(tr("Edit"));
buttonEdit.addEventListener(Events.ON_CLICK, arg0 -> goToEdit(customerCommunication));
row.appendChild(buttonEdit);
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/FilterCommunicationEnum.java b/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/FilterCommunicationEnum.java
index 713b15ee6..9892dd7fb 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/FilterCommunicationEnum.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/FilterCommunicationEnum.java
@@ -25,8 +25,8 @@ package org.libreplan.web.subcontract;
* @author Susana Montes Pedreira
*/
public enum FilterCommunicationEnum {
- ALL(_("All")),
- NOT_REVIEWED(_("Not Reviewed"));
+ ALL(tr("All")),
+ NOT_REVIEWED(tr("Not Reviewed"));
private String displayName;
@@ -37,7 +37,7 @@ public enum FilterCommunicationEnum {
/**
* Forces to mark the string as needing translation.
*/
- private static String _(String string) {
+ private static String tr(String string) {
return string;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/ReportAdvancesController.java b/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/ReportAdvancesController.java
index 7590db408..c026ae16c 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/ReportAdvancesController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/ReportAdvancesController.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.web.subcontract;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.io.IOException;
import java.util.List;
@@ -128,7 +128,7 @@ public class ReportAdvancesController extends GenericForwardComposer {
// append the status
String status = reportAdvancesModel.getStatus(order);
- appendLabel(row, _(status));
+ appendLabel(row, tr(status));
// append the operations
if ("Updated".equals(status)) {
@@ -190,12 +190,12 @@ public class ReportAdvancesController extends GenericForwardComposer {
}
private Button getSendButton(final Order order, boolean sendButtonDisabled) {
- Button sendButton = new Button(_("Send"));
+ Button sendButton = new Button(tr("Send"));
sendButton.setSclass("add-button");
sendButton.addEventListener(Events.ON_CLICK, event -> {
try {
reportAdvancesModel.sendAdvanceMeasurements(order);
- messagesForUser.showMessage(Level.INFO, _("Progress sent successfully"));
+ messagesForUser.showMessage(Level.INFO, tr("Progress sent successfully"));
} catch (UnrecoverableErrorServiceException e) {
messagesForUser.showMessage(Level.ERROR, e.getMessage());
} catch (ConnectionProblemsException e) {
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/ReportAdvancesModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/ReportAdvancesModel.java
index 1d51d74ec..fa83eb110 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/ReportAdvancesModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/ReportAdvancesModel.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.web.subcontract;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.io.StringWriter;
import java.util.ArrayList;
@@ -220,9 +220,9 @@ public class ReportAdvancesModel implements IReportAdvancesModel {
} catch (WebApplicationException e) {
LOG.error("Problems connecting with client web service", e);
- String message = _("Problems connecting with client web service");
+ String message = tr("Problems connecting with client web service");
if (e.getMessage() != null) {
- message += ". " + _("Error: {0}", e.getMessage());
+ message += ". " + tr("Error: {0}", e.getMessage());
}
throw new ConnectionProblemsException(message, e);
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/SubcontractedTasksController.java b/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/SubcontractedTasksController.java
index 291b2d383..1941fa4fe 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/SubcontractedTasksController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/SubcontractedTasksController.java
@@ -22,7 +22,7 @@
*/
package org.libreplan.web.subcontract;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.io.IOException;
import java.util.List;
@@ -123,7 +123,7 @@ public class SubcontractedTasksController extends GenericForwardComposer {
row.setTooltiptext(subcontractedTaskData.getWorkDescription());
appendLabel(row, Util.addCurrencySymbol(subcontractedTaskData.getSubcontractPrice()));
appendLabel(row, Util.formatDate(subcontractedTaskData.getLastRequiredDeliverDate()));
- appendLabel(row, _(toString(subcontractedTaskData.getState())));
+ appendLabel(row, tr(toString(subcontractedTaskData.getState())));
appendOperations(row, subcontractedTaskData);
}
@@ -199,13 +199,13 @@ public class SubcontractedTasksController extends GenericForwardComposer {
}
private Button getSendButton(final SubcontractedTaskData subcontractedTaskData) {
- Button sendButton = new Button(_("Send"));
+ Button sendButton = new Button(tr("Send"));
sendButton.setClass("add-button");
sendButton.addEventListener(Events.ON_CLICK, event -> {
try {
subcontractedTasksModel.sendToSubcontractor(subcontractedTaskData);
messagesForUser.showMessage(Level.INFO,
- _("Subcontracted task sent successfully"));
+ tr("Subcontracted task sent successfully"));
} catch (UnrecoverableErrorServiceException e) {
messagesForUser.showMessage(Level.ERROR, e.getMessage());
} catch (ConnectionProblemsException e) {
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/SubcontractedTasksModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/SubcontractedTasksModel.java
index 2669e7e95..61159ef52 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/SubcontractedTasksModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/SubcontractedTasksModel.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.web.subcontract;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.io.StringWriter;
import java.util.Collections;
@@ -235,9 +235,9 @@ public class SubcontractedTasksModel implements ISubcontractedTasksModel {
} catch (WebApplicationException e) {
LOG.error(CONNECTION_PROBLEM, e);
- String message = _(CONNECTION_PROBLEM);
+ String message = tr(CONNECTION_PROBLEM);
if ( e.getMessage() != null ) {
- message += ". " + _("Error: {0}", e.getMessage());
+ message += ". " + tr("Error: {0}", e.getMessage());
}
throw new ConnectionProblemsException(message, e);
@@ -272,9 +272,9 @@ public class SubcontractedTasksModel implements ISubcontractedTasksModel {
} catch (WebApplicationException e) {
LOG.error(CONNECTION_PROBLEM, e);
- String message = _(CONNECTION_PROBLEM);
+ String message = tr(CONNECTION_PROBLEM);
if ( e.getMessage() != null ) {
- message += ". " + _("Error: {0}", e.getMessage());
+ message += ". " + tr("Error: {0}", e.getMessage());
}
throw new ConnectionProblemsException(message, e);
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/SubcontractorCommunicationCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/SubcontractorCommunicationCRUDController.java
index 7a526650f..5ef427565 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/SubcontractorCommunicationCRUDController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/subcontract/SubcontractorCommunicationCRUDController.java
@@ -45,7 +45,7 @@ import org.zkoss.zul.SimpleListModel;
import java.util.List;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Controller for CRUD actions over a {@link SubcontractorCommunication}
@@ -229,7 +229,7 @@ public class SubcontractorCommunicationCRUDController extends GenericForwardComp
buttonEdit.setSclass("icono");
buttonEdit.setImage("/common/img/ico_editar1.png");
buttonEdit.setHoverImage("/common/img/ico_editar.png");
- buttonEdit.setTooltiptext(_("Edit"));
+ buttonEdit.setTooltiptext(tr("Edit"));
buttonEdit.addEventListener(Events.ON_CLICK, arg0 -> goToEdit(subcontractorCommunication));
row.appendChild(buttonEdit);
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/templates/OrderTemplatesController.java b/libreplan-webapp/src/main/java/org/libreplan/web/templates/OrderTemplatesController.java
index fa8a48651..862d0f5bb 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/templates/OrderTemplatesController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/templates/OrderTemplatesController.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.web.templates;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import static org.libreplan.web.planner.tabs.MultipleTabsPlannerController.BREADCRUMBS_SEPARATOR;
import java.util.List;
@@ -229,7 +229,7 @@ public class OrderTemplatesController extends GenericForwardComposer implements
if (isAllValid()) {
try {
model.confirmSave();
- messagesForUser.showMessage(Level.INFO, _("Template saved"));
+ messagesForUser.showMessage(Level.INFO, tr("Template saved"));
show(listWindow);
} catch (ValidationException e) {
messagesForUser.showInvalidValues(e);
@@ -247,7 +247,7 @@ public class OrderTemplatesController extends GenericForwardComposer implements
model.confirmSave();
model.initEdit(getTemplate());
bindTemplatesTreeWithModel();
- messagesForUser.showMessage(Level.INFO, _("Template saved"));
+ messagesForUser.showMessage(Level.INFO, tr("Template saved"));
} catch (ValidationException e) {
messagesForUser.showInvalidValues(e);
}
@@ -270,7 +270,7 @@ public class OrderTemplatesController extends GenericForwardComposer implements
if (model.getTemplate().isOrderTemplate()) {
OrderTemplate orderTemplate = (OrderTemplate) model.getTemplate();
if (orderTemplate.getCalendar() == null) {
- throw new WrongValueException(editWindow.getFellow("calendar"), _("calendar not specified"));
+ throw new WrongValueException(editWindow.getFellow("calendar"), tr("calendar not specified"));
}
}
@@ -289,7 +289,7 @@ public class OrderTemplatesController extends GenericForwardComposer implements
try {
model.validateTemplateName(name.getValue());
} catch (IllegalArgumentException e) {
- throw new WrongValueException(name, _(e.getMessage()));
+ throw new WrongValueException(name, tr(e.getMessage()));
}
}
@@ -301,9 +301,9 @@ public class OrderTemplatesController extends GenericForwardComposer implements
}
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
- breadcrumbs.appendChild(new Label(_("Planning")));
+ breadcrumbs.appendChild(new Label(tr("Planning")));
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
- breadcrumbs.appendChild(new Label(_("Templates")));
+ breadcrumbs.appendChild(new Label(tr("Templates")));
}
/**
@@ -354,7 +354,7 @@ public class OrderTemplatesController extends GenericForwardComposer implements
try {
model.validateTemplateName((String) value);
} catch (IllegalArgumentException e) {
- throw new WrongValueException(comp, _(e.getMessage()));
+ throw new WrongValueException(comp, tr(e.getMessage()));
}
};
}
@@ -366,7 +366,7 @@ public class OrderTemplatesController extends GenericForwardComposer implements
*/
public void confirmDelete(OrderElementTemplate template) {
if (Messagebox.show(
- _("Delete template. Are you sure?"), _("Confirm"),
+ tr("Delete template. Are you sure?"), tr("Confirm"),
Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION) == Messagebox.OK) {
if (this.model.hasNotApplications(template)) {
@@ -377,7 +377,7 @@ public class OrderTemplatesController extends GenericForwardComposer implements
Util.reloadBindings(gridOrderTemplates);
}
} else {
- messagesForUser.showMessage(Level.ERROR, _("Template cannot be removed because it has applications"));
+ messagesForUser.showMessage(Level.ERROR, tr("Template cannot be removed because it has applications"));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/templates/OrderTemplatesModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/templates/OrderTemplatesModel.java
index 1b3d99635..6b3e95ac9 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/templates/OrderTemplatesModel.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/templates/OrderTemplatesModel.java
@@ -21,7 +21,7 @@
package org.libreplan.web.templates;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.HashMap;
@@ -295,13 +295,13 @@ public class OrderTemplatesModel implements IOrderTemplatesModel {
@Transactional(readOnly = true)
public void validateTemplateName(String name) throws IllegalArgumentException {
if ((name == null) || (name.isEmpty())) {
- throw new IllegalArgumentException(_("name cannot be empty"));
+ throw new IllegalArgumentException(tr("name cannot be empty"));
}
getTemplate().setName(name);
if (!getTemplate().isUniqueRootTemplateNameConstraint()) {
- throw new IllegalArgumentException(_("Already exists another template with the same name"));
+ throw new IllegalArgumentException(tr("Already exists another template with the same name"));
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/templates/TemplatesTree.java b/libreplan-webapp/src/main/java/org/libreplan/web/templates/TemplatesTree.java
index bfc5a405f..38194e8aa 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/templates/TemplatesTree.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/templates/TemplatesTree.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.web.templates;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import org.libreplan.business.templates.entities.OrderElementTemplate;
import org.libreplan.business.templates.entities.OrderLineTemplate;
@@ -39,8 +39,8 @@ public class TemplatesTree extends EntitiesTree {
@Override
protected OrderElementTemplate createNewElement() {
OrderLineTemplate result = OrderLineTemplate.createNew();
- result.setName(_("New template"));
- result.setDescription(_("New Description"));
+ result.setName(tr("New template"));
+ result.setDescription(tr("New Description"));
return result;
}
@@ -48,7 +48,7 @@ public class TemplatesTree extends EntitiesTree {
protected OrderElementTemplate createNewElement(String name, int hours) {
OrderLineTemplate result = OrderLineTemplate.createNew();
result.setName(name);
- result.setDescription(_("New Description"));
+ result.setDescription(tr("New Description"));
result.setWorkHours(hours);
return result;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/templates/TemplatesTreeComponent.java b/libreplan-webapp/src/main/java/org/libreplan/web/templates/TemplatesTreeComponent.java
index ccb4ea1bc..c380b63f3 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/templates/TemplatesTreeComponent.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/templates/TemplatesTreeComponent.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.web.templates;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.List;
@@ -57,7 +57,7 @@ public class TemplatesTreeComponent extends TreeComponent {
}
public String getAddElementLabel() {
- return _("New Template element");
+ return tr("New Template element");
}
public boolean isCreateTemplateEnabled() {
@@ -65,7 +65,7 @@ public class TemplatesTreeComponent extends TreeComponent {
}
public String getRemoveElementLabel() {
- return _("Delete Template element");
+ return tr("Delete Template element");
}
@Override
@@ -75,28 +75,28 @@ public class TemplatesTreeComponent extends TreeComponent {
result.add(schedulingStateColumn);
result.add(nameAndDescriptionColumn);
- result.add(new TemplatesTreeColumn(_("Hours"), "hours") {
+ result.add(new TemplatesTreeColumn(tr("Hours"), "hours") {
@Override
protected void doCell(TemplatesTreeRenderer renderer, Treeitem item, OrderElementTemplate currentElement) {
renderer.addHoursCell(currentElement);
}
});
- result.add(new TemplatesTreeColumn(_("Budget"), "budget") {
+ result.add(new TemplatesTreeColumn(tr("Budget"), "budget") {
@Override
protected void doCell(TemplatesTreeRenderer renderer, Treeitem item, OrderElementTemplate currentElement) {
renderer.addBudgetCell(currentElement);
}
});
- result.add(new TemplatesTreeColumn(_("Must start after (days since project start)"), "estimated_init") {
+ result.add(new TemplatesTreeColumn(tr("Must start after (days since project start)"), "estimated_init") {
@Override
protected void doCell(TemplatesTreeRenderer renderer, Treeitem item, OrderElementTemplate currentElement) {
renderer.addInitCell(currentElement);
}
});
- result.add(new TemplatesTreeColumn(_("Deadline (days since project start)"), "estimated_end") {
+ result.add(new TemplatesTreeColumn(tr("Deadline (days since project start)"), "estimated_end") {
@Override
protected void doCell(TemplatesTreeRenderer renderer, Treeitem item, OrderElementTemplate currentElement) {
renderer.addEndCell(currentElement);
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/templates/TemplatesTreeController.java b/libreplan-webapp/src/main/java/org/libreplan/web/templates/TemplatesTreeController.java
index c6ba1e249..af699c1f6 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/templates/TemplatesTreeController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/templates/TemplatesTreeController.java
@@ -35,7 +35,7 @@ import org.zkoss.zul.Treeitem;
import java.math.BigDecimal;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Controller for template element tree
@@ -66,7 +66,7 @@ public class TemplatesTreeController extends TreeController {
@@ -86,7 +86,7 @@ public class TemplatesTreeController extends TreeController element.getName(),
value -> element.setName(value));
- textBox.setConstraint("no empty:" + _("cannot be empty"));
+ textBox.setConstraint("no empty:" + tr("cannot be empty"));
addCell(textBox);
putNameTextbox(element, textBox);
}
@@ -191,7 +191,7 @@ public class TemplatesTreeController extends TreeController
@@ -141,8 +141,8 @@ public class OrderElementHistoricalAssignmentComponent extends HtmlMacroComponen
globalView.goToOrderElementDetails(order, orderElement);
} else {
Messagebox
- .show(_("Not enough permissions to edit this project"),
- _("Warning"), Messagebox.OK,
+ .show(tr("Not enough permissions to edit this project"),
+ tr("Warning"), Messagebox.OK,
Messagebox.EXCLAMATION);
}
} else {
@@ -150,9 +150,9 @@ public class OrderElementHistoricalAssignmentComponent extends HtmlMacroComponen
for (Scenario scene : getScenarios(order)) {
scenarios = scenarios.concat(scene.getName() + "\n");
}
- Messagebox.show(_("The planning of this task is not in the current scenenario.\n" +
+ Messagebox.show(tr("The planning of this task is not in the current scenenario.\n" +
"You should change to any of the following scenarios: {0}", scenarios),
- _("Information"), Messagebox.OK, Messagebox.INFORMATION);
+ tr("Information"), Messagebox.OK, Messagebox.INFORMATION);
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/tree/TreeComponent.java b/libreplan-webapp/src/main/java/org/libreplan/web/tree/TreeComponent.java
index a8350a5ae..1ebfa3788 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/tree/TreeComponent.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/tree/TreeComponent.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.web.tree;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.List;
@@ -41,21 +41,21 @@ public abstract class TreeComponent extends HtmlMacroComponent {
private static final String CONTROLLER_NAME = "treeController";
- protected Column codeColumn = new Column(_("Code"), "code") {
+ protected Column codeColumn = new Column(tr("Code"), "code") {
@Override
public > void doCell(TreeController.Renderer renderer, Treeitem item, T currentElement) {
renderer.addCodeCell(currentElement);
}
};
- protected final Column nameAndDescriptionColumn = new Column(_("Name"), "name") {
+ protected final Column nameAndDescriptionColumn = new Column(tr("Name"), "name") {
@Override
public > void doCell(TreeController.Renderer renderer, Treeitem item, T currentElement) {
renderer.addDescriptionCell(currentElement);
}
};
- protected final Column operationsColumn = new Column(_("Op."), "operations", _("Operations")) {
+ protected final Column operationsColumn = new Column(tr("Op."), "operations", tr("Operations")) {
@Override
public > void doCell(TreeController.Renderer renderer, Treeitem item, T currentElement) {
renderer.addOperationsCell(item, currentElement);
@@ -63,9 +63,9 @@ public abstract class TreeComponent extends HtmlMacroComponent {
};
protected final Column schedulingStateColumn = new Column(
- _("Scheduling state"),
+ tr("Scheduling state"),
"scheduling_state",
- _("Fully, Partially or Unscheduled. (Drag and drop to move tasks)")) {
+ tr("Fully, Partially or Unscheduled. (Drag and drop to move tasks)")) {
@Override
public > void doCell(TreeController.Renderer renderer, Treeitem item, T currentElement) {
@@ -157,7 +157,7 @@ public abstract class TreeComponent extends HtmlMacroComponent {
}
public String getAddElementLabel() {
- return _("Add");
+ return tr("Add");
}
public boolean isCreateTemplateEnabled() {
@@ -169,6 +169,6 @@ public abstract class TreeComponent extends HtmlMacroComponent {
}
public String getRemoveElementLabel() {
- return _("Delete task");
+ return tr("Delete task");
}
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/tree/TreeController.java b/libreplan-webapp/src/main/java/org/libreplan/web/tree/TreeController.java
index 7640a01e4..296912429 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/tree/TreeController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/tree/TreeController.java
@@ -20,7 +20,7 @@
*/
package org.libreplan.web.tree;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.math.BigDecimal;
import java.util.ArrayList;
@@ -292,7 +292,7 @@ public abstract class TreeController> extends GenericForw
Intbox hours = (Intbox) cmp.getFellow("newOrderElementHours");
if (StringUtils.isEmpty(name.getValue())) {
- throw new WrongValueException(name, _("cannot be empty"));
+ throw new WrongValueException(name, tr("cannot be empty"));
}
if (hours.getValue() == null) {
@@ -774,7 +774,7 @@ public abstract class TreeController> extends GenericForw
protected void checkInvalidValues(String property, Integer value, final Intbox component) {
Set> violations = validator.validateValue(type, property, value);
if (!violations.isEmpty()) {
- throw new WrongValueException(component, _(violations.iterator().next().getMessage()));
+ throw new WrongValueException(component, tr(violations.iterator().next().getMessage()));
}
}
@@ -1010,11 +1010,11 @@ public abstract class TreeController> extends GenericForw
return (comp, value) -> {
if (value == null) {
- throw new WrongValueException(comp, _("cannot be empty"));
+ throw new WrongValueException(comp, tr("cannot be empty"));
}
if (((BigDecimal) value).compareTo(BigDecimal.ZERO) < 0) {
- throw new WrongValueException(comp, _("cannot be negative"));
+ throw new WrongValueException(comp, tr("cannot be negative"));
}
};
}
@@ -1035,7 +1035,7 @@ public abstract class TreeController> extends GenericForw
if (!readOnly && element.isLeaf()) {
if (getHoursGroupHandler().hasMoreThanOneHoursGroup(element)) {
boxHours.setReadonly(true);
- tc.setTooltiptext(_("Disabled because of it contains more than one hours group"));
+ tc.setTooltiptext(tr("Disabled because of it contains more than one hours group"));
} else {
boxHours.setReadonly(false);
tc.setTooltiptext("");
@@ -1140,7 +1140,7 @@ public abstract class TreeController> extends GenericForw
if (!getHoursGroupHandler().isTotalHoursValid(line, ((Integer) value))) {
throw new WrongValueException(
comp,
- _("Value is not valid in current list of Hours Group"));
+ tr("Value is not valid in current list of Hours Group"));
}
};
}
@@ -1160,7 +1160,7 @@ public abstract class TreeController> extends GenericForw
if (readOnly) {
result = createButton(
"/common/img/ico_borrar_out.png",
- _("Delete"),
+ tr("Delete"),
"/common/img/ico_borrar_out.png",
"icono",
removeListener);
@@ -1169,7 +1169,7 @@ public abstract class TreeController> extends GenericForw
} else {
result = createButton(
"/common/img/ico_borrar1.png",
- _("Delete"),
+ tr("Delete"),
"/common/img/ico_borrar.png",
"icono",
removeListener);
@@ -1296,7 +1296,7 @@ public abstract class TreeController> extends GenericForw
// Check if marked label has been previously added
if (!(tc.getLastChild() instanceof org.zkoss.zul.Label)) {
org.zkoss.zul.Label modifiedMark = new org.zkoss.zul.Label("*");
- modifiedMark.setTooltiptext(_("Modified"));
+ modifiedMark.setTooltiptext(tr("Modified"));
modifiedMark.setSclass("modified-mark");
tc.appendChild(modifiedMark);
cellsMarkedAsModified.add(tc);
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/users/OrderAuthorizationController.java b/libreplan-webapp/src/main/java/org/libreplan/web/users/OrderAuthorizationController.java
index 2b285d290..ed9bc0cfb 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/users/OrderAuthorizationController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/users/OrderAuthorizationController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.users;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.List;
@@ -90,7 +90,7 @@ public class OrderAuthorizationController extends GenericForwardComposer{
if(comboItem != null) {
if(!readAuthorization && !writeAuthorization) {
messagesForUser.showMessage(Level.WARNING,
- _("No authorizations were added because you did not select any."));
+ tr("No authorizations were added because you did not select any."));
return;
}
List authorizations = new ArrayList<>();
@@ -105,7 +105,7 @@ public class OrderAuthorizationController extends GenericForwardComposer{
orderAuthorizationModel.addUserOrderAuthorization(comboItem.getValue(), authorizations);
if(result != null && result.size()==authorizations.size()) {
messagesForUser.showMessage(Level.WARNING,
- _("Could not add those authorizations to user {0} " +
+ tr("Could not add those authorizations to user {0} " +
"because they were already present.",
((User)comboItem.getValue()).getLoginName()));
}
@@ -115,7 +115,7 @@ public class OrderAuthorizationController extends GenericForwardComposer{
orderAuthorizationModel.addProfileOrderAuthorization(comboItem.getValue(), authorizations);
if(result != null && result.size()==authorizations.size()) {
messagesForUser.showMessage(Level.WARNING,
- _("Could not add those authorizations to profile {0} " +
+ tr("Could not add those authorizations to profile {0} " +
"because they were already present.",
((Profile)comboItem.getValue()).getProfileName()));
}
@@ -138,7 +138,7 @@ public class OrderAuthorizationController extends GenericForwardComposer{
final ProfileOrderAuthorization profileOrderAuthorization = (ProfileOrderAuthorization) data;
row.appendChild(new Label(profileOrderAuthorization.getProfile().getProfileName()));
- row.appendChild(new Label(_(profileOrderAuthorization.getAuthorizationType().getDisplayName())));
+ row.appendChild(new Label(tr(profileOrderAuthorization.getAuthorizationType().getDisplayName())));
row.appendChild(Util.createRemoveButton(event -> removeOrderAuthorization(profileOrderAuthorization)));
};
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/users/ProfileCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/users/ProfileCRUDController.java
index 2d4b080bd..246fe1baa 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/users/ProfileCRUDController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/users/ProfileCRUDController.java
@@ -42,7 +42,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
/**
* Controller for CRUD actions over a {@link Profile}.
@@ -80,7 +80,7 @@ public class ProfileCRUDController extends BaseCRUDController {
roles.remove(UserRole.ROLE_BOUND_USER);
for (UserRole role : roles) {
- Comboitem item = combo.appendItem(_(role.getDisplayName()));
+ Comboitem item = combo.appendItem(tr(role.getDisplayName()));
item.setValue(role);
}
}
@@ -120,12 +120,12 @@ public class ProfileCRUDController extends BaseCRUDController {
@Override
protected String getEntityType() {
- return _("Profile");
+ return tr("Profile");
}
@Override
protected String getPluralEntityType() {
- return _("Profiles");
+ return tr("Profiles");
}
@Override
@@ -155,7 +155,7 @@ public class ProfileCRUDController extends BaseCRUDController {
}
private void showCannotDeleteProfileDialog(String message) {
- Messagebox.show(_(message), _("Warning"), Messagebox.OK, Messagebox.EXCLAMATION);
+ Messagebox.show(tr(message), tr("Warning"), Messagebox.OK, Messagebox.EXCLAMATION);
}
@Override
protected boolean beforeDeleting(Profile profile){
@@ -173,7 +173,7 @@ public class ProfileCRUDController extends BaseCRUDController {
public void render(Row row, Object data, int i) throws Exception {
final UserRole role = (UserRole) data;
- row.appendChild(new Label(_(role.getDisplayName())));
+ row.appendChild(new Label(tr(role.getDisplayName())));
row.appendChild(Util.createRemoveButton(new EventListener() {
@Override
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/users/UserCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/users/UserCRUDController.java
index 5aa615da0..22acfc7c5 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/users/UserCRUDController.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/users/UserCRUDController.java
@@ -21,7 +21,7 @@
package org.libreplan.web.users;
-import static org.libreplan.web.I18nHelper._;
+import static org.libreplan.web.I18nHelper.tr;
import java.util.ArrayList;
import java.util.Arrays;
@@ -95,9 +95,9 @@ public class UserCRUDController extends BaseCRUDController implements IUse
row.setValue(user);
Util.appendLabel(row, user.getLoginName());
- Util.appendLabel(row, user.isDisabled() ? _("Yes") : _("No"));
- Util.appendLabel(row, user.isSuperuser() ? _("Yes") : _("No"));
- Util.appendLabel(row, _(user.getUserType().toString()));
+ Util.appendLabel(row, user.isDisabled() ? tr("Yes") : tr("No"));
+ Util.appendLabel(row, user.isSuperuser() ? tr("Yes") : tr("No"));
+ Util.appendLabel(row, tr(user.getUserType().toString()));
Util.appendLabel(row, user.isBound() ? user.getWorker().getShortDescription() : "");
Button[] buttons =
@@ -106,7 +106,7 @@ public class UserCRUDController extends BaseCRUDController implements IUse
// Disable remove button for default admin as it's mandatory
if ( isDefaultAdmin(user) ) {
buttons[1].setDisabled(true);
- buttons[1].setTooltiptext(_("Default user \"admin\" cannot be removed as it is mandatory"));
+ buttons[1].setTooltiptext(tr("Default user \"admin\" cannot be removed as it is mandatory"));
}
};
@@ -159,10 +159,10 @@ public class UserCRUDController extends BaseCRUDController implements IUse
roles.remove(UserRole.ROLE_BOUND_USER);
// Sorting by ASC
- Collections.sort(roles, (arg0, arg1) -> _(arg0.getDisplayName()).compareTo(_(arg1.getDisplayName())));
+ Collections.sort(roles, (arg0, arg1) -> tr(arg0.getDisplayName()).compareTo(tr(arg1.getDisplayName())));
for (UserRole role : roles) {
- Comboitem item = combo.appendItem(_(role.getDisplayName()));
+ Comboitem item = combo.appendItem(tr(role.getDisplayName()));
item.setValue(role);
}
}
@@ -237,10 +237,10 @@ public class UserCRUDController extends BaseCRUDController implements IUse
roles.removeAll(userRoles);
// Sorting by ASC
- Collections.sort(roles, (arg0, arg1) -> _(arg0.getDisplayName()).compareTo(_(arg1.getDisplayName())));
+ Collections.sort(roles, (arg0, arg1) -> tr(arg0.getDisplayName()).compareTo(tr(arg1.getDisplayName())));
for (UserRole role : roles) {
- Comboitem item = combo.appendItem(_(role.getDisplayName()));
+ Comboitem item = combo.appendItem(tr(role.getDisplayName()));
item.setValue(role);
}
}
@@ -283,19 +283,19 @@ public class UserCRUDController extends BaseCRUDController implements IUse
((Textbox) comp).setRawValue(value);
if (!value.equals(passwordBox.getValue())) {
- throw new WrongValueException(comp, _("passwords don't match"));
+ throw new WrongValueException(comp, tr("passwords don't match"));
}
};
}
@Override
protected String getEntityType() {
- return _("User");
+ return tr("User");
}
@Override
protected String getPluralEntityType() {
- return _("Users");
+ return tr("Users");
}
@Override
@@ -303,7 +303,7 @@ public class UserCRUDController extends BaseCRUDController implements IUse
userModel.initCreate();
// Password is compulsory when creating
- passwordBox.setConstraint("no empty:" + _("Password cannot be empty"));
+ passwordBox.setConstraint("no empty:" + tr("Password cannot be empty"));
// Clean the password boxes, they are not cleared automatically because they are not directly associated to an attribute
passwordBox.setRawValue("");
@@ -331,7 +331,7 @@ public class UserCRUDController extends BaseCRUDController implements IUse
Combobox combo = (Combobox) editWindow.getFellowIfAny("authenticationTypeCombo");
combo.getChildren().clear();
for (UserAuthenticationType type : UserAuthenticationType.values()) {
- Comboitem item = combo.appendItem(_(type.toString()));
+ Comboitem item = combo.appendItem(tr(type.toString()));
item.setValue(type);
if (type.equals(getAuthenticationType())) {
combo.setSelectedItem(item);
@@ -352,9 +352,9 @@ public class UserCRUDController extends BaseCRUDController implements IUse
Worker worker = user.getWorker();
return worker == null ||
- Messagebox.show(_("User is bound to resource \"{0}\" and it will be unbound. " +
+ Messagebox.show(tr("User is bound to resource \"{0}\" and it will be unbound. " +
"Do you want to continue with user removal?", worker.getShortDescription()),
- _("Confirm remove user"), Messagebox.YES | Messagebox.NO, Messagebox.QUESTION) == Messagebox.YES;
+ tr("Confirm remove user"), Messagebox.YES | Messagebox.NO, Messagebox.QUESTION) == Messagebox.YES;
}
@Override
@@ -379,7 +379,7 @@ public class UserCRUDController extends BaseCRUDController implements IUse
return (row, data, i) -> {
final UserRole role = (UserRole) data;
- row.appendChild(new Label(_(role.getDisplayName())));
+ row.appendChild(new Label(tr(role.getDisplayName())));
Button removeButton = Util.createRemoveButton(event -> removeRole(role));
@@ -396,7 +396,7 @@ public class UserCRUDController extends BaseCRUDController implements IUse
public String hasBoundResource() {
User user = getUser();
- return user != null && user.isBound() ? _("Yes") : _("No");
+ return user != null && user.isBound() ? tr("Yes") : tr("No");
}
public String getBoundResource() {
@@ -418,8 +418,8 @@ public class UserCRUDController extends BaseCRUDController implements IUse
}
private int showConfirmWorkerEditionDialog() {
- return Messagebox.show(_("Unsaved changes will be lost. Would you like to continue?"),
- _("Confirm edit worker"), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
+ return Messagebox.show(tr("Unsaved changes will be lost. Would you like to continue?"),
+ tr("Confirm edit worker"), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
}
public void unboundResource() {
@@ -432,7 +432,7 @@ public class UserCRUDController extends BaseCRUDController implements IUse
}
public String getWorkerEditionButtonTooltip() {
- return isNoRoleWorkers() ? _("You do not have permissions to go to edit worker window") : "";
+ return isNoRoleWorkers() ? tr("You do not have permissions to go to edit worker window") : "";
}
private boolean isDefaultAdmin(final User user) {
@@ -459,7 +459,7 @@ public class UserCRUDController extends BaseCRUDController