/** * Get the i18N string. * * @param key to get the message. * @return the message found. */ protected String msg(String key) { return I18nUtil.getMessage("org.dspace.checker.ResultsLogger." + key); }
private String msg(String key) { return I18nUtil.getMessage("org.dspace.checker.SimpleReporterImpl." + key); }
/** * Get the i18n message string for a given key and use the default Locale. * * @param key String - name of the key to get the message for * @return message * String of the message */ public static String getMessage(String key) { return getMessage(key.trim(), DEFAULTLOCALE); }
public static String getCountryName(String countryCode){ if (countryCode.length() > 0 && countryCodeList.contains(countryCode)) { int index = countryCodeList.indexOf(countryCode); return countryNameList.get(index).toString(); } else { return I18nUtil.getMessage("org.dspace.statistics.util.LocationUtils.unknown-country"); } }
public static String getContinentCode(String countryCode){ if(countryCode.length() > 0 && countryCodeList.contains(countryCode)) { int index = countryCodeList.indexOf(countryCode); return continentCodeList.get(index).toString(); } else { return I18nUtil.getMessage("org.dspace.statistics.util.LocationUtils.unknown-continent"); } }
/** * Get the i18n message string for a given key and context * * @param key String - name of the key to get the message for * @param c Context having the desired Locale * @return message * String of the message */ public static String getMessage(String key, Context c) { return getMessage(key.trim(), c.getCurrentLocale()); }
/** * Map ISO country codes onto localized country names. * * @param countryCode ISO 3166-1 alpha-2 country code. * @param locale Desired localization. * @return Localized name of the country, or an error message string. */ static public String getCountryName(String countryCode, Locale locale) { if (null == countryCode) { return I18nUtil .getMessage("org.dspace.statistics.util.LocationUtils.unknown-country"); } Locale country = new Locale("EN", countryCode); String name = country.getDisplayCountry(locale); if (name.isEmpty()) { return I18nUtil .getMessage("org.dspace.statistics.util.LocationUtils.unknown-country"); } else { return name; } } }
logger.info("Null continentCode"); return I18nUtil .getMessage("org.dspace.statistics.util.LocationUtils.unknown-continent"); e); return I18nUtil .getMessage("org.dspace.statistics.util.LocationUtils.unknown-continent"); + names.getLocale().getDisplayName()); return I18nUtil .getMessage("org.dspace.statistics.util.LocationUtils.unknown-continent");
/** * Map DSpace continent codes onto ISO country codes. * * @param countryCode ISO 3166-1 alpha-2 country code. * @return DSpace 2-character code for continent containing that country, or * an error message string. */ static public String getContinentCode(String countryCode) { if (null == countryCode) { logger.info("Null country code"); return I18nUtil .getMessage("org.dspace.statistics.util.LocationUtils.unknown-continent"); } if (countryToContinent.isEmpty()) { try { countryToContinent.load(LocationUtils.class .getResourceAsStream("country-continent-codes.properties")); } catch (IOException e) { logger.error("Could not load country/continent map file", e); } } String continent = countryToContinent.getProperty(countryCode); if (null == continent) { logger.info("Unknown country code " + countryCode); return I18nUtil .getMessage("org.dspace.statistics.util.LocationUtils.unknown-continent"); } else { return continent; } }
@Override public String getItemTitle(BasicWorkflowItem wi) throws SQLException { Item myitem = wi.getItem(); String title = myitem.getName(); // only return the first element, or "Untitled" if (StringUtils.isNotBlank(title)) { return title; } else { return I18nUtil.getMessage("org.dspace.workflow.WorkflowManager.untitled "); } }
@Override public void setMetadata(Context context, Community community, String field, String value) throws MissingResourceException, SQLException { if ((field.trim()).equals("name") && (value == null || value.trim().equals(""))) { try { value = I18nUtil.getMessage("org.dspace.workflow.WorkflowManager.untitled"); } catch (MissingResourceException e) { value = "Untitled"; } } String[] MDValue = getMDValueByLegacyField(field); /* * Set metadata field to null if null * and trim strings to eliminate excess * whitespace. */ if (value == null) { clearMetadata(context, community, MDValue[0], MDValue[1], MDValue[2], Item.ANY); } else { setMetadataSingleValue(context, community, MDValue[0], MDValue[1], MDValue[2], null, value); } community.addDetails(field); }
@Override public RequestItemAuthor getRequestItemAuthor(Context context, Item item) throws SQLException { if (emailMetadata != null) { List<MetadataValue> vals = itemService.getMetadataByMetadataString(item, emailMetadata); if (vals.size() > 0) { String email = vals.iterator().next().getValue(); String fullname = null; if (fullNameMetadata != null) { List<MetadataValue> nameVals = itemService.getMetadataByMetadataString(item, fullNameMetadata); if (nameVals.size() > 0) { fullname = nameVals.iterator().next().getValue(); } } if (StringUtils.isBlank(fullname)) { fullname = I18nUtil .getMessage( "org.dspace.app.requestitem.RequestItemMetadataStrategy.unnamed", context); } RequestItemAuthor author = new RequestItemAuthor( fullname, email); return author; } } return super.getRequestItemAuthor(context, item); }
@Override public void setMetadata(Context context, Collection collection, String field, String value) throws MissingResourceException, SQLException { if ((field.trim()).equals("name") && (value == null || value.trim().equals(""))) { try { value = I18nUtil.getMessage("org.dspace.workflow.WorkflowManager.untitled"); } catch (MissingResourceException e) { value = "Untitled"; } } String[] MDValue = getMDValueByLegacyField(field); /* * Set metadata field to null if null * and trim strings to eliminate excess * whitespace. */ if (value == null) { clearMetadata(context, collection, MDValue[0], MDValue[1], MDValue[2], Item.ANY); collection.setMetadataModified(); } else { setMetadataSingleValue(context, collection, MDValue[0], MDValue[1], MDValue[2], null, value); } collection.addDetails(field); }
throw new AuthorizeException(I18nUtil.getMessage("feedback.error.forbidden"));
/** * Return a RequestItemAuthor object for the specified helpdesk email address. * It makes an attempt to find if there is a matching eperson for the helpdesk address, to use the name, * Otherwise it falls back to a helpdeskname key in the Messages.props. * * @param context context * @param helpDeskEmail email * @return RequestItemAuthor * @throws SQLException if database error */ public RequestItemAuthor getHelpDeskPerson(Context context, String helpDeskEmail) throws SQLException { EPerson helpdeskEPerson = null; context.turnOffAuthorisationSystem(); helpdeskEPerson = ePersonService.findByEmail(context, helpDeskEmail); context.restoreAuthSystemState(); if (helpdeskEPerson != null) { return new RequestItemAuthor(helpdeskEPerson); } else { String helpdeskName = I18nUtil.getMessage( "org.dspace.app.requestitem.RequestItemHelpdeskStrategy.helpdeskname", context); return new RequestItemAuthor(helpdeskName, helpDeskEmail); } } }
try label = I18nUtil.getMessage("metadata." + (style != null ? style + "." : "") + field, context);
recipName = I18nUtil.getMessage("org.dspace.app.webui.servlet.SuggestServlet.recipient", context); senderName = I18nUtil.getMessage("org.dspace.app.webui.servlet.SuggestServlet.sender", context);
} else { Locale supportedLocale = I18nUtil.getEPersonLocale(eperson); emailErrorMessage(eperson, I18nUtil.getMessage("org.dspace.app.itemexport.no-result", supportedLocale));
String title = ""; try { title = I18nUtil.getMessage("org.dspace.workflow.WorkflowManager.untitled"); } catch (MissingResourceException e) { title = "Untitled";
if (StringUtils.isBlank(title)) { try { title = I18nUtil.getMessage("org.dspace.workflow.WorkflowManager.untitled"); } catch (MissingResourceException e) { title = "Untitled";