915: TDM - Support the Spanish language
Task-Url: https://support.d4science.org/issues/915 Updated Spanish Support git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@119547 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0f99ed32ab
commit
c57b44c3f4
|
@ -21,6 +21,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialCreateC
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialDownscaleCSquareSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.i18n.InfoLocale;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.licenses.LicenceData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.map.MapCreationSession;
|
||||
|
@ -114,6 +115,15 @@ public interface TDGWTService extends RemoteService {
|
|||
*/
|
||||
public UserInfo hello() throws TDGWTServiceException;
|
||||
|
||||
|
||||
/**
|
||||
* Set locale on server
|
||||
*
|
||||
* @param infoLocale
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
public void setLocale(InfoLocale infoLocale) throws TDGWTServiceException;
|
||||
|
||||
/**
|
||||
* Retrieve pending Tasks and set them as background tasks
|
||||
*
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialCreateC
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialDownscaleCSquareSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.i18n.InfoLocale;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.licenses.LicenceData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.map.MapCreationSession;
|
||||
|
@ -98,6 +99,8 @@ public interface TDGWTServiceAsync {
|
|||
.create(TDGWTService.class);
|
||||
|
||||
void hello(AsyncCallback<UserInfo> callback);
|
||||
|
||||
void setLocale(InfoLocale infoLocale,AsyncCallback<Void> callback);
|
||||
|
||||
void pendingTasksRetrieve(AsyncCallback<Integer> callback);
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ package org.gcube.portlets.user.td.gwtservice.server;
|
|||
*
|
||||
*/
|
||||
public class SessionConstants {
|
||||
public static final String INFO_LOCALE="INFO_LOCALE";
|
||||
|
||||
public static final String SCOPE_TO_CURRENT_TRID_MAP = "SCOPE_TO_CURRENT_TRID_MAP";
|
||||
public static final String SCOPE_TO_CURRENT_TABULAR_RESOURCE_MAP = "SCOPE_TO_CURRENT_TABULAR_RESOURCE_MAP";
|
||||
public static final String SCOPE_TO_CURRENT_TABULAR_RESOURCES_OPEN_MAP = "SCOPE_TO_CURRENT_TABULAR_RESOURCES_OPEN_MAP";
|
||||
|
|
|
@ -6,6 +6,8 @@ package org.gcube.portlets.user.td.gwtservice.server;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
|
@ -28,6 +30,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.geometry.GeometryCreatePoint
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialCreateCoordinatesSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialDownscaleCSquareSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.i18n.InfoLocale;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.map.MapCreationSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyAndDetachColumnRulesSession;
|
||||
|
@ -91,7 +94,11 @@ public class SessionUtil {
|
|||
ASLSession session;
|
||||
if (username == null) {
|
||||
logger.warn("no user found in session, use test user");
|
||||
throw new TDGWTSessionExpiredException("Session Expired!");
|
||||
|
||||
InfoLocale infoLocale=getInfoLocale(httpSession);
|
||||
Locale locale=new Locale(infoLocale.getLanguage());
|
||||
ResourceBundle messages=ResourceBundle.getBundle(TDGWTServiceMessagesConstants.TDGWTServiceMessages, locale);
|
||||
throw new TDGWTSessionExpiredException(messages.getString(TDGWTServiceMessagesConstants.sessionExpired));
|
||||
|
||||
/*
|
||||
// Remove comment for Test
|
||||
|
@ -115,6 +122,33 @@ public class SessionUtil {
|
|||
return session;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
public static InfoLocale getInfoLocale(
|
||||
HttpSession httpSession) {
|
||||
InfoLocale infoLocale = (InfoLocale) httpSession
|
||||
.getAttribute(SessionConstants.INFO_LOCALE);
|
||||
if (infoLocale != null) {
|
||||
return infoLocale;
|
||||
} else {
|
||||
infoLocale = new InfoLocale("en");
|
||||
httpSession.setAttribute(SessionConstants.INFO_LOCALE,
|
||||
infoLocale);
|
||||
return infoLocale;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setInfoLocale(HttpSession httpSession, InfoLocale infoLocale) {
|
||||
InfoLocale infoL = (InfoLocale) httpSession
|
||||
.getAttribute(SessionConstants.INFO_LOCALE);
|
||||
if (infoL != null) {
|
||||
httpSession.removeAttribute(SessionConstants.INFO_LOCALE);
|
||||
}
|
||||
httpSession.setAttribute(SessionConstants.INFO_LOCALE,
|
||||
infoLocale);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set in session the Tabular Resource List retrieved from service only for
|
||||
|
@ -2707,4 +2741,10 @@ public class SessionUtil {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,17 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.server;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class TDGWTServiceMessagesConstants {
|
||||
|
||||
public static final String TDGWTServiceMessages = "org.gcube.portlets.user.td.gwtservice.server.TDGWTServiceMessages";
|
||||
|
||||
public static final String sessionExpired = "sessionExpired";
|
||||
|
||||
public static final String securityExceptionRights = "securityExceptionRights";
|
||||
|
||||
}
|
|
@ -16,6 +16,8 @@ public class Constants {
|
|||
|
||||
public final static String FILE_XML_MIMETYPE = "application/xml";
|
||||
public final static String FILE_CSV_MIMETYPE = "text/csv";
|
||||
|
||||
|
||||
|
||||
public static final String PARAMETER_ENCODING = "encoding";
|
||||
public static final String PARAMETER_HASHEADER = "hasHeader";
|
||||
|
@ -128,4 +130,5 @@ public class Constants {
|
|||
public static final String PARAMETER_RESOURCE_NAME = "name";
|
||||
public static final String PARAMETER_RESOURCE_DESCRIPTION = "description";
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.shared.i18n;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class InfoLocale implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -8025774800803525216L;
|
||||
|
||||
private String language;
|
||||
|
||||
public InfoLocale() {
|
||||
super();
|
||||
}
|
||||
|
||||
public InfoLocale(String language) {
|
||||
super();
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "InfoLocale [language=" + language + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
sendButton = Send
|
||||
nameField = Enter your name
|
|
@ -1,2 +0,0 @@
|
|||
sendButton = Envoyer
|
||||
nameField = Entrez votre nom
|
|
@ -0,0 +1,2 @@
|
|||
sessionExpired = Session Expired!
|
||||
securityExceptionRights = Security exception, you don't have the required rights!
|
|
@ -0,0 +1,2 @@
|
|||
sessionExpired = Session Expired!
|
||||
securityExceptionRights = Security exception, you don't have the required rights!
|
|
@ -0,0 +1,2 @@
|
|||
sessionExpired = Sesión Ha Finalizado!
|
||||
securityExceptionRights = Excepción de seguridad, usted no tiene los derechos necesarios!
|
|
@ -0,0 +1,2 @@
|
|||
sessionExpired = Sessione Scaduta!
|
||||
securityExceptionRights = Eccezione di sicurezza, non si dispone dei diritti necessari!
|
Loading…
Reference in New Issue