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-csv-import-widget@119709 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-10-13 16:33:10 +00:00
parent 54ab87f359
commit 60c4098000
14 changed files with 273 additions and 128 deletions

View File

@ -39,7 +39,7 @@ Documentation
tabular-data-csv-import-widget allows csv import from file and workspace
Documentation is available on-line from the Projects Documentation Wiki:
https://gcube.wiki.gcube-system.org/gcube/index.php/Tabular_Data_Manager
http://wiki.gcube-system.org/gcube/Tabular_Data_Manager
Licensing

View File

@ -0,0 +1,29 @@
package org.gcube.portlets.user.td.csvimportwidget.client;
import com.google.gwt.i18n.client.Messages;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface CSVImportWizardTDMessages extends Messages {
@DefaultMessage("CSV source selection")
String csvSourceSelection();
@DefaultMessage("CSV Import File Upload")
String csvImportFileUpload();
@DefaultMessage("CSV Import From Workspace")
String csvImportFromWorkspace();
@DefaultMessage("Workspace Selection")
String workspaceSelection();
@DefaultMessage("Error retrieving the file from the workspace.")
String errorRetrievingTheFileFromWorkspace();
}

View File

@ -7,6 +7,7 @@ import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.user.client.Command;
import com.sencha.gxt.widget.core.client.container.MarginData;
@ -17,12 +18,15 @@ import com.sencha.gxt.widget.core.client.container.MarginData;
*
*/
public class CSVUploadFileCard extends WizardCard {
protected CSVImportSession importSession;
protected FileUploadPanel fileUploadPanel;
protected CSVUploadFileCard thisCard;
private static CSVImportWizardTDMessages msgs= GWT.create(CSVImportWizardTDMessages.class);
private CSVImportSession importSession;
private FileUploadPanel fileUploadPanel;
private CSVUploadFileCard thisCard;
public CSVUploadFileCard(final CSVImportSession importSession) {
super("CSV Import File Upload", "");
super(msgs.csvImportFileUpload(), "");
this.thisCard = this;
this.importSession = importSession;

View File

@ -11,6 +11,7 @@ import java.util.List;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.widgetcommonevent.client.CommonMessages;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
@ -21,6 +22,7 @@ import org.gcube.portlets.widgets.wsexplorer.shared.Item;
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sencha.gxt.core.client.util.Margins;
@ -35,20 +37,23 @@ import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.Verti
*
*/
public class CSVWorkSpaceSelectionCard extends WizardCard {
private static CSVImportWizardTDMessages msgs= GWT.create(CSVImportWizardTDMessages.class);
private CSVImportSession importSession;
private CSVWorkSpaceSelectionCard thisCard;
protected CSVImportSession importSession;
protected CSVWorkSpaceSelectionCard thisCard;
private VerticalLayoutContainer p;
private WorkspaceExplorerSelectPanel wpanel;
protected ItemType item;
protected VerticalLayoutContainer p;
protected WorkspaceExplorerSelectPanel wpanel;
private CommonMessages msgsCommon;
public CSVWorkSpaceSelectionCard(final CSVImportSession importSession) {
super("CSV Import From Workspace", "");
super(msgs.csvImportFromWorkspace(), "");
this.importSession = importSession;
thisCard = this;
initMessages();
p = new VerticalLayoutContainer();
Log.debug("Set Workspace Panel");
@ -66,8 +71,7 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
FilterCriteria filterCriteria = new FilterCriteria(allowedMimeTypes,
allowedFileExtensions, new HashMap<String, String>());
wpanel = new WorkspaceExplorerSelectPanel(new String(
"Workspace Selection"), filterCriteria, selectableTypes);
wpanel = new WorkspaceExplorerSelectPanel(msgs.workspaceSelection(), filterCriteria, selectableTypes);
WorskpaceExplorerSelectNotificationListener handler = new WorskpaceExplorerSelectNotificationListener() {
@ -122,6 +126,10 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
setCenterWidget(p, new MarginData(0));
}
protected void initMessages(){
msgsCommon = GWT.create(CommonMessages.class);
}
@Override
public void setup() {
@ -170,8 +178,8 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
SessionExpiredType.EXPIREDONSERVER));
} else {
thisCard.showErrorAndHide(
"Error",
"Error retrieving the file from the workspace.",
msgsCommon.error(),
msgs.errorRetrievingTheFileFromWorkspace(),
caught.getLocalizedMessage(), caught);
}
}

View File

@ -9,6 +9,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.source.FileSource;
import org.gcube.portlets.user.td.gwtservice.shared.source.WorkspaceSource;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.user.client.Command;
@ -25,14 +26,18 @@ import com.sencha.gxt.widget.core.client.form.Radio;
*
*/
public class SourceSelectionCard extends WizardCard {
private static CSVImportWizardTDMessages msgs= GWT.create(CSVImportWizardTDMessages.class);
private final FileSource fileSource = FileSource.INSTANCE;
private final WorkspaceSource workspaceSource = WorkspaceSource.INSTANCE;
protected final CSVImportSession importSession;
final FileSource fileSource = FileSource.INSTANCE;
final WorkspaceSource workspaceSource = WorkspaceSource.INSTANCE;
private final CSVImportSession importSession;
public SourceSelectionCard(final CSVImportSession importSession) {
super("CSV source selection", "");
super(msgs.csvSourceSelection(), "");
this.importSession = importSession;
// Default

View File

@ -3,62 +3,73 @@
*/
package org.gcube.portlets.user.td.csvimportwidget.client.progress;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.sencha.gxt.widget.core.client.ProgressBar;
/**
* Updates a {@link ProgressBar} progress and text based on {@link CSVImportProgressListener} events.
* Updates a {@link ProgressBar} progress and text based on
* {@link CSVImportProgressListener} events.
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class FileUploadProgressBarUpdater implements FileUploadProgressListener {
protected ProgressBar progressBar;
private ProgressBar progressBar;
private FileUploadProgressMessages msgs;
/**
* Creates a new {@link ProgressBar} updater.
* @param progressBar the {@link ProgressBar} to update.
*
* @param progressBar
* the {@link ProgressBar} to update.
*/
public FileUploadProgressBarUpdater(ProgressBar progressBar) {
initMessages();
this.progressBar = progressBar;
this.progressBar.updateProgress(0, "Please Wait...");
this.progressBar.updateProgress(0, msgs.pleaseWait());
}
protected void initMessages() {
msgs = GWT.create(FileUploadProgressMessages.class);
}
/**
* {@inheritDoc}
*/
public void operationComplete() {
Log.info("File upload complete");
progressBar.updateProgress(1, "File upload completed.");
progressBar.updateProgress(1, msgs.fileUploadCompleted());
}
/**
* {@inheritDoc}
*/
public void operationFailed(Throwable caught, String reason, String failureDetails) {
public void operationFailed(Throwable caught, String reason,
String failureDetails) {
Log.info("File upload failed");
progressBar.updateText("File upload failed.");
progressBar.updateText(msgs.fileUploadFailed());
}
public void operationInitializing() {
Log.info("File upload inizializing");
progressBar.updateProgress(0, "Initializing...");
progressBar.updateProgress(0, msgs.initializing());
}
public void operationUpdate(float elaborated) {
Log.info("File upload elaborated: "+elaborated);
if (elaborated>=0 && elaborated<1) {
Log.trace("progress "+elaborated);
int elab=new Float(elaborated*100).intValue();
progressBar.updateProgress(elaborated,elab+"% Uploading...");
Log.info("File upload elaborated: " + elaborated);
if (elaborated >= 0 && elaborated < 1) {
Log.trace("progress " + elaborated);
int elab = new Float(elaborated * 100).intValue();
progressBar.updateProgress(elaborated,
String.valueOf(elab) + msgs.percUploading());
}
if (elaborated == 1) progressBar.updateProgress(1, "Completing...");
if (elaborated == 1)
progressBar.updateProgress(1, msgs.completing());
}
}

View File

@ -0,0 +1,39 @@
package org.gcube.portlets.user.td.csvimportwidget.client.progress;
import com.google.gwt.i18n.client.Messages;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface FileUploadProgressMessages extends Messages {
//
@DefaultMessage("Please Wait...")
String pleaseWait();
@DefaultMessage("File upload completed.")
String fileUploadCompleted();
@DefaultMessage("File Upload Failed")
String fileUploadFailedHead();
@DefaultMessage("File upload failed.")
String fileUploadFailed();
@DefaultMessage("Initializing...")
String initializing();
@DefaultMessage("% Uploading...")
String percUploading();
@DefaultMessage("Completing...")
String completing();
@DefaultMessage("Failed getting operation updates")
String failedGettingOperarionUpdateds();
}

View File

@ -9,119 +9,127 @@ import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.rpc.AsyncCallback;
/**
* This {@link Timer} retrieves {@link OperationProgress} from the specified {@link OperationProgressSource} with the scheduled interval.
* The retrieved information are spread to the subscribed {@link CSVImportProgressListener}.
* This {@link Timer} retrieves {@link OperationProgress} from the specified
* {@link OperationProgressSource} with the scheduled interval. The retrieved
* information are spread to the subscribed {@link CSVImportProgressListener}.
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class FileUploadProgressUpdater extends Timer {
protected ArrayList<FileUploadProgressListener> listeners = new ArrayList<FileUploadProgressListener>();
private ArrayList<FileUploadProgressListener> listeners = new ArrayList<FileUploadProgressListener>();
private static FileUploadProgressMessages msgs = GWT
.create(FileUploadProgressMessages.class);
/**
* {@inheritDoc}
*/
@Override
public void run() {
Log.debug("requesting operation progress");
TDGWTServiceAsync.INSTANCE.getFileUploadMonitor(new AsyncCallback<FileUploadMonitor>() {
TDGWTServiceAsync.INSTANCE
.getFileUploadMonitor(new AsyncCallback<FileUploadMonitor>() {
public void onFailure(Throwable caught) {
cancel();
Log.error("Error retrieving the operation state",
caught);
String message = getStack(caught);
fireOperationFailed(caught,
msgs.failedGettingOperarionUpdateds(), message);
}
public void onSuccess(FileUploadMonitor result) {
Log.info("retrieved FileUploadMonitor: "
+ result.getState());
switch (result.getState()) {
case STARTED:
Log.debug("File Upload Started");
break;
case INPROGRESS:
Log.debug("Progress: "
+ result.getElaboratedLenght() + " of "
+ result.getTotalLenght());
fireOperationUpdate(result.getPercentDone());
break;
case FAILED:
Log.debug("File Upload Failed");
cancel();
fireOperationFailed(new Throwable(
msgs.fileUploadFailedHead()), result
.getFailureReason(), result
.getFailureDetails());
break;
case COMPLETED:
cancel();
Log.debug("File Upload Completed");
fireOperationComplete();
break;
default:
break;
}
}
});
public void onFailure(Throwable caught) {
cancel();
Log.error("Error retrieving the operation state", caught);
String message = getStack(caught);
fireOperationFailed(caught, "Failed getting operation updates", message);
}
public void onSuccess(FileUploadMonitor result) {
Log.info("retrieved FileUploadMonitor: "+result.getState());
switch (result.getState()) {
case STARTED:
Log.debug("File Upload Started");
break;
case INPROGRESS:
Log.debug("Progress: "+result.getElaboratedLenght()+" of "+result.getTotalLenght());
fireOperationUpdate(result.getPercentDone());
break;
case FAILED:
Log.debug("File Upload Failed");
cancel();
fireOperationFailed(new Throwable("File Upload Failed") ,result.getFailureReason(), result.getFailureDetails());
break;
case COMPLETED:
cancel();
Log.debug("File Upload Completed");
fireOperationComplete();
break;
default:
break;
}
}
});
}
protected String getStack(Throwable e)
{
String message = e.getLocalizedMessage()+" -> <br>";
protected String getStack(Throwable e) {
String message = e.getLocalizedMessage() + " -> <br>";
Throwable c = e.getCause();
if (c!=null) message += getStack(c);
if (c != null)
message += getStack(c);
return message;
}
protected void fireOperationInitializing()
{
for (FileUploadProgressListener listener:listeners) listener.operationInitializing();
}
protected void fireOperationUpdate(float elaborated)
{
for (FileUploadProgressListener listener:listeners) listener.operationUpdate(elaborated);
protected void fireOperationInitializing() {
for (FileUploadProgressListener listener : listeners)
listener.operationInitializing();
}
protected void fireOperationComplete()
{
for (FileUploadProgressListener listener:listeners) listener.operationComplete();
protected void fireOperationUpdate(float elaborated) {
for (FileUploadProgressListener listener : listeners)
listener.operationUpdate(elaborated);
}
protected void fireOperationFailed(Throwable caught, String failure, String failureDetails)
{
for (FileUploadProgressListener listener:listeners) listener.operationFailed(caught, failure, failureDetails);
protected void fireOperationComplete() {
for (FileUploadProgressListener listener : listeners)
listener.operationComplete();
}
protected void fireOperationFailed(Throwable caught, String failure,
String failureDetails) {
for (FileUploadProgressListener listener : listeners)
listener.operationFailed(caught, failure, failureDetails);
}
/**
* Add a new {@link CSVImportProgressListener} to this {@link FileUploadProgressUpdater}.
* @param listener the listener to add.
* Add a new {@link CSVImportProgressListener} to this
* {@link FileUploadProgressUpdater}.
*
* @param listener
* the listener to add.
*/
public void addListener(FileUploadProgressListener listener)
{
public void addListener(FileUploadProgressListener listener) {
listeners.add(listener);
}
/**
* Removes the specified {@link CSVImportProgressListener} from this {@link FileUploadProgressUpdater}.
* @param listener the listener to remove.
* Removes the specified {@link CSVImportProgressListener} from this
* {@link FileUploadProgressUpdater}.
*
* @param listener
* the listener to remove.
*/
public void removeListener(FileUploadProgressListener listener)
{
public void removeListener(FileUploadProgressListener listener) {
listeners.remove(listener);
}
}

View File

@ -2,6 +2,7 @@
<module rename-to='CSVImportWizardTD'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- <inherits name="com.google.gwt.i18n.I18N" /> -->
<!-- We need the JUnit module in the main module, -->
<!-- otherwise eclipse complains (Google plugin bug?) -->
@ -27,6 +28,26 @@
<!-- Specify the app entry point class. -->
<!-- <entry-point class='org.gcube.portlets.user.SDMXImportWizardTD.client.SDMXImportWizardTDEntry'
/> -->
<!--
<set-configuration-property name="locale.cookie"
value="TDLangCookie" />
<set-configuration-property name="locale.queryparam"
value="TDLang" />
<set-configuration-property name="locale.usemeta"
value="Y" />
<set-configuration-property name="locale.useragent"
value="Y" />
<set-configuration-property name="locale.searchorder"
value="cookie,queryparam,meta,useragent" />
<extend-property name="locale" values="en" />
<extend-property name="locale" values="it" />
<extend-property name="locale" values="es" />
<set-property name="locale" value="en, it, es" />
<set-property-fallback name="locale" value="en" />
-->
<!-- Specify the paths for translatable code -->
<source path='client' />

View File

@ -1,2 +0,0 @@
sendButton = Send
nameField = Enter your name

View File

@ -1,2 +0,0 @@
sendButton = Envoyer
nameField = Entrez votre nom

View File

@ -0,0 +1,8 @@
pleaseWait = Please Wait...
fileUploadCompleted = File upload completed.
fileUploadFailedHead = File Upload Failed
fileUploadFailed = File upload failed.
initializing = Initializing...
percUploading = % Uploading...
completing = Completing...
failedGettingOperarionUpdateds = Failed getting operation updates

View File

@ -0,0 +1,8 @@
pleaseWait = Por Favor, Espera...
fileUploadCompleted = Carga de archivo completada.
fileUploadFailedHead = Carga de Archivo Fallido
fileUploadFailed = Carga de archivos fallido.
initializing = Inicialización...
percUploading = % Cargando...
completing = Completar...
failedGettingOperarionUpdateds = Error al recuperar información sobre la operación

View File

@ -0,0 +1,8 @@
pleaseWait = Attendere...
fileUploadCompleted = Caricamento file completato.
fileUploadFailedHead = Caricamento File Fallito
fileUploadFailed = Caricamento file fallito.
initializing = Inizzializazione...
percUploading = % Carimento...
completing = Completamento...
failedGettingOperarionUpdateds = Errore recuperando informazioni sull''operazione