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-portlet@119548 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
f2d091d308
commit
4b25b8dee5
|
@ -24,6 +24,7 @@ import org.gcube.portlets.user.td.extractcodelistwidget.client.ExtractCodelistWi
|
||||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.i18n.InfoLocale;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.user.UserInfo;
|
import org.gcube.portlets.user.td.gwtservice.shared.user.UserInfo;
|
||||||
import org.gcube.portlets.user.td.jsonexportwidget.client.JSONExportWidgetTD;
|
import org.gcube.portlets.user.td.jsonexportwidget.client.JSONExportWidgetTD;
|
||||||
|
@ -371,7 +372,16 @@ public class TabularDataController {
|
||||||
|
|
||||||
LocaleInfo currentLocaleInfo = LocaleInfo.getCurrentLocale();
|
LocaleInfo currentLocaleInfo = LocaleInfo.getCurrentLocale();
|
||||||
Log.debug("Current Locale:" + currentLocaleInfo.getLocaleName());
|
Log.debug("Current Locale:" + currentLocaleInfo.getLocaleName());
|
||||||
|
|
||||||
|
String localeName=currentLocaleInfo.getLocaleName();
|
||||||
|
InfoLocale infoLocale;
|
||||||
|
if(localeName==null||localeName.isEmpty()){
|
||||||
|
infoLocale=new InfoLocale("en");
|
||||||
|
} else {
|
||||||
|
infoLocale=new InfoLocale(localeName.substring(0, 2));
|
||||||
|
}
|
||||||
|
setInfoLocale(infoLocale);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void changeLanguage(String localeName) {
|
protected void changeLanguage(String localeName) {
|
||||||
|
@ -385,8 +395,44 @@ public class TabularDataController {
|
||||||
}
|
}
|
||||||
Cookies.setCookie(Constants.TD_LANG_COOKIE, localeName, now);
|
Cookies.setCookie(Constants.TD_LANG_COOKIE, localeName, now);
|
||||||
com.google.gwt.user.client.Window.Location.reload();
|
com.google.gwt.user.client.Window.Location.reload();
|
||||||
|
|
||||||
|
InfoLocale infoLocale;
|
||||||
|
if(localeName==null||localeName.isEmpty()){
|
||||||
|
infoLocale=new InfoLocale("en");
|
||||||
|
} else {
|
||||||
|
infoLocale=new InfoLocale(localeName);
|
||||||
|
}
|
||||||
|
setInfoLocale(infoLocale);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void setInfoLocale(InfoLocale infoLocale){
|
||||||
|
TDGWTServiceAsync.INSTANCE.setLocale(infoLocale,
|
||||||
|
new AsyncCallback<Void>() {
|
||||||
|
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
eventBus.fireEvent(new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
if (caught instanceof TDGWTIsLockedException) {
|
||||||
|
Log.error(caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert("Error Locked",
|
||||||
|
caught.getLocalizedMessage());
|
||||||
|
} else {
|
||||||
|
UtilsGXT3.alert("Error",
|
||||||
|
caught.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSuccess(Void result) {
|
||||||
|
Log.debug("InfoLocale set");
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
public void restoreUISession() {
|
public void restoreUISession() {
|
||||||
checkLocale();
|
checkLocale();
|
||||||
|
|
Loading…
Reference in New Issue