Use browser language in UI (#788)

* set language according to browser

Signed-off-by: Stefan Klotz <stefan.klotz@bosch-si.com>

* fix unlocalized ui texts

Signed-off-by: Stefan Klotz <stefan.klotz@bosch-si.com>

* add constants for localization strings

Signed-off-by: Stefan Klotz <stefan.klotz@bosch-si.com>

* fix typo

Signed-off-by: Stefan Klotz <stefan.klotz@bosch-si.com>

* fix typo

Signed-off-by: Stefan Klotz <stefan.klotz@bosch-si.com>

* change configuration captions in ui

Signed-off-by: Stefan Klotz <stefan.klotz@bosch-si.com>

* explain localization determination

Signed-off-by: Stefan Klotz <stefan.klotz@bosch-si.com>

* make english the fallback language

Signed-off-by: Stefan Klotz <stefan.klotz@bosch-si.com>

* rename variables

Signed-off-by: Stefan Klotz <stefan.klotz@bosch-si.com>
This commit is contained in:
Stefan Klotz
2019-02-13 14:18:30 +01:00
committed by Dominic Schabel
parent 9946efc2af
commit caca308f47
16 changed files with 120 additions and 103 deletions

View File

@@ -8,11 +8,6 @@
*/
package org.eclipse.hawkbit.ui;
import java.util.List;
import java.util.Locale;
import javax.servlet.http.Cookie;
import org.eclipse.hawkbit.ui.components.HawkbitUIErrorHandler;
import org.eclipse.hawkbit.ui.components.NotificationUnreadButton;
import org.eclipse.hawkbit.ui.menu.DashboardEvent.PostViewChangeEvent;
@@ -21,7 +16,6 @@ import org.eclipse.hawkbit.ui.menu.DashboardMenuItem;
import org.eclipse.hawkbit.ui.push.EventPushStrategy;
import org.eclipse.hawkbit.ui.themes.HawkbitTheme;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,7 +33,6 @@ import com.vaadin.navigator.ViewProvider;
import com.vaadin.server.ClientConnector.DetachListener;
import com.vaadin.server.Responsive;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinService;
import com.vaadin.spring.navigator.SpringViewProvider;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Component;
@@ -122,6 +115,8 @@ public abstract class AbstractHawkbitUI extends UI implements DetachListener {
final HorizontalLayout rootLayout = new HorizontalLayout();
rootLayout.setSizeFull();
setLocale(HawkbitCommonUtil.getLocaleToBeUsed(uiProperties.getLocalization(), getUI()));
dashboardMenu.init();
dashboardMenu.setResponsive(true);
@@ -166,16 +161,12 @@ public abstract class AbstractHawkbitUI extends UI implements DetachListener {
navigator.addProvider(new ManagementViewProvider());
setNavigator(navigator);
navigator.addView(EMPTY_VIEW, new Navigator.EmptyView());
// set locale is required for I18N class also, to get the locale from
// cookie
final String locale = getLocaleId(uiProperties.getLocalization().getAvailableLocals());
setLocale(new Locale(locale));
if (UI.getCurrent().getErrorHandler() == null) {
UI.getCurrent().setErrorHandler(new HawkbitUIErrorHandler());
}
LOG.info("Current locale of the application is : {}", HawkbitCommonUtil.getLocale());
LOG.info("Current locale of the application is : {}", getLocale());
}
private Panel buildContent() {
@@ -206,50 +197,6 @@ public abstract class AbstractHawkbitUI extends UI implements DetachListener {
return cssLayout;
}
/**
* Get Specific Locale.
*
* @param availableLocalesInApp
* as set
* @return String as preferred locale
*/
private String getLocaleId(final List<String> availableLocalesInApp) {
final String[] localeChain = getLocaleChain();
String spLocale = uiProperties.getLocalization().getDefaultLocal();
if (null != localeChain) {
// Find best matching locale
for (final String localeId : localeChain) {
if (availableLocalesInApp.contains(localeId)) {
spLocale = localeId;
break;
}
}
}
return spLocale;
}
/**
* Get Locale for i18n.
*
* @return String as locales
*/
private static String[] getLocaleChain() {
String[] localeChain = null;
// Fetch all cookies from the request
final Cookie[] cookies = VaadinService.getCurrentRequest().getCookies();
if (cookies == null) {
return localeChain;
}
for (final Cookie c : cookies) {
if (c.getName().equals(SPUIDefinitions.COOKIE_NAME) && !c.getValue().isEmpty()) {
localeChain = c.getValue().split("#");
break;
}
}
return localeChain;
}
private class ManagementViewProvider implements ViewProvider {
private static final long serialVersionUID = 1L;
@@ -274,7 +221,5 @@ public abstract class AbstractHawkbitUI extends UI implements DetachListener {
}
return viewName;
}
}
}

View File

@@ -297,8 +297,8 @@ public class ArtifactDetailsLayout extends VerticalLayout {
private void setTableColumnDetails(final Table table) {
table.setColumnHeader(PROVIDED_FILE_NAME, i18n.getMessage("upload.file.name"));
table.setColumnHeader(SIZE, i18n.getMessage("upload.size"));
table.setColumnHeader(PROVIDED_FILE_NAME, i18n.getMessage(UIMessageIdProvider.CAPTION_ARTIFACT_FILENAME));
table.setColumnHeader(SIZE, i18n.getMessage(UIMessageIdProvider.CAPTION_ARTIFACT_FILESIZE_BYTES));
if (fullWindowMode) {
table.setColumnHeader(SHA1HASH, i18n.getMessage("upload.sha1"));
table.setColumnHeader(MD5HASH, i18n.getMessage("upload.md5"));

View File

@@ -32,6 +32,7 @@ import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
@@ -228,8 +229,9 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
.caption(i18n.getMessage("textfield.description")).style("text-area-style")
.id(UIComponentIdProvider.ADD_SW_MODULE_DESCRIPTION).buildTextComponent();
typeComboBox = SPUIComponentProvider.getComboBox(i18n.getMessage("upload.swmodule.type"), "", null, null, true,
null, i18n.getMessage("upload.swmodule.type"));
typeComboBox = SPUIComponentProvider.getComboBox(
i18n.getMessage(UIMessageIdProvider.CAPTION_ARTIFACT_SOFTWARE_MODULE_TYPE), "", null, null, true, null,
i18n.getMessage(UIMessageIdProvider.CAPTION_ARTIFACT_SOFTWARE_MODULE_TYPE));
typeComboBox.setId(UIComponentIdProvider.SW_MODULE_TYPE);
typeComboBox.setStyleName(SPUIDefinitions.COMBO_BOX_SPECIFIC_STYLE + " " + ValoTheme.COMBOBOX_TINY);
typeComboBox.setNewItemsAllowed(Boolean.FALSE);
@@ -304,7 +306,8 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
versionTextField.setValue(swModule.getVersion());
vendorTextField.setValue(swModule.getVendor());
descTextArea.setValue(swModule.getDescription());
softwareModuleType = new LabelBuilder().name(swModule.getType().getName()).caption("Type").buildLabel();
softwareModuleType = new LabelBuilder().name(swModule.getType().getName())
.caption(i18n.getMessage(UIMessageIdProvider.CAPTION_ARTIFACT_SOFTWARE_MODULE_TYPE)).buildLabel();
});
}

View File

@@ -13,9 +13,9 @@ import org.eclipse.hawkbit.ui.artifacts.upload.FileUploadProgress.FileUploadStat
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleNoBorder;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.springframework.util.StringUtils;
import org.vaadin.spring.events.EventBus.UIEventBus;
@@ -48,18 +48,14 @@ public class UploadProgressInfoWindow extends Window {
private static final long serialVersionUID = 1L;
private static final String COLUMN_PROGRESS = "Progress";
private static final String COLUMN_FILE_NAME = "File name";
private static final String COLUMN_STATUS = "Status";
private static final String COLUMN_REASON = "Reason";
private static final String COLUMN_PROGRESS = UIMessageIdProvider.CAPTION_ARTIFACT_UPLOAD_PROGRESS;
private static final String COLUMN_FILE_NAME = UIMessageIdProvider.CAPTION_ARTIFACT_FILENAME;
private static final String COLUMN_STATUS = UIMessageIdProvider.CAPTION_ARTIFACT_UPLOAD_STATUS;
private static final String COLUMN_REASON = UIMessageIdProvider.CAPTION_ARTIFACT_UPLOAD_REASON;
private static final String COLUMN_SOFTWARE_MODULE = UIMessageIdProvider.CAPTION_SOFTWARE_MODULE;
private static final String STATUS_INPROGRESS = "InProgress";
private static final String STATUS_FINISHED = "Finished";
private static final String STATUS_FAILED = "Failed";
private final ArtifactUploadState artifactUploadState;
@@ -157,11 +153,14 @@ public class UploadProgressInfoWindow extends Window {
private void setGridColumnProperties() {
grid.getColumn(COLUMN_STATUS).setRenderer(new StatusRenderer());
grid.getColumn(COLUMN_PROGRESS).setRenderer(new ProgressBarRenderer());
grid.setColumnOrder(COLUMN_STATUS, COLUMN_PROGRESS, COLUMN_FILE_NAME, SPUILabelDefinitions.NAME_VERSION,
grid.setColumnOrder(COLUMN_STATUS, COLUMN_PROGRESS, COLUMN_FILE_NAME, COLUMN_SOFTWARE_MODULE,
COLUMN_REASON);
setColumnWidth();
grid.getColumn(SPUILabelDefinitions.NAME_VERSION)
.setHeaderCaption(i18n.getMessage("upload.swModuleTable.header"));
grid.getColumn(COLUMN_STATUS).setHeaderCaption(i18n.getMessage(COLUMN_STATUS));
grid.getColumn(COLUMN_PROGRESS).setHeaderCaption(i18n.getMessage(COLUMN_PROGRESS));
grid.getColumn(COLUMN_FILE_NAME).setHeaderCaption(i18n.getMessage(COLUMN_FILE_NAME));
grid.getColumn(COLUMN_SOFTWARE_MODULE).setHeaderCaption(i18n.getMessage(COLUMN_SOFTWARE_MODULE));
grid.getColumn(COLUMN_REASON).setHeaderCaption(i18n.getMessage(COLUMN_REASON));
grid.setFrozenColumnCount(5);
}
@@ -182,7 +181,7 @@ public class UploadProgressInfoWindow extends Window {
uploadContainer.addContainerProperty(COLUMN_FILE_NAME, String.class, null);
uploadContainer.addContainerProperty(COLUMN_PROGRESS, Double.class, 0D);
uploadContainer.addContainerProperty(COLUMN_REASON, String.class, "");
uploadContainer.addContainerProperty(SPUILabelDefinitions.NAME_VERSION, String.class, "");
uploadContainer.addContainerProperty(COLUMN_SOFTWARE_MODULE, String.class, "");
return uploadContainer;
}
@@ -197,7 +196,7 @@ public class UploadProgressInfoWindow extends Window {
}
private void createStatusPopupHeaderComponents() {
windowCaption = new Label("Upload status");
windowCaption = new Label(i18n.getMessage(UIMessageIdProvider.CAPTION_ARTIFACT_UPLOAD_POPUP));
closeButton = getCloseButton();
}
@@ -206,7 +205,7 @@ public class UploadProgressInfoWindow extends Window {
grid.getColumn(COLUMN_PROGRESS).setWidth(150);
grid.getColumn(COLUMN_FILE_NAME).setWidth(200);
grid.getColumn(COLUMN_REASON).setWidth(290);
grid.getColumn(SPUILabelDefinitions.NAME_VERSION).setWidth(200);
grid.getColumn(COLUMN_SOFTWARE_MODULE).setWidth(200);
}
private static class StatusRenderer extends HtmlRenderer {
@@ -314,7 +313,7 @@ public class UploadProgressInfoWindow extends Window {
if (item == null) {
item = grid.getContainerDataSource().addItem(fileUploadId);
item.getItemProperty(COLUMN_FILE_NAME).setValue(fileUploadId.getFilename());
item.getItemProperty(SPUILabelDefinitions.NAME_VERSION).setValue(HawkbitCommonUtil.getFormattedNameVersion(
item.getItemProperty(COLUMN_SOFTWARE_MODULE).setValue(HawkbitCommonUtil.getFormattedNameVersion(
fileUploadId.getSoftwareModuleName(), fileUploadId.getSoftwareModuleVersion()));
}

View File

@@ -9,7 +9,6 @@
package org.eclipse.hawkbit.ui.components;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
@@ -101,13 +100,16 @@ public class ConfigMenuBar extends MenuBar {
private void addMenuItems() {
if (createPermission) {
config.addItem(UIComponentIdProvider.CONFIG_MENU_BAR_CREATE, FontAwesome.PLUS, addButtonCommand);
config.addItem(i18n.getMessage(UIMessageIdProvider.CAPTION_CONFIG_CREATE), FontAwesome.PLUS,
addButtonCommand);
}
if (updatePermission) {
config.addItem(UIComponentIdProvider.CONFIG_MENU_BAR_UPDATE, FontAwesome.EDIT, updateButtonCommand);
config.addItem(i18n.getMessage(UIMessageIdProvider.CAPTION_CONFIG_EDIT), FontAwesome.EDIT,
updateButtonCommand);
}
if (deletePermission) {
config.addItem(UIComponentIdProvider.CONFIG_MENU_BAR_DELETE, FontAwesome.TRASH_O, deleteButtonCommand);
config.addItem(i18n.getMessage(UIMessageIdProvider.CAPTION_CONFIG_DELETE), FontAwesome.TRASH_O,
deleteButtonCommand);
}
}

View File

@@ -85,8 +85,8 @@ public class TargetFilterHeader extends VerticalLayout {
createfilterButton = createAddButton();
}
private static Label createHeaderCaption() {
return new LabelBuilder().name(SPUIDefinitions.TARGET_FILTER_LIST_HEADER_CAPTION).buildCaptionLabel();
private Label createHeaderCaption() {
return new LabelBuilder().name(i18n.getMessage(UIMessageIdProvider.CAPTION_FILTER_CUSTOM)).buildCaptionLabel();
}
private void buildLayout() {

View File

@@ -21,6 +21,7 @@ import org.eclipse.hawkbit.ui.AbstractHawkbitUI;
import org.eclipse.hawkbit.ui.UiProperties;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.themes.HawkbitTheme;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
@@ -119,6 +120,7 @@ public abstract class AbstractHawkbitLoginUI extends UI {
@Override
protected void init(final VaadinRequest request) {
setLocale(HawkbitCommonUtil.getLocaleToBeUsed(uiProperties.getLocalization(), getUI()));
SpringContextHelper.setContext(context);
params = UriComponentsBuilder.fromUri(Page.getCurrent().getLocation()).build().getQueryParams();

View File

@@ -132,7 +132,7 @@ public class ActionTypeOptionGroupLayout extends HorizontalLayout {
Date.from(LocalDateTime.now().plusWeeks(2).atZone(SPDateTimeUtil.getTimeZoneId(tz)).toInstant()));
forcedTimeDateField.setImmediate(true);
forcedTimeDateField.setTimeZone(tz);
forcedTimeDateField.setLocale(HawkbitCommonUtil.getLocale());
forcedTimeDateField.setLocale(HawkbitCommonUtil.getCurrentLocale());
forcedTimeDateField.setResolution(Resolution.MINUTE);
forcedTimeDateField.addStyleName(ValoTheme.DATEFIELD_SMALL);
addComponent(forcedTimeDateField);

View File

@@ -31,6 +31,7 @@ import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
@@ -336,9 +337,15 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
minimizeButton.setEnabled(false);
}
private static String getFormattedCountLabelValue(final int succussfulUploadCount, final int failedUploadCount) {
return new StringBuilder().append("Successful :").append(succussfulUploadCount)
.append("<font color=RED> Failed :").append(failedUploadCount).append("</font>").toString();
private String getFormattedCountLabelValue(final int successfulUploadCount, final int failedUploadCount) {
final StringBuilder countLabelBuilder = new StringBuilder();
countLabelBuilder.append(
i18n.getMessage(UIMessageIdProvider.MESSAGE_TARGET_BULKUPLOAD_RESULT_SUCCESS, successfulUploadCount));
countLabelBuilder.append("<br/><font color=RED>");
countLabelBuilder
.append(i18n.getMessage(UIMessageIdProvider.MESSAGE_TARGET_BULKUPLOAD_RESULT_FAIL, failedUploadCount));
countLabelBuilder.append("</font>");
return countLabelBuilder.toString();
}
/**

View File

@@ -23,6 +23,7 @@ import org.eclipse.hawkbit.ui.management.state.ManagementUIState;
import org.eclipse.hawkbit.ui.management.targettag.CreateTargetTagLayout;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.UINotification;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
import org.vaadin.spring.events.EventBus;
@@ -152,7 +153,7 @@ public class MultipleTargetFilter extends Accordion implements SelectedTabChange
}
private Component getComplexFilterTab() {
targetFilterQueryButtonsTab.setCaption(i18n.getMessage("caption.filter.custom"));
targetFilterQueryButtonsTab.setCaption(i18n.getMessage(UIMessageIdProvider.CAPTION_FILTER_CUSTOM));
return targetFilterQueryButtonsTab;
}

View File

@@ -133,7 +133,7 @@ public class AutoStartOptionGroupLayout extends HorizontalLayout {
Date.from(LocalDateTime.now().plusMinutes(30).atZone(SPDateTimeUtil.getTimeZoneId(tz)).toInstant()));
startAtDateField.setImmediate(true);
startAtDateField.setTimeZone(tz);
startAtDateField.setLocale(HawkbitCommonUtil.getLocale());
startAtDateField.setLocale(HawkbitCommonUtil.getCurrentLocale());
startAtDateField.setResolution(Resolution.MINUTE);
startAtDateField.addStyleName(ValoTheme.DATEFIELD_SMALL);
addComponent(startAtDateField);

View File

@@ -9,6 +9,7 @@
package org.eclipse.hawkbit.ui.utils;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
@@ -18,6 +19,7 @@ import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.PollStatus;
import org.eclipse.hawkbit.repository.model.RolloutGroup;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.eclipse.hawkbit.ui.UiProperties;
import org.eclipse.hawkbit.ui.rollout.StatusFontIcon;
import org.springframework.util.StringUtils;
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
@@ -524,7 +526,7 @@ public final class HawkbitCommonUtil {
* @see com.vaadin.ui.UI#getLocale()
* @see java.util.Locale#getDefault()
*/
public static Locale getLocale() {
public static Locale getCurrentLocale() {
final UI currentUI = UI.getCurrent();
return currentUI == null ? Locale.getDefault() : currentUI.getLocale();
}
@@ -559,4 +561,26 @@ public final class HawkbitCommonUtil {
return getCaptionText(caption);
}
/**
* Determine the language that should be used considering localization
* properties and UI settings
*
* @param localizationProperties
* UI Localization settings
* @param ui
* UI which settings are considered
* @return Locale to be used according to UI and properties
*/
public static Locale getLocaleToBeUsed(final UiProperties.Localization localizationProperties, final UI ui) {
final List<String> availableLocals = localizationProperties.getAvailableLocals();
final Locale uiLocale = ui.getSession().getLocale();
// ckeck if language code of UI locale matches an available local.
// Country, region and variant are ignored. "availableLocals" must only
// contain language codes without country or other extensions.
if (availableLocals.contains(uiLocale.getLanguage())) {
return uiLocale;
}
return new Locale(localizationProperties.getDefaultLocal());
}
}

View File

@@ -323,11 +323,6 @@ public final class SPUIDefinitions {
*/
public static final String EDIT = "Edit";
/**
* TARGET_FILTER_MANAGEMENT - header caption .
*/
public static final String TARGET_FILTER_LIST_HEADER_CAPTION = "Custom Filters";
/**
* Bulk upload DS combo style.
*/

View File

@@ -37,6 +37,8 @@ public final class UIMessageIdProvider {
public static final String CAPTION_FILTER_BY_TYPE = "caption.filter.by.type";
public static final String CAPTION_FILTER_CUSTOM = "caption.filter.custom";
public static final String CAPTION_DISTRIBUTION_TAG = "caption.entity.distribution.tag";
public static final String CAPTION_TARGET_TAG = "caption.entity.target.tag";
@@ -45,6 +47,12 @@ public final class UIMessageIdProvider {
public static final String CAPTION_ARTIFACT_DETAILS_OF = "caption.artifact.details.of";
public static final String CAPTION_CONFIG_CREATE = "caption.config.create";
public static final String CAPTION_CONFIG_EDIT = "caption.config.edit";
public static final String CAPTION_CONFIG_DELETE = "caption.config.delete";
public static final String LABEL_DROP_AREA_UPLOAD = "label.drop.area.upload";
public static final String LABEL_NO_TAG = "label.no.tag";
@@ -131,6 +139,26 @@ public final class UIMessageIdProvider {
public static final String TOOLTIP_UPDATE_CUSTOM_FILTER = "tooltip.update.custom.filter";
public static final String CAPTION_ARTIFACT_UPLOAD_POPUP = "artifact.upload.popup.caption";
public static final String CAPTION_ARTIFACT_UPLOAD_STATUS = "artifact.upload.status.caption";
public static final String CAPTION_ARTIFACT_UPLOAD_PROGRESS = "artifact.upload.progress.caption";
public static final String CAPTION_ARTIFACT_UPLOAD_REASON = "artifact.upload.reason.caption";
public static final String CAPTION_ARTIFACT_FILENAME = "artifact.filename.caption";
public static final String CAPTION_ARTIFACT_FILESIZE_BYTES = "artifact.filesize.bytes.caption";
public static final String CAPTION_SOFTWARE_MODULE = "caption.software.module";
public static final String CAPTION_ARTIFACT_SOFTWARE_MODULE_TYPE = "artifact.softwaremodule.type.caption";
public static final String MESSAGE_TARGET_BULKUPLOAD_RESULT_SUCCESS = "message.bulk.upload.result.success";
public static final String MESSAGE_TARGET_BULKUPLOAD_RESULT_FAIL = "message.bulk.upload.result.fail";
/**
* Private Constructor.
*/

View File

@@ -40,7 +40,7 @@ public class VaadinMessageSource implements Serializable {
/**
* Tries to resolve the message based on
* {@link HawkbitCommonUtil#getLocale()}. Returns message code if fitting
* {@link HawkbitCommonUtil#getCurrentLocale()}. Returns message code if fitting
* message could not be found.
*
* @param code
@@ -52,11 +52,11 @@ public class VaadinMessageSource implements Serializable {
* @return the resolved message, or the message code if the lookup fails.
*
* @see MessageSource#getMessage(String, Object[], Locale)
* @see HawkbitCommonUtil#getLocale()
* @see HawkbitCommonUtil#getCurrentLocale()
*/
public String getMessage(final String code, final Object... args) {
try {
return source.getMessage(code, args, HawkbitCommonUtil.getLocale());
return source.getMessage(code, args, HawkbitCommonUtil.getCurrentLocale());
} catch (final NoSuchMessageException ex) {
LOG.error("Failed to retrieve message!", ex);
return code;

View File

@@ -144,6 +144,10 @@ caption.forced.datefield = Force update at time
caption.force.action.confirmbox = Confirm Force Active Action
caption.confirm.abort.action = Confirm Abort Action
caption.config.create = create
caption.config.edit = edit
caption.config.delete = delete
caption.metadata.popup = Metadata of
caption.confirm.assign.consequences = Auto assign consequences
caption.auto.assignment.ds = Auto assignment
@@ -439,6 +443,13 @@ message.uploadedfile.illegalFilename = Filename contains illegal characters
message.artifact.deleted = Artifact with file {0} deleted successfully
artifact.upload.popup.caption = Upload status
artifact.upload.status.caption = Status
artifact.upload.progress.caption = Progress
artifact.upload.reason.caption = Reason
artifact.filename.caption = File name
artifact.filesize.bytes.caption = Size(B)
artifact.softwaremodule.type.caption = Type
upload.swModuleTable.header = Software Module
upload.selectedfile.name = file selected for upload
@@ -448,8 +459,6 @@ upload.md5 = MD5 checksum
upload.last.modified.date=Last modified date
upload.failed = Failed
upload.success = Success
upload.swmodule.type = Type
upload.size = Size(B)
upload.validation = Validation
upload.action = Action
upload.result.status = Upload status
@@ -480,6 +489,8 @@ message.dist.discard.success = All Distributions are discarded successfully !
message.assign.discard.success = All assignments are discarded successfully !
message.target.ds.assign.success = Assignment saved successfully !
message.bulk.upload.assignment.failed = Distribution set assignment failed as distribution set no longer exists!
message.bulk.upload.result.success = Successful: {0}
message.bulk.upload.result.fail = Failed: {0}
message.key.missing = Key is missing !
message.value.missing = Value is missing !
message.metadata.saved = Metadata with key {0} successfully saved !