Updated i18n support

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widgetx@113931 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-04-09 15:38:07 +00:00 committed by Giancarlo Panichi
parent 9175c14e0d
commit b83be35272
7 changed files with 111 additions and 16 deletions

View File

@ -2,6 +2,7 @@
<module rename-to='TabularDataWidgetX'> <module rename-to='TabularDataWidgetX'>
<!-- Inherit the core Web Toolkit stuff. --> <!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' /> <inherits name='com.google.gwt.user.User' />
<inherits name="com.google.gwt.i18n.I18N" />
<!-- Other module inherits --> <!-- Other module inherits -->
@ -11,18 +12,39 @@
<inherits name='org.gcube.portlets.user.td.widgetcommonevent.WidgetCommonEvent' /> <inherits name='org.gcube.portlets.user.td.widgetcommonevent.WidgetCommonEvent' />
<!-- -->
<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 --> <!-- Specify the paths for translatable code -->
<source path='client' /> <source path='client' />
<source path='shared' /> <source path='shared' />
<!--Loggers Enabled by default --> <!--Loggers Enabled by default -->
<set-property name="log_ConsoleLogger" value="ENABLED" /> <!-- <set-property name="log_ConsoleLogger" value="ENABLED" /> -->
<!-- Not In GWT 2.6 <set-property name="log_FirebugLogger" value="ENABLED" /> --> <!-- Not In GWT 2.6 <set-property name="log_FirebugLogger" value="ENABLED" /> -->
<set-property name="log_SystemLogger" value="ENABLED" /> <!-- <set-property name="log_SystemLogger" value="ENABLED" /> -->
<set-property name="log_GWTLogger" value="DISABLED" /> <set-property name="log_ConsoleLogger" value="DISABLED" />
<set-property name="log_DivLogger" value="DISABLED" /> <set-property name="log_DivLogger" value="DISABLED" />
<set-property name="log_WindowLogger" value="DISABLED" /> <set-property name="log_GWTLogger" value="DISABLED" />
<set-property name="log_SystemLogger" value="DISABLED" />
</module> </module>

View File

@ -6,6 +6,7 @@ import java.util.List;
import org.gcube.portlets.user.tdwx.client.resources.ResourceBundle; import org.gcube.portlets.user.tdwx.client.resources.ResourceBundle;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Cursor; import com.google.gwt.dom.client.Style.Cursor;
import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.resources.client.ImageResource; import com.google.gwt.resources.client.ImageResource;
@ -51,7 +52,9 @@ public class TextMenu<M> extends Menu {
} }
protected TextField ct, bg, en, sd; protected TextField ct, bg, en, sd;
private TextMenuMessages msgs;
private TextFilter<M> filter; private TextFilter<M> filter;
private List<TextItem> textItems = new ArrayList<TextItem>(); private List<TextItem> textItems = new ArrayList<TextItem>();
private DelayedTask updateTask = new DelayedTask() { private DelayedTask updateTask = new DelayedTask() {
@ -62,6 +65,8 @@ public class TextMenu<M> extends Menu {
} }
}; };
/** /**
* Creates text menu for use with the specified text filter. * Creates text menu for use with the specified text filter.
* *
@ -70,7 +75,8 @@ public class TextMenu<M> extends Menu {
*/ */
public TextMenu(TextFilter<M> filter) { public TextMenu(TextFilter<M> filter) {
this.filter = filter; this.filter = filter;
this.msgs = GWT.create(TextMenuMessages.class);
addBeforeHideHandler(new BeforeHideHandler() { addBeforeHideHandler(new BeforeHideHandler() {
@Override @Override
@ -181,27 +187,28 @@ public class TextMenu<M> extends Menu {
String toolTip = null; String toolTip = null;
for (TextItem item : textItems) { for (TextItem item : textItems) {
TextField field = createTextField(); TextField field = createTextField();
field.setEmptyText(filter.getMessages().emptyText()); field.setEmptyText(msgs.enterFilterText());
switch (item) { switch (item) {
case CONTAINS: case CONTAINS:
icon = ResourceBundle.INSTANCE.textContains(); icon = ResourceBundle.INSTANCE.textContains();
toolTip = new String("Text Contains"); toolTip = new String(msgs.textContains());
ct = field; ct = field;
break; break;
case BEGINS: case BEGINS:
icon = ResourceBundle.INSTANCE.textBegins(); icon = ResourceBundle.INSTANCE.textBegins();
toolTip = new String("Text Begins"); toolTip = new String(msgs.textBegins());
bg = field; bg = field;
break; break;
case ENDS: case ENDS:
icon = ResourceBundle.INSTANCE.textEnds(); icon = ResourceBundle.INSTANCE.textEnds();
toolTip = new String("Text Ends"); toolTip = new String(msgs.textEnds());
en = field; en = field;
break; break;
case SOUNDEX: case SOUNDEX:
icon = ResourceBundle.INSTANCE.textSoundex(); icon = ResourceBundle.INSTANCE.textSoundex();
toolTip = new String("Soundex Algorithm"); toolTip = new String(msgs.soundexAlgorithm());
sd = field; sd = field;
break; break;

View File

@ -0,0 +1,30 @@
package org.gcube.portlets.user.tdwx.client.filter.text;
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 TextMenuMessages extends Messages {
//
@DefaultMessage("Enter filter text...")
String enterFilterText();
@DefaultMessage("Text Contains")
String textContains();
@DefaultMessage("Text Begins")
String textBegins();
@DefaultMessage("Text Ends")
String textEnds();
@DefaultMessage("Soundex Algorithm")
String soundexAlgorithm();
}

View File

@ -2,6 +2,7 @@
<module rename-to='TabularDataWidgetX'> <module rename-to='TabularDataWidgetX'>
<!-- Inherit the core Web Toolkit stuff. --> <!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' /> <inherits name='com.google.gwt.user.User' />
<inherits name="com.google.gwt.i18n.I18N" />
<!-- Other module inherits --> <!-- Other module inherits -->
<inherits name='com.sencha.gxt.ui.GXT' /> <inherits name='com.sencha.gxt.ui.GXT' />
@ -10,18 +11,38 @@
<inherits name='org.gcube.portlets.user.td.widgetcommonevent.WidgetCommonEvent' /> <inherits name='org.gcube.portlets.user.td.widgetcommonevent.WidgetCommonEvent' />
<!-- -->
<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 --> <!-- Specify the paths for translatable code -->
<source path='client' /> <source path='client' />
<source path='shared' /> <source path='shared' />
<!--Loggers Enabled by default --> <!--Loggers Enabled by default -->
<set-property name="log_ConsoleLogger" value="ENABLED" /> <!-- <set-property name="log_ConsoleLogger" value="ENABLED" /> -->
<!-- Not in GWT 2.6 <set-property name="log_FirebugLogger" value="ENABLED" /> --> <!-- Not in GWT 2.6 <set-property name="log_FirebugLogger" value="ENABLED" /> -->
<set-property name="log_SystemLogger" value="ENABLED" /> <!-- <set-property name="log_SystemLogger" value="ENABLED" /> -->
<set-property name="log_GWTLogger" value="DISABLED" /> <set-property name="log_ConsoleLogger" value="DISABLED" />
<set-property name="log_DivLogger" value="DISABLED" /> <set-property name="log_DivLogger" value="DISABLED" />
<set-property name="log_WindowLogger" value="DISABLED" /> <set-property name="log_GWTLogger" value="DISABLED" />
<set-property name="log_SystemLogger" value="DISABLED" />
</module> </module>

View File

@ -0,0 +1,5 @@
enterFilterText = Enter filter text...
textContains = Text Contains
textBegins = Text Begins
textEnds = Text Ends
soundexAlgorithm = Soundex Algorithm

View File

@ -0,0 +1,5 @@
enterFilterText = Inserte un filtro...
textContains = Contiene
textBegins = Comienza
textEnds = Termina
soundexAlgorithm = Algoritmo Soundex

View File

@ -0,0 +1,5 @@
enterFilterText = Inserire del testo come filtro...
textContains = Contiene
textBegins = Inizia
textEnds = Finisce
soundexAlgorithm = Algoritmo Soundex