i18n: Get week days translation automatically from Java libraries
FEA: ItEr76S04BugFixing
This commit is contained in:
parent
8f91954b15
commit
e35e3319d3
2 changed files with 25 additions and 17 deletions
|
|
@ -23,6 +23,8 @@ package org.libreplan.business.calendars.entities;
|
|||
|
||||
import static org.libreplan.business.workingday.EffortDuration.hours;
|
||||
|
||||
import java.text.DateFormatSymbols;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
|
|
@ -96,25 +98,26 @@ public class CalendarData extends IntegrationEntity {
|
|||
private BaseCalendar parent;
|
||||
|
||||
public enum Days {
|
||||
MONDAY(_("Monday")), TUESDAY(_("Tuesday")), WEDNESDAY(_("Wednesday")), THURSDAY(
|
||||
_("Thursday")), FRIDAY(_("Friday")), SATURDAY(_("Saturday")), SUNDAY(
|
||||
_("Sunday"));
|
||||
MONDAY(Calendar.MONDAY),
|
||||
TUESDAY(Calendar.TUESDAY),
|
||||
WEDNESDAY(Calendar.WEDNESDAY),
|
||||
THURSDAY(Calendar.THURSDAY),
|
||||
FRIDAY(Calendar.FRIDAY),
|
||||
SATURDAY(Calendar.SATURDAY),
|
||||
SUNDAY(Calendar.SUNDAY);
|
||||
|
||||
private int index;
|
||||
|
||||
private Days(int index) {
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Forces to mark the string as needing translation
|
||||
* This is used to get the week day translated via
|
||||
* {@link DateFormatSymbols#getWeekdays()}
|
||||
*/
|
||||
private static String _(String string) {
|
||||
return string;
|
||||
}
|
||||
|
||||
private String name;
|
||||
|
||||
private Days(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ package org.libreplan.web.calendars;
|
|||
import static org.libreplan.web.I18nHelper._;
|
||||
import static org.libreplan.web.common.Util.findOrCreate;
|
||||
|
||||
import java.text.DateFormatSymbols;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
|
@ -58,6 +59,7 @@ import org.libreplan.web.common.Util.ICreation;
|
|||
import org.libreplan.web.common.Util.Setter;
|
||||
import org.libreplan.web.common.components.CapacityPicker;
|
||||
import org.libreplan.web.common.components.EffortDurationPicker;
|
||||
import org.zkoss.util.Locales;
|
||||
import org.zkoss.zk.au.out.AuInvoke;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.WrongValueException;
|
||||
|
|
@ -410,8 +412,11 @@ public abstract class BaseCalendarEditionController extends
|
|||
}
|
||||
|
||||
private void addLabelCell(Listitem item, final Days day) {
|
||||
String days[] = DateFormatSymbols.getInstance(Locales.getCurrent())
|
||||
.getWeekdays();
|
||||
|
||||
Listcell labelListcell = new Listcell();
|
||||
labelListcell.appendChild(new Label(_(day.getName())));
|
||||
labelListcell.appendChild(new Label(days[day.getIndex()]));
|
||||
item.appendChild(labelListcell);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue