[kune-commits] r1603 - in trunk: . src/main/java/cc/kune/chat/client/actions src/main/java/cc/kune/common/client src/main/java/cc/kune/common/client/actions/gwtui src/main/java/cc/kune/common/client/actions/ui src/main/java/cc/kune/common/client/actions/ui/descrip src/main/java/cc/kune/common/client/ui src/main/java/cc/kune/common/client/ui/dialogs src/main/java/cc/kune/common/client/ui/dialogs/tabbed src/main/java/cc/kune/common/client/ui/dialogs/wizard src/main/java/cc/kune/common/client/utils src/main/java/cc/kune/core/client/auth src/main/java/cc/kune/core/client/cnt src/main/java/cc/kune/core/client/groups/newgroup src/main/java/cc/kune/core/client/i18n src/main/java/cc/kune/core/client/notify/confirm src/main/java/cc/kune/core/client/sitebar src/main/java/cc/kune/core/client/sitebar/search src/main/java/cc/kune/core/client/sn src/main/java/cc/kune/core/client/ws/entheader src/main/java/cc/kune/core/server/i18n src/main/java/cc/kune/core/server/manager/impl src/main/java/cc/kune/core/shared/dto src/main/java/cc/kune/core/shared/i18n src/main/java/cc/kune/domain src/main/java/cc/kune/gspace/client src/main/java/cc/kune/gspace/client/i18n src/main/java/cc/kune/gspace/client/options src/main/java/cc/kune/gspace/client/resources src/main/java/cc/kune/gspace/client/themes src/main/java/cc/kune/gspace/client/viewers src/main/java/cc/kune/lists/client/actions src/main/java/cc/kune/pspace/client src/main/webapp src/test/java/cc/kune/core/client/i18n
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Sat Nov 12 03:58:37 CET 2011
Author: vjrj_
Date: 2011-11-12 03:58:35 +0100 (Sat, 12 Nov 2011)
New Revision: 1603
Added:
trunk/src/main/java/cc/kune/core/client/i18n/I18nUrlUtils.java
trunk/src/test/java/cc/kune/core/client/i18n/I18nUrlUtilsTest.java
Modified:
trunk/TODO
trunk/src/main/java/cc/kune/chat/client/actions/NewRoomBtn.java
trunk/src/main/java/cc/kune/common/client/SampleEntryPoint.java
trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtButtonGui.java
trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuItemGui.java
trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtIconLabelGui.java
trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuGui.java
trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtSimpleGuiItem.java
trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtSubMenuGui.java
trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractComposedGuiItem.java
trunk/src/main/java/cc/kune/common/client/actions/ui/ActionFlowPanel.java
trunk/src/main/java/cc/kune/common/client/actions/ui/ActionSimplePanel.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescrip.java
trunk/src/main/java/cc/kune/common/client/ui/IconLabel.java
trunk/src/main/java/cc/kune/common/client/ui/dialogs/BasicTopDialog.java
trunk/src/main/java/cc/kune/common/client/ui/dialogs/PromptTopDialog.java
trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPanel.java
trunk/src/main/java/cc/kune/common/client/ui/dialogs/wizard/WizardDialog.java
trunk/src/main/java/cc/kune/common/client/utils/Url.java
trunk/src/main/java/cc/kune/core/client/auth/SignInAbstractPanel.java
trunk/src/main/java/cc/kune/core/client/auth/SignInAbstractPresenter.java
trunk/src/main/java/cc/kune/core/client/cnt/ActionContentToolbarImpl.java
trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java
trunk/src/main/java/cc/kune/core/client/i18n/I18nTranslationServiceMocked.java
trunk/src/main/java/cc/kune/core/client/i18n/I18nUITranslationService.java
trunk/src/main/java/cc/kune/core/client/notify/confirm/UserConfirmPanel.java
trunk/src/main/java/cc/kune/core/client/sitebar/AboutKuneDialog.java
trunk/src/main/java/cc/kune/core/client/sitebar/ErrorsDialog.java
trunk/src/main/java/cc/kune/core/client/sitebar/search/EntitySearchPanel.java
trunk/src/main/java/cc/kune/core/client/sitebar/search/SearchBoxFactory.java
trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.java
trunk/src/main/java/cc/kune/core/client/sn/GroupSNPanel.java
trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java
trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityHeaderPanel.java
trunk/src/main/java/cc/kune/core/server/i18n/I18nTranslationServiceDefault.java
trunk/src/main/java/cc/kune/core/server/manager/impl/I18nTranslationManagerDefault.java
trunk/src/main/java/cc/kune/core/shared/dto/I18nLanguageDTO.java
trunk/src/main/java/cc/kune/core/shared/i18n/I18nTranslationService.java
trunk/src/main/java/cc/kune/domain/I18nLanguage.java
trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.java
trunk/src/main/java/cc/kune/gspace/client/i18n/I18nTranslatorPanel.java
trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsPanel.java
trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPanel.java
trunk/src/main/java/cc/kune/gspace/client/resources/gSpaceArmor.css
trunk/src/main/java/cc/kune/gspace/client/resources/gSpaceArmorTheme.css
trunk/src/main/java/cc/kune/gspace/client/themes/GSpaceThemeSelectorPanel.java
trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsTablePanel.java
trunk/src/main/java/cc/kune/lists/client/actions/NewListAction.java
trunk/src/main/java/cc/kune/lists/client/actions/NewListPostAction.java
trunk/src/main/java/cc/kune/pspace/client/PSpacePanel.java
trunk/src/main/webapp/ws.html
Log:
NEW - # 144: Resolve some i18n typos (sizes, no translated, etc)
http://kune.ourproject.org/issues/ticket/144
NEW - # 156: Give RTL support (for Arabic and other similar languages)
http://kune.ourproject.org/issues/ticket/156
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/TODO 2011-11-12 02:58:35 UTC (rev 1603)
@@ -12,6 +12,20 @@
nick == assigned to
* SHORT-TERM (URGENT)
+** i18n usecase
+| logged | locale in URL | i18n supported | useDB |
+| false | false | false | true |
+| false | false | true | false |
+| false | true | false | true |
+| false | true | true | false |
+| true | false | false | true |
+| true | false | true | false |
+| true | true (same) | true | false |
+| true | true (same) | false | true |
+| true | true(*) (diff) | false | true |
+| true | true(*) (diff) | true | false |
+meta?
+
** TODO multi uploader
http://code.google.com/p/gwt-plupload/
http://www.plupload.com/example_all_runtimes.php
Modified: trunk/src/main/java/cc/kune/chat/client/actions/NewRoomBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/NewRoomBtn.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/chat/client/actions/NewRoomBtn.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -65,7 +65,8 @@
@Override
public void actionPerformed(final ActionEvent event) {
- final Builder builder = new PromptTopDialog.Builder(ID, "Name of the new chatroom?", false, true);
+ final Builder builder = new PromptTopDialog.Builder(ID, i18n.t("Name of the new chatroom?"),
+ false, true, i18n.getDirection());
builder.width("200px").height("50px").firstButtonTitle(i18n.t("Create")).sndButtonTitle(
i18n.t("Cancel")).firstButtonId(CREATE_ID).sndButtonId(CANCEL_ID);
builder.regex(TextUtils.UNIX_NAME).regexText(
Modified: trunk/src/main/java/cc/kune/common/client/SampleEntryPoint.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/SampleEntryPoint.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/common/client/SampleEntryPoint.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -50,114 +50,116 @@
import com.google.gwt.user.client.ui.VerticalPanel;
public class SampleEntryPoint implements EntryPoint {
- public interface ISampleView {
- void addAll(GuiActionDescCollection actions);
+ public interface ISampleView {
+ void addAll(GuiActionDescCollection actions);
+ }
+
+ public class TestAction extends AbstractExtendedAction {
+ public TestAction(final String text) {
+ super(text);
}
- public class TestAction extends AbstractExtendedAction {
- public TestAction(final String text) {
- super(text);
- }
-
- public TestAction(final String text, final String tooltip, final String icon) {
- super(text, tooltip, icon);
- }
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- final String message = "Testing: " + super.getValue(Action.NAME);
- // Log.info(message);
- userMsg.show(message);
- }
+ public TestAction(final String text, final String tooltip, final String icon) {
+ super(text, tooltip, icon);
}
- SimpleUserMessage userMsg = new SimpleUserMessage();
@Override
- public void onModuleLoad() {
+ public void actionPerformed(final ActionEvent event) {
+ final String message = "Testing: " + super.getValue(Action.NAME);
+ // Log.info(message);
+ userMsg.show(message);
+ }
+ }
+ SimpleUserMessage userMsg = new SimpleUserMessage();
- final SampleGinjector ginjector = GWT.create(SampleGinjector.class);
- ginjector.getGxtGuiProvider();
- ginjector.getGuiProvider();
- final GlobalShortcutRegister shortcutRegister = ginjector.getGlobalShortcutRegister();
+ @Override
+ public void onModuleLoad() {
- final GuiActionDescCollection actions = new GuiActionDescCollection();
+ final SampleGinjector ginjector = GWT.create(SampleGinjector.class);
+ ginjector.getGxtGuiProvider();
+ ginjector.getGuiProvider();
+ final GlobalShortcutRegister shortcutRegister = ginjector.getGlobalShortcutRegister();
- final TestAction action = new TestAction("Action 1", "Some tooltip", "oc-testico");
- final TestAction action2 = new TestAction("Action 2");
+ final GuiActionDescCollection actions = new GuiActionDescCollection();
- final KeyStroke shortcut = Shortcut.getShortcut(false, true, false, false, Character.valueOf('C'));
- shortcutRegister.put(shortcut, action);
+ final TestAction action = new TestAction("Action 1", "Some tooltip", "oc-testico");
+ final TestAction action2 = new TestAction("Action 2");
- final ButtonDescriptor simpleBtn = new ButtonDescriptor(action);
- // Same action but different text
- simpleBtn.putValue(Action.NAME, "Action 1 diff name");
+ final KeyStroke shortcut = Shortcut.getShortcut(false, true, false, false, Character.valueOf('C'));
+ shortcutRegister.put(shortcut, action);
- final PushButtonDescriptor pushBtn = new PushButtonDescriptor(action2);
- pushBtn.setPushed(true);
- pushBtn.putValue(Action.NAME, "Push btn");
+ final ButtonDescriptor simpleBtn = new ButtonDescriptor(action);
+ // Same action but different text
+ simpleBtn.putValue(Action.NAME, "Action 1 diff name");
- final ToolbarDescriptor toolbar = new ToolbarDescriptor();
+ final PushButtonDescriptor pushBtn = new PushButtonDescriptor(action2);
+ pushBtn.setPushed(true);
+ pushBtn.putValue(Action.NAME, "Push btn");
- final ToolbarSeparatorDescriptor tsepFill = new ToolbarSeparatorDescriptor(Type.fill, toolbar);
- final ToolbarSeparatorDescriptor toolbarSpace = new ToolbarSeparatorDescriptor(Type.spacer, toolbar);
+ final ToolbarDescriptor toolbar = new ToolbarDescriptor();
- simpleBtn.setParent(toolbar);
- pushBtn.setParent(toolbar);
+ final ToolbarSeparatorDescriptor tsepFill = new ToolbarSeparatorDescriptor(Type.fill, toolbar);
+ final ToolbarSeparatorDescriptor toolbarSpace = new ToolbarSeparatorDescriptor(Type.spacer, toolbar);
- final MenuDescriptor menu = new MenuDescriptor(action);
- menu.putValue(Action.NAME, "Menu");
+ simpleBtn.setParent(toolbar);
+ pushBtn.setParent(toolbar);
- final MenuDescriptor menu2 = new MenuDescriptor(action);
- menu2.putValue(Action.NAME, "Menu2");
+ final MenuDescriptor menu = new MenuDescriptor(action);
+ menu.putValue(Action.NAME, "Menu");
- menu.setParent(toolbar);
- final SubMenuDescriptor submenu = new SubMenuDescriptor("Some Submenu", "tip", "oc-testico");
- submenu.setParent(menu);
- final MenuSeparatorDescriptor menuSep = new MenuSeparatorDescriptor(menu);
+ final MenuDescriptor menu2 = new MenuDescriptor(action);
+ menu2.putValue(Action.NAME, "Menu2");
- final TestAction action3 = new TestAction("Action 3", "Some tooltip", "oc-testico");
- final TestAction action4 = new TestAction("Action 4");
+ menu.setParent(toolbar);
+ final SubMenuDescriptor submenu = new SubMenuDescriptor("Some Submenu", "tip", "oc-testico");
+ submenu.setParent(menu);
+ final MenuSeparatorDescriptor menuSep = new MenuSeparatorDescriptor(menu);
- final MenuItemDescriptor menuItem = new MenuItemDescriptor(menu, action3);
- final MenuItemDescriptor menuItem2 = new MenuItemDescriptor(menu, action4);
- final MenuItemDescriptor menuItem3 = new MenuItemDescriptor(submenu, action);
- final MenuItemDescriptor menuItem4 = new MenuItemDescriptor(submenu, action);
- final IconLabelDescriptor iconLabelDescr = new IconLabelDescriptor(action);
- final IconLabelDescriptor iconLabelNoAct = new IconLabelDescriptor(action4);
- final MenuItemDescriptor menuItem5 = new MenuItemDescriptor(menu2, action);
+ final TestAction action3 = new TestAction("Action 3", "Some tooltip", "oc-testico");
+ final TestAction action4 = new TestAction("Action 4");
- action.setShortcut(shortcut);
+ final MenuItemDescriptor menuItem = new MenuItemDescriptor(menu, action3);
+ final MenuItemDescriptor menuItem2 = new MenuItemDescriptor(menu, action4);
+ final MenuItemDescriptor menuItem3 = new MenuItemDescriptor(submenu, action);
+ final MenuItemDescriptor menuItem4 = new MenuItemDescriptor(submenu, action);
+ final IconLabelDescriptor iconLabelDescr = new IconLabelDescriptor(action);
+ final IconLabelDescriptor iconLabelNoAct = new IconLabelDescriptor(action4);
+ final MenuItemDescriptor menuItem5 = new MenuItemDescriptor(menu2, action);
- actions.add(toolbar, simpleBtn, tsepFill, pushBtn, toolbarSpace, menu, tsepFill, menuItem, menuItem2, menuSep,
- menuItem2, menuItem, iconLabelDescr, submenu, menuItem3, menuItem4, menu2, iconLabelNoAct, menuItem5);
+ action.setShortcut(shortcut);
- final ActionFlowPanel view = new ActionFlowPanel(ginjector.getGuiProvider());
- view.addAll(actions);
+ actions.add(toolbar, simpleBtn, tsepFill, pushBtn, toolbarSpace, menu, tsepFill, menuItem,
+ menuItem2, menuSep, menuItem2, menuItem, iconLabelDescr, submenu, menuItem3, menuItem4, menu2,
+ iconLabelNoAct, menuItem5);
- final IconLabel simpleIconLabel = new IconLabel("IconLabel (no action)");
- simpleIconLabel.setRightIcon("oc-testico");
- simpleIconLabel.setTitle("tooltip");
+ final ActionFlowPanel view = new ActionFlowPanel(ginjector.getGuiProvider(), null);
+ view.addAll(actions);
- final VerticalPanel panel = new VerticalPanel();
- panel.setWidth("100%");
- panel.add(view);
- panel.add(simpleIconLabel);
+ final IconLabel simpleIconLabel = new IconLabel("IconLabel (no action)");
+ simpleIconLabel.setRightIcon("oc-testico");
+ simpleIconLabel.setTitle("tooltip");
- final BasicThumb thumb = new BasicThumb("http://www.truth-out.org/sites/all/themes/truth/images/logo.gif", 60,
- "fooo", 5, false, new ClickHandler() {
+ final VerticalPanel panel = new VerticalPanel();
+ panel.setWidth("100%");
+ panel.add(view);
+ panel.add(simpleIconLabel);
- @Override
- public void onClick(final ClickEvent event) {
- userMsg.show("Testing");
- }
- });
- thumb.setTooltip("kkkkkkK");
- thumb.setOnOverLabel(true);
- final LayoutContainer layout = new LayoutContainer();
- // final QuickTip quickTip = new QuickTip(layout);
- // quickTip.setInterceptTitles(true);
- layout.add(thumb);
- RootPanel.get().add(layout);
- RootPanel.get().add(view);
- }
+ final BasicThumb thumb = new BasicThumb(
+ "http://www.truth-out.org/sites/all/themes/truth/images/logo.gif", 60, "fooo", 5, false,
+ new ClickHandler() {
+
+ @Override
+ public void onClick(final ClickEvent event) {
+ userMsg.show("Testing");
+ }
+ });
+ thumb.setTooltip("kkkkkkK");
+ thumb.setOnOverLabel(true);
+ final LayoutContainer layout = new LayoutContainer();
+ // final QuickTip quickTip = new QuickTip(layout);
+ // quickTip.setInterceptTitles(true);
+ layout.add(thumb);
+ RootPanel.get().add(layout);
+ RootPanel.get().add(view);
+ }
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtButtonGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtButtonGui.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtButtonGui.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -151,7 +151,7 @@
@Override
public void setText(final String text) {
- iconLabel.setText(text);
+ iconLabel.setText(text, descriptor.getDirection());
layout();
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuItemGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuItemGui.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuItemGui.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -216,10 +216,11 @@
if (text != null) {
final KeyStroke key = (KeyStroke) descriptor.getValue(Action.ACCELERATOR_KEY);
if (key == null) {
- iconLabel.setText(text);
+ iconLabel.setText(text, descriptor.getDirection());
} else {
- iconLabel.setLabelText(text + createShortCut(key, "oc-mshortcut-hidden")
- + createShortCut(key, "oc-mshortcut"));
+ iconLabel.setText(
+ text + createShortCut(key, "oc-mshortcut-hidden") + createShortCut(key, "oc-mshortcut"),
+ descriptor.getDirection());
}
}
layout();
Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtIconLabelGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtIconLabelGui.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtIconLabelGui.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -93,7 +93,7 @@
@Override
public void setText(final String text) {
- iconLabel.setText(text);
+ iconLabel.setText(text, descriptor.getDirection());
}
@Override
Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuGui.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtMenuGui.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -132,7 +132,7 @@
@Override
public void setText(final String text) {
if (notStandAlone) {
- iconLabel.setText(text);
+ iconLabel.setText(text, descriptor.getDirection());
layout();
}
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtSimpleGuiItem.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtSimpleGuiItem.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtSimpleGuiItem.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -22,34 +22,35 @@
import cc.kune.common.client.actions.ui.AbstractComposedGuiItem;
import cc.kune.common.client.actions.ui.AbstractGuiItem;
import cc.kune.common.client.actions.ui.bind.GuiProvider;
+import cc.kune.core.shared.i18n.I18nTranslationService;
import com.google.gwt.user.client.ui.HorizontalPanel;
public class GwtSimpleGuiItem extends AbstractComposedGuiItem {
- private final HorizontalPanel bar;
+ private final HorizontalPanel bar;
- public GwtSimpleGuiItem(final GuiProvider provider) {
- super(provider);
- bar = new HorizontalPanel();
- initWidget(bar);
- }
+ public GwtSimpleGuiItem(final GuiProvider provider, final I18nTranslationService i18n) {
+ super(provider, i18n);
+ bar = new HorizontalPanel();
+ initWidget(bar);
+ }
- @Override
- protected void addWidget(final AbstractGuiItem item) {
- bar.add(item);
- }
+ @Override
+ protected void addWidget(final AbstractGuiItem item) {
+ bar.add(item);
+ }
- @Override
- public void clear() {
- super.clear();
- bar.clear();
- }
+ @Override
+ public void clear() {
+ super.clear();
+ bar.clear();
+ }
- @Override
- protected void insertWidget(final AbstractGuiItem item, final int position) {
- final int count = bar.getWidgetCount();
- bar.insert(item, count < position ? count : position);
- }
+ @Override
+ protected void insertWidget(final AbstractGuiItem item, final int position) {
+ final int count = bar.getWidgetCount();
+ bar.insert(item, count < position ? count : position);
+ }
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtSubMenuGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtSubMenuGui.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/GwtSubMenuGui.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -79,7 +79,7 @@
@Override
public void setText(final String text) {
- iconLabel.setText(text);
+ iconLabel.setText(text, descriptor.getDirection());
layout();
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractComposedGuiItem.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractComposedGuiItem.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractComposedGuiItem.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -28,16 +28,19 @@
import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
import cc.kune.common.client.actions.ui.descrip.HasChilds;
import cc.kune.common.client.errors.UIException;
+import cc.kune.core.shared.i18n.I18nTranslationService;
import com.google.gwt.user.client.ui.Composite;
public abstract class AbstractComposedGuiItem extends Composite implements IsActionExtensible {
private final GuiProvider bindings;
private GuiActionDescCollection guiItems;
+ private final I18nTranslationService i18n;
- public AbstractComposedGuiItem(final GuiProvider bindings) {
+ public AbstractComposedGuiItem(final GuiProvider bindings, final I18nTranslationService i18n) {
super();
this.bindings = bindings;
+ this.i18n = i18n;
}
public void add(final GuiActionDescCollection descriptors) {
@@ -80,6 +83,8 @@
if (binding == null) {
throw new UIException("Unknown binding for: " + descrip);
} else {
+ // We set at that moment if the widget should be RTL or not
+ descrip.setRTL(i18n.isRTL());
final AbstractGuiItem item = binding.create(descrip);
if (binding.shouldBeAdded()) {
// TODO Change this ^ to shouldBeAttached
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/ActionFlowPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/ActionFlowPanel.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/ActionFlowPanel.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -20,35 +20,36 @@
package cc.kune.common.client.actions.ui;
import cc.kune.common.client.actions.ui.bind.GuiProvider;
+import cc.kune.core.shared.i18n.I18nTranslationService;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.inject.Inject;
public class ActionFlowPanel extends AbstractComposedGuiItem implements ActionExtensibleView {
- private final FlowPanel bar;
+ private final FlowPanel bar;
- @Inject
- public ActionFlowPanel(final GuiProvider guiProvider) {
- super(guiProvider);
- bar = new FlowPanel();
- initWidget(bar);
- }
+ @Inject
+ public ActionFlowPanel(final GuiProvider guiProvider, final I18nTranslationService i18n) {
+ super(guiProvider, i18n);
+ bar = new FlowPanel();
+ initWidget(bar);
+ }
- @Override
- protected void addWidget(final AbstractGuiItem item) {
- bar.add(item);
- }
+ @Override
+ protected void addWidget(final AbstractGuiItem item) {
+ bar.add(item);
+ }
- @Override
- public void clear() {
- super.clear();
- bar.clear();
- }
+ @Override
+ public void clear() {
+ super.clear();
+ bar.clear();
+ }
- @Override
- protected void insertWidget(final AbstractGuiItem item, final int position) {
- final int count = bar.getWidgetCount();
- bar.insert(item, count < position ? count : position);
- }
+ @Override
+ protected void insertWidget(final AbstractGuiItem item, final int position) {
+ final int count = bar.getWidgetCount();
+ bar.insert(item, count < position ? count : position);
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/ActionSimplePanel.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/ActionSimplePanel.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/ActionSimplePanel.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -20,35 +20,36 @@
package cc.kune.common.client.actions.ui;
import cc.kune.common.client.actions.ui.bind.GuiProvider;
+import cc.kune.core.shared.i18n.I18nTranslationService;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.inject.Inject;
public class ActionSimplePanel extends AbstractComposedGuiItem implements ActionExtensibleView {
- private final HorizontalPanel bar;
+ private final HorizontalPanel bar;
- @Inject
- public ActionSimplePanel(final GuiProvider guiProvider) {
- super(guiProvider);
- bar = new HorizontalPanel();
- initWidget(bar);
- }
+ @Inject
+ public ActionSimplePanel(final GuiProvider guiProvider, final I18nTranslationService i18n) {
+ super(guiProvider, i18n);
+ bar = new HorizontalPanel();
+ initWidget(bar);
+ }
- @Override
- protected void addWidget(final AbstractGuiItem item) {
- bar.add(item);
- }
+ @Override
+ protected void addWidget(final AbstractGuiItem item) {
+ bar.add(item);
+ }
- @Override
- public void clear() {
- super.clear();
- bar.clear();
- }
+ @Override
+ public void clear() {
+ super.clear();
+ bar.clear();
+ }
- @Override
- protected void insertWidget(final AbstractGuiItem item, final int position) {
- final int count = bar.getWidgetCount();
- bar.insert(item, count < position ? count : position);
- }
+ @Override
+ protected void insertWidget(final AbstractGuiItem item, final int position) {
+ final int count = bar.getWidgetCount();
+ bar.insert(item, count < position ? count : position);
+ }
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -29,6 +29,8 @@
import cc.kune.common.client.actions.KeyStroke;
import cc.kune.core.client.dnd.DropTarget;
+import com.google.gwt.i18n.client.HasDirection.Direction;
+
/**
* The Class AbstractUIActionDescriptor.
*/
@@ -42,6 +44,9 @@
/** The item DOM id. */
private String id;
+ /** If is a Rigth-to-Left widget (for languages like Arabic) */
+ private boolean isRTL = false;
+
/** The item location. */
private String location;
@@ -82,6 +87,11 @@
}
@Override
+ public Direction getDirection() {
+ return isRTL ? Direction.RTL : Direction.LTR;
+ }
+
+ @Override
public String getId() {
return id;
}
@@ -149,6 +159,11 @@
}
@Override
+ public boolean isRTL() {
+ return isRTL;
+ }
+
+ @Override
public boolean isVisible() {
return (Boolean) getValue(VISIBLE);
}
@@ -225,6 +240,11 @@
}
@Override
+ public void setRTL(final boolean isRTL) {
+ this.isRTL = isRTL;
+ }
+
+ @Override
public void setStyles(final String styles) {
putValue(Action.STYLES, styles);
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescrip.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescrip.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescrip.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -25,6 +25,8 @@
import cc.kune.common.client.actions.PropertyChangeListener;
import cc.kune.core.client.dnd.DropTarget;
+import com.google.gwt.i18n.client.HasDirection.Direction;
+
public interface GuiActionDescrip {
public static final String DROP_TARGET = "dropTarget";
@@ -51,6 +53,8 @@
AbstractAction getAction();
+ Direction getDirection();
+
String getId();
Object[] getKeys();
@@ -75,6 +79,8 @@
boolean isEnabled();
+ boolean isRTL();
+
boolean isVisible();
boolean mustBeAdded();
@@ -105,6 +111,8 @@
void setPosition(final int position);
+ void setRTL(final boolean isRTL);
+
void setStyles(final String styles);
void setTarget(final Object object);
Modified: trunk/src/main/java/cc/kune/common/client/ui/IconLabel.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/IconLabel.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/common/client/ui/IconLabel.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -136,10 +136,6 @@
self.ensureDebugId(id);
}
- public void setLabelText(final String text) {
- label.setText(text);
- }
-
public void setLeftIcon(final String imgCss) {
commonStyle(iconLeft, imgCss);
iconLeft.addStyleName("k-iconlabel-left");
Modified: trunk/src/main/java/cc/kune/common/client/ui/dialogs/BasicTopDialog.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/dialogs/BasicTopDialog.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/common/client/ui/dialogs/BasicTopDialog.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -29,6 +29,7 @@
import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.i18n.client.HasDirection.Direction;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.UIObject;
@@ -40,6 +41,7 @@
private boolean autoscroll = false;
private boolean closeBtn = true;
private final String dialogId;
+ private final Direction direction;
private String firstButtonId;
private String firstButtonTitle;
private String height;
@@ -51,11 +53,13 @@
private String title;
private String width;
- public Builder(final String dialogId, final boolean autohide, final boolean modal) {
+ public Builder(final String dialogId, final boolean autohide, final boolean modal,
+ final Direction direction) {
// Required params
this.autohide = autohide;
this.modal = modal;
this.dialogId = dialogId;
+ this.direction = direction;
}
public Builder autoscroll(final boolean autoscroll) {
@@ -139,7 +143,7 @@
popup = new PopupTopPanel(builder.autohide, builder.modal);
popup.add(this);
popup.ensureDebugId(builder.dialogId);
- super.getTitleText().setText(builder.title);
+ super.getTitleText().setText(builder.title, builder.direction);
if (TextUtils.notEmpty(builder.icon)) {
super.setTitleIcon(builder.icon);
}
@@ -150,7 +154,7 @@
super.setSecondBtnText(builder.sndButtonTitle);
super.setSecondBtnId(builder.sndButtonId);
super.setSecondBtnTabIndex(builder.tabIndexStart + 1);
- super.getTitleText().setText(builder.title);
+ super.getTitleText().setText(builder.title, builder.direction);
setWidthImpl(builder.width);
setHeightImpl(builder.height);
recalculateSize();
Modified: trunk/src/main/java/cc/kune/common/client/ui/dialogs/PromptTopDialog.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/dialogs/PromptTopDialog.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/common/client/ui/dialogs/PromptTopDialog.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -20,6 +20,7 @@
package cc.kune.common.client.ui.dialogs;
import com.extjs.gxt.ui.client.widget.form.TextField;
+import com.google.gwt.i18n.client.HasDirection.Direction;
public class PromptTopDialog extends BasicTopDialog {
@@ -36,8 +37,8 @@
private int width = 0;
public Builder(final String dialogId, final String promptText, final boolean autohide,
- final boolean modal) {
- super(dialogId, autohide, modal);
+ final boolean modal, final Direction direction) {
+ super(dialogId, autohide, modal, direction);
super.title(promptText);
}
Modified: trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPanel.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPanel.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -36,6 +36,7 @@
import com.google.gwt.event.logical.shared.HasCloseHandlers;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
+import com.google.gwt.i18n.client.HasDirection.Direction;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
@@ -50,6 +51,7 @@
private final boolean autohide;
private BasicTopDialog dialog;
private final String dialogId;
+ private final Direction direction;
private final String errorLabelId;
private final String firstBtnId;
private final String firstBtnTitle;
@@ -69,7 +71,7 @@
public AbstractTabbedDialogPanel(final String dialogId, final String title, final boolean modal,
final boolean autoHide, final NotifyLevelImages images, final String errorLabelId,
final String firstBtnTitle, final String firstBtnId, final String sndBtnTitle,
- final String sndBtnId, final ProvidersCollection provCollection) {
+ final String sndBtnId, final ProvidersCollection provCollection, final Direction direction) {
this.dialogId = dialogId;
this.title = title;
this.modal = modal;
@@ -81,22 +83,24 @@
this.sndBtnId = sndBtnId;
this.provCollection = provCollection;
this.autohide = autoHide;
+ this.direction = direction;
}
public AbstractTabbedDialogPanel(final String dialogId, final String title, final boolean modal,
final NotifyLevelImages images, final String errorLabelId, final String firstBtnTitle,
final String firstBtnId, final String sndBtnTitle, final String sndBtnId,
- final ProvidersCollection provCollection) {
+ final ProvidersCollection provCollection, final Direction direction) {
this(dialogId, title, NO_SIZE, NO_SIZE, modal, false, images, errorLabelId, firstBtnTitle,
- firstBtnId, sndBtnTitle, sndBtnId, provCollection);
+ firstBtnId, sndBtnTitle, sndBtnId, provCollection, direction);
}
public AbstractTabbedDialogPanel(final String dialogId, final String title, final int width,
final int height, final boolean modal, final boolean autoHide, final NotifyLevelImages images,
final String errorLabelId, final String firstBtnTitle, final String firstBtnId,
- final String sndBtnTitle, final String sndBtnId, final ProvidersCollection provCollection) {
+ final String sndBtnTitle, final String sndBtnId, final ProvidersCollection provCollection,
+ final Direction direction) {
this(dialogId, title, modal, autoHide, images, errorLabelId, firstBtnTitle, firstBtnId, sndBtnTitle,
- sndBtnId, provCollection);
+ sndBtnId, provCollection, direction);
this.width = width;
this.height = height;
}
@@ -104,9 +108,9 @@
public AbstractTabbedDialogPanel(final String dialogId, final String title, final int width,
final int height, final boolean modal, final NotifyLevelImages images, final String errorLabelId,
final String firstBtnTitle, final String firstBtnId, final String sndBtnTitle,
- final String sndBtnId, final ProvidersCollection provCollection) {
+ final String sndBtnId, final ProvidersCollection provCollection, final Direction direction) {
this(dialogId, title, width, height, modal, false, images, errorLabelId, firstBtnTitle, firstBtnId,
- sndBtnTitle, sndBtnId, provCollection);
+ sndBtnTitle, sndBtnId, provCollection, direction);
}
@Override
@@ -129,9 +133,9 @@
}
private void createDialog() {
- final Builder builder = new BasicTopDialog.Builder(dialogId, autohide, modal).autoscroll(true).icon(
- iconCls).firstButtonId(firstBtnId).firstButtonTitle(firstBtnTitle).sndButtonId(dialogId).sndButtonTitle(
- sndBtnTitle).sndButtonId(sndBtnId).title(title);
+ final Builder builder = new BasicTopDialog.Builder(dialogId, autohide, modal, direction).autoscroll(
+ true).icon(iconCls).firstButtonId(firstBtnId).firstButtonTitle(firstBtnTitle).sndButtonId(
+ dialogId).sndButtonTitle(sndBtnTitle).sndButtonId(sndBtnId).title(title);
if (width != NO_SIZE) {
builder.width(String.valueOf(width + 20) + "px");
}
Modified: trunk/src/main/java/cc/kune/common/client/ui/dialogs/wizard/WizardDialog.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/dialogs/wizard/WizardDialog.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/common/client/ui/dialogs/wizard/WizardDialog.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -62,8 +62,8 @@
this.maskWidget = maskWidget;
this.listener = listener;
this.i18n = i18n;
- final Builder dialogBuilder = new BasicTopDialog.Builder(dialogId, false, modal).width(width).height(
- height).firstButtonId(cancelId).sndButtonId(finishId).title(header);
+ final Builder dialogBuilder = new BasicTopDialog.Builder(dialogId, false, modal, i18n.getDirection()).width(
+ width).height(height).firstButtonId(cancelId).sndButtonId(finishId).title(header);
dialog = dialogBuilder.build();
dialog.setFirstBtnText(i18n.tWithNT("Cancel", "used in button"));
dialog.getFirstBtn().addClickHandler(new ClickHandler() {
Modified: trunk/src/main/java/cc/kune/common/client/utils/Url.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/utils/Url.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/common/client/utils/Url.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -20,44 +20,44 @@
package cc.kune.common.client.utils;
import java.util.ArrayList;
-import java.util.List;
public class Url {
- private final String base;
- private final List<UrlParam> params;
+ private final String base;
+ private final ArrayList<UrlParam> params;
- public Url(final String base) {
- this.base = base;
- params = new ArrayList<UrlParam>();
- }
+ public Url(final String base) {
+ this.base = base;
+ params = new ArrayList<UrlParam>();
+ }
- public Url(final String base, final UrlParam... iniParams) {
- this(base);
- for (UrlParam param : iniParams) {
- addImpl(param);
- }
+ public Url(final String base, final UrlParam... iniParams) {
+ this(base);
+ for (final UrlParam param : iniParams) {
+ addImpl(param);
}
+ }
- public void add(final UrlParam param) {
- addImpl(param);
- }
+ public void add(final UrlParam param) {
+ addImpl(param);
+ }
- @Override
- public String toString() {
- String paramPart = "";
- boolean first = true;
- for (UrlParam param : params) {
- if (first) {
- paramPart = "?" + param;
- first = false;
- } else {
- paramPart += "&" + param;
- }
- }
- return base + paramPart;
+ private void addImpl(final UrlParam param) {
+ params.add(param);
+ }
+
+ @Override
+ public String toString() {
+ String paramPart = "";
+ boolean first = true;
+ for (final UrlParam param : params) {
+ if (first) {
+ paramPart = "?" + param;
+ first = false;
+ } else {
+ paramPart += "&" + param;
+ }
}
+ return base + paramPart;
+ }
- private void addImpl(final UrlParam param) {
- params.add(param);
- }
}
Modified: trunk/src/main/java/cc/kune/core/client/auth/SignInAbstractPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/SignInAbstractPanel.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/core/client/auth/SignInAbstractPanel.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -49,8 +49,8 @@
final String firstButtonId, final String cancelButtonTitle, final String cancelButtonId,
final NotifyLevelImages images, final String errorLabelId, final int tabIndexStart) {
- final Builder builder = new BasicTopDialog.Builder(dialogId, autohide, modal).autoscroll(autoscroll).title(
- title);
+ final Builder builder = new BasicTopDialog.Builder(dialogId, autohide, modal, i18n.getDirection()).autoscroll(
+ autoscroll).title(title);
builder.icon(icon);
builder.firstButtonTitle(firstButtonTitle).firstButtonId(firstButtonId);
builder.sndButtonTitle(cancelButtonTitle).sndButtonId(cancelButtonId);
Modified: trunk/src/main/java/cc/kune/core/client/auth/SignInAbstractPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/SignInAbstractPresenter.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/core/client/auth/SignInAbstractPresenter.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -92,12 +92,13 @@
session.setUserHash(userHash);
session.setCurrentUserInfo(userInfoDTO);
final I18nLanguageDTO language = userInfoDTO.getLanguage();
- i18n.changeCurrentLanguage(language.getCode());
session.setCurrentLanguage(language);
- if (gotoHomePage) {
- stateManager.gotoStateToken(new StateToken(userInfoDTO.getHomePage()).clearDocument());
- } else {
- stateManager.redirectOrRestorePreviousToken();
+ if (!i18n.changeToLanguageIfNecessary(language.getCode())) {
+ if (gotoHomePage) {
+ stateManager.gotoStateToken(new StateToken(userInfoDTO.getHomePage()).clearDocument());
+ } else {
+ stateManager.redirectOrRestorePreviousToken();
+ }
}
}
Modified: trunk/src/main/java/cc/kune/core/client/cnt/ActionContentToolbarImpl.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/cnt/ActionContentToolbarImpl.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/core/client/cnt/ActionContentToolbarImpl.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -21,6 +21,7 @@
import cc.kune.common.client.actions.ui.ActionFlowPanel;
import cc.kune.common.client.actions.ui.bind.GuiProvider;
+import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.GSpaceArmor;
import com.google.gwt.user.client.ui.InsertPanel.ForIsWidget;
@@ -28,25 +29,26 @@
public class ActionContentToolbarImpl extends ActionFlowPanel implements ActionContentToolbar {
- private final ForIsWidget wsToolbar;
+ private final ForIsWidget wsToolbar;
- @Inject
- public ActionContentToolbarImpl(final GuiProvider guiProvider, final GSpaceArmor wsArmor) {
- super(guiProvider);
- this.wsToolbar = wsArmor.getDocSubheader();
- }
+ @Inject
+ public ActionContentToolbarImpl(final GuiProvider guiProvider, final GSpaceArmor wsArmor,
+ final I18nTranslationService i18n) {
+ super(guiProvider, i18n);
+ this.wsToolbar = wsArmor.getDocSubheader();
+ }
- @Override
- public void attach() {
- if (!this.isAttached()) {
- wsToolbar.add(this);
- }
+ @Override
+ public void attach() {
+ if (!this.isAttached()) {
+ wsToolbar.add(this);
}
+ }
- @Override
- public void detach() {
- if (this.isAttached()) {
- this.removeFromParent();
- }
+ @Override
+ public void detach() {
+ if (this.isAttached()) {
+ this.removeFromParent();
}
+ }
}
Modified: trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -82,8 +82,8 @@
public NewGroupPanel(final I18nTranslationService i18n, final NotifyLevelImages img,
final MaskWidgetView mask, final GroupFieldFactory groupFieldFactory) {
this.groupFieldFactory = groupFieldFactory;
- final Builder builder = new BasicTopDialog.Builder(NEWGROUP_WIZARD, false, true).autoscroll(true).title(
- i18n.t("Register a new group"));
+ final Builder builder = new BasicTopDialog.Builder(NEWGROUP_WIZARD, false, true, i18n.getDirection()).autoscroll(
+ true).title(i18n.t("Register a new group"));
builder.icon("k-newgroup-icon");
builder.firstButtonTitle(i18n.t("Register")).firstButtonId(REGISTER_BUTTON);
builder.sndButtonTitle(i18n.t("Cancel")).sndButtonId(CANCEL_BUTTON);
Modified: trunk/src/main/java/cc/kune/core/client/i18n/I18nTranslationServiceMocked.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/i18n/I18nTranslationServiceMocked.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/core/client/i18n/I18nTranslationServiceMocked.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -24,6 +24,11 @@
public class I18nTranslationServiceMocked extends I18nTranslationService {
@Override
+ public boolean isRTL() {
+ return false;
+ }
+
+ @Override
public String tWithNT(final String text, final String noteForTranslators) {
final String encodeText = TextUtils.escapeHtmlLight(text);
final String translation = encodeText;
Modified: trunk/src/main/java/cc/kune/core/client/i18n/I18nUITranslationService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/i18n/I18nUITranslationService.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/core/client/i18n/I18nUITranslationService.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -52,6 +52,7 @@
private String currentLanguageCode;
private final Set<Pair<String, String>> earlyTexts;
private final I18nServiceAsync i18nService;
+ private boolean isCurrentLangRTL = false;
private boolean isLangInProperties;
private final KuneConstants kuneConstants;
private HashMap<String, String> lexicon;
@@ -70,19 +71,11 @@
Log.info("Workspace starting with language: " + currentLocale.getLocaleName() + ", isRTL: "
+ LocaleInfo.getCurrentLocale().isRTL() + ", translated langs: "
+ Arrays.toString(LocaleInfo.getAvailableLocaleNames()));
+ isLangInProperties = isInConstantProperties(currentLocale.getLocaleName());
earlyTexts = new HashSet<Pair<String, String>>();
i18nService.getInitialLanguage(locale, new AsyncCallback<I18nLanguageDTO>() {
- private boolean isInConstantProperties(final I18nLanguageDTO currentLang) {
- for (final String lang : LocaleInfo.getAvailableLocaleNames()) {
- if (lang.equals(currentLang.getCode())) {
- return true;
- }
- }
- return false;
- }
-
@Override
public void onFailure(final Throwable caught) {
Log.error("Workspace adaptation to your language failed: " + caught.getMessage());
@@ -93,20 +86,25 @@
currentLang = result;
currentLanguageCode = currentLang.getCode();
session.setCurrentLanguage(currentLang);
- isLangInProperties = isInConstantProperties(currentLang);
+ isLangInProperties = isInConstantProperties(currentLang.getCode());
i18nService.getLexicon(currentLang.getCode(), new AsyncCallback<HashMap<String, String>>() {
@Override
public void onFailure(final Throwable caught) {
- Log.error("Workspace adaptation to your language failed: " + caught.getMessage());
+ Log.error("Workspace adaptation to server proposed language failed: " + caught.getMessage());
}
@Override
public void onSuccess(final HashMap<String, String> result) {
lexicon = result;
session.setCurrentLanguage(currentLang);
- Log.info("Workspace adaptation to language: " + currentLang.getEnglishName() + ", isRTL: "
- + currentLang.getDirection());
- eventBus.fireEvent(new I18nReadyEvent());
+ Log.info("Workspace adaptation to server proposed language: " + currentLang.getEnglishName()
+ + ", isRTL: " + currentLang.getDirection() + " use properties: "
+ + shouldIuseProperties());
+
+ if (!changeToLanguageIfNecessary(getCurrentGWTlanguage(), currentLang.getCode())) {
+ isCurrentLangRTL = currentLang.getDirection().equals(RTL);
+ eventBus.fireEvent(new I18nReadyEvent());
+ }
}
});
session.onUserSignIn(true, new UserSignInHandler() {
@@ -126,19 +124,22 @@
}
});
}
-
});
}
- public void changeCurrentLanguage(final String newLanguage) {
- if (!newLanguage.equals(this.currentLanguageCode)) {
- setCurrentLanguage(newLanguage);
- changeLocale(newLanguage);
- }
- }
+ /**
+ * https://developer.mozilla.org/en/DOM/window.location
+ *
+ * "If you need to change pathname but keep the hash as is, use the replace() method instead, which should work consistently across browsers."
+ *
+ * @param newUrl
+ */
+ private native void changeHref(String newUrl) /*-{
+ // $wnd.location.href = newUrl;
+ $wnd.location.replace(newUrl);
+ }-*/;
/**
- *
* See in:
* http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread
* /5e4e25050d3be984/7035ec39354d06aa?lnk=gst&q=get+locale&rnum=23
@@ -146,35 +147,39 @@
* JSNI method to change the locale of the application - it effectively parses
* the existing URL and creates a new one for the chosen locale.
*
- * It additionally launches any JavaScript debugger that might be attached to
- * the system (Windows only). To disable this functionality just remove the
- * "debugger" line.
- *
* @param newLocale
* String value of the new locale to go to.
*/
- private native void changeLocale(String newLocale)
- // FIXME: this now does not works correctly with hosted mode (and also give
- // some "Opss" in server side)
- /*-{
- // Uncomment the "debugger;" line to see how to set debug statements in JSNI code
- // When in web mode, if your browser has a JavaScript debugger attached, it will
- // launch at this point in the code (when the user changes locale through the menu system).
- // debugger;
+ private void changeLanguageInUrl(final String newLocale) {
+ final String hash = WindowUtils.getLocation().getHash();
+ final String query = WindowUtils.getLocation().getQueryString();
+ final String newUrl = I18nUrlUtils.changeLang(query + (TextUtils.notEmpty(hash) ? hash : ""),
+ newLocale);
+ Log.info("Locale current query: " + query);
+ Log.info("Locale current hash: " + hash);
+ Log.info("Locale new Url: " + newUrl);
+ changeHref("http://" + WindowUtils.getLocation().getHost() + newUrl);
+ }
- // Get the current location
- var currLocation = $wnd.location.toString();
- // Get rid of any GWT History tokens that might be present
- var noHistoryCurrLocArray = currLocation.split("#");
- var noHistoryCurrLoc = noHistoryCurrLocArray[0];
- var currHistory = noHistoryCurrLocArray[1];
- // Get rid of any locale string
- var locArray = noHistoryCurrLoc.split("?");
- // Build the new href location and then send the browser there.
- // $wnd.location.href = locArray[0]+"?locale="+newLocale+"#"+currHistory;
- $wnd.location.href = locArray[0] + "?locale=" + newLocale
- }-*/;
+ public boolean changeToLanguageIfNecessary(final String wantedLang) {
+ return changeToLanguageIfNecessary(currentLang.getCode(), wantedLang);
+ }
+ /**
+ *
+ * @param wantedLanguage
+ * to check and to change to
+ * @return true if we should reload the client with the new language
+ */
+ public boolean changeToLanguageIfNecessary(final String currentLang, final String wantedLang) {
+ if (!currentLang.equals(wantedLang) && isInConstantProperties(wantedLang)) {
+ setCurrentLanguage(wantedLang);
+ changeLanguageInUrl(wantedLang);
+ return true;
+ }
+ return false;
+ }
+
public String formatDateWithLocale(final Date date) {
return formatDateWithLocale(date, false);
}
@@ -199,6 +204,12 @@
return dateFormated;
}
+ private String getCurrentGWTlanguage() {
+ String gwtLang = LocaleInfo.getCurrentLocale().getLocaleName();
+ gwtLang = gwtLang.equals("default") ? "en" : gwtLang;
+ return gwtLang;
+ }
+
public String getCurrentLanguage() {
return currentLanguageCode;
}
@@ -242,6 +253,22 @@
return decodeHtml(translation);
}
+ private boolean isInConstantProperties(final String currentLang) {
+ for (final String lang : LocaleInfo.getAvailableLocaleNames()) {
+ if (lang.equals(currentLang)) {
+ Log.info("Workspace adaptation to language: " + currentLang + " is in properties");
+ return true;
+ }
+ }
+ Log.info("Workspace adaptation to language: " + currentLang + " is not in properties");
+ return false;
+ }
+
+ @Override
+ public boolean isRTL() {
+ return isCurrentLangRTL;
+ }
+
private void save(final String text, final String noteForTranslators) {
i18nService.getTranslation(session.getUserHash(), currentLanguageCode, text, noteForTranslators,
new AsyncCallback<String>() {
@@ -268,6 +295,10 @@
lexicon.put(text, translation);
}
+ private boolean shouldIuseProperties() {
+ return isLangInProperties;
+ }
+
/**
* In production, this method uses a hashmap. In development, if the text is
* not in the hashmap, it makes a server petition (that stores the text
@@ -286,7 +317,7 @@
}
final String encodeText = TextUtils.escapeHtmlLight(text);
- if (isLangInProperties) {
+ if (shouldIuseProperties()) {
// The db translations now are in properties files (more stable)
try {
return kuneConstants.getString(I18nUtils.convertMethodName(text + " " + noteForTranslators));
Added: trunk/src/main/java/cc/kune/core/client/i18n/I18nUrlUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/i18n/I18nUrlUtils.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/i18n/I18nUrlUtils.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -0,0 +1,36 @@
+package cc.kune.core.client.i18n;
+
+import cc.kune.common.client.utils.TextUtils;
+import cc.kune.common.client.utils.Url;
+import cc.kune.common.client.utils.UrlParam;
+
+public class I18nUrlUtils {
+
+ private static void addLangParam(final String lang, final Url changedUrl) {
+ changedUrl.add(new UrlParam("locale", lang));
+ }
+
+ public static String changeLang(final String url, final String lang) {
+ final String[] hashSplitted = url.split("#");
+ final String hash = hashSplitted.length > 1 ? hashSplitted[1] : "";
+ String query = hashSplitted.length >= 1 ? hashSplitted[0] : (url.equals("#") ? "" : url);
+ query = query.startsWith("?") ? query.substring(1) : query;
+ final String[] params = query.split("&");
+ final Url changedUrl = new Url("");
+ if (!query.contains("locale")) {
+ addLangParam(lang, changedUrl);
+ }
+ for (final String param : params) {
+ if (TextUtils.notEmpty(param)) {
+ final String[] pair = param.split("=");
+ if (pair[0].equals("locale")) {
+ addLangParam(lang, changedUrl);
+ } else {
+ changedUrl.add(new UrlParam(pair[0], pair[1]));
+ }
+ }
+ }
+ return changedUrl.toString() + (url.contains("#") ? "#" + hash : "");
+ }
+
+}
Modified: trunk/src/main/java/cc/kune/core/client/notify/confirm/UserConfirmPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/notify/confirm/UserConfirmPanel.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/core/client/notify/confirm/UserConfirmPanel.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -44,8 +44,8 @@
@Inject
public UserConfirmPanel(final I18nTranslationService i18n) {
- dialog = new BasicTopDialog.Builder(DIALOG_ID, false, true).autoscroll(false).firstButtonId(OK_ID).sndButtonId(
- CANCEL_ID).tabIndexStart(1).build();
+ dialog = new BasicTopDialog.Builder(DIALOG_ID, false, true, i18n.getDirection()).autoscroll(false).firstButtonId(
+ OK_ID).sndButtonId(CANCEL_ID).tabIndexStart(1).build();
askLabel = new HTML();
askLabel.addStyleName("k-userconfirm-label");
dialog.getInnerPanel().add(askLabel);
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/AboutKuneDialog.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/AboutKuneDialog.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/AboutKuneDialog.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -47,7 +47,7 @@
@Inject
public AboutKuneDialog(final I18nTranslationService i18n) {
- dialog = new BasicTopDialog.Builder(ABOUT_KUNE_ID, true, true).title(
+ dialog = new BasicTopDialog.Builder(ABOUT_KUNE_ID, true, true, i18n.getDirection()).title(
i18n.tWithNT("About Kune", "title of dialog")).autoscroll(false).firstButtonTitle(i18n.t("Ok")).firstButtonId(
ABOUT_KUNE_BTN_ID).tabIndexStart(1).height("300px").width("410px").build();
dialog.getInnerPanel().add(BINDER.createAndBindUi(this));
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/ErrorsDialog.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/ErrorsDialog.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/ErrorsDialog.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -54,9 +54,9 @@
@Inject
public ErrorsDialog(final I18nTranslationService i18n, final EventBus eventBus) {
- dialog = new BasicTopDialog.Builder(ERROR_LOGGER_ID, true, true).title(i18n.t("Errors info")).autoscroll(
- true).firstButtonTitle(i18n.t("Ok")).firstButtonId(ERROR_LOGGER_BUTTON_ID).tabIndexStart(1).width(
- "400px").height("400px").build();
+ dialog = new BasicTopDialog.Builder(ERROR_LOGGER_ID, true, true, i18n.getDirection()).title(
+ i18n.t("Errors info")).autoscroll(true).firstButtonTitle(i18n.t("Ok")).firstButtonId(
+ ERROR_LOGGER_BUTTON_ID).tabIndexStart(1).width("400px").height("400px").build();
dialog.getTitleText().setText(i18n.t("Info about errors"));
final InlineLabel subTitle = new InlineLabel(
i18n.t("Please copy/paste this info to report problems"));
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/search/EntitySearchPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/search/EntitySearchPanel.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/search/EntitySearchPanel.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -52,8 +52,8 @@
public EntitySearchPanel(final CoreResources img, final I18nUITranslationService i18n) {
this.i18n = i18n;
- dialog = new BasicTopDialog.Builder(DIALOG_ID, false, true).autoscroll(false).firstButtonId(OK_ID).tabIndexStart(
- 1).build();
+ dialog = new BasicTopDialog.Builder(DIALOG_ID, false, true, i18n.getDirection()).autoscroll(false).firstButtonId(
+ OK_ID).tabIndexStart(1).build();
dialog.setFirstBtnText(i18n.t("Close"));
dialog.setSecondBtnVisible(false);
dialog.getFirstBtn().addClickHandler(new ClickHandler() {
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/search/SearchBoxFactory.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/search/SearchBoxFactory.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/search/SearchBoxFactory.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -4,6 +4,7 @@
import cc.kune.core.client.i18n.I18nUITranslationService;
import cc.kune.core.shared.SearcherConstants;
+import com.google.gwt.i18n.client.HasDirection.Direction;
import com.google.gwt.user.client.ui.SuggestBox;
import com.google.gwt.user.client.ui.SuggestOracle.Suggestion;
@@ -43,6 +44,7 @@
suggestBox,
searchOnlyUsers ? i18n.t("Type something to search for users in [%s]", siteCommonName) : i18n.t(
"Type something to search for users and groups in [%s]", siteCommonName));
+ suggestBox.getTextBox().setDirection(i18n.isRTL() ? Direction.RTL : Direction.LTR);
return multivalueSBox;
}
Modified: trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -115,7 +115,7 @@
this.avatarDecoratorProv = avatarDecorator;
this.dragController = dragController;
widget = uiBinder.createAndBindUi(this);
- actions = new ActionSimplePanel(guiProvider);
+ actions = new ActionSimplePanel(guiProvider, i18n);
notDrop.register(firstCategoryFlow);
notDrop.register(sndCategoryFlow);
notDrop.register(trdCategoryFlow);
Modified: trunk/src/main/java/cc/kune/core/client/sn/GroupSNPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/GroupSNPanel.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/core/client/sn/GroupSNPanel.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -55,7 +55,7 @@
i18n.t("Users pending to be accepted in this group by the administrators"));
sndDeckLabel.setText(i18n.t("This is an orphaned project, if you are interested in contributing please request to join"));
firstDeckLabel.setText(i18n.t("The members of this group are not public"));
- bottomActionsToolbar = new ActionFlowPanel(guiProvider);
+ bottomActionsToolbar = new ActionFlowPanel(guiProvider, i18n);
bottomPanel.add(bottomActionsToolbar);
bottomActionsToolbar.setStyleName("k-sn-bottomPanel-actions");
armor.getEntityToolsNorth().add(widget);
Modified: trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -62,7 +62,7 @@
setTooltip(trdCategoryLabel, "NOT USED");
super.setTrdCategoryVisible(false, false);
sndDeckLabel.setText("NOT USED");
- bottomActionsToolbar = new ActionFlowPanel(guiProvider);
+ bottomActionsToolbar = new ActionFlowPanel(guiProvider, i18n);
bottomPanel.add(bottomActionsToolbar);
bottomActionsToolbar.setStyleName("k-sn-bottomPanel-actions");
armor.getEntityToolsNorth().add(widget);
Modified: trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityHeaderPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityHeaderPanel.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/core/client/ws/entheader/EntityHeaderPanel.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -29,6 +29,7 @@
import cc.kune.core.shared.FileConstants;
import cc.kune.core.shared.domain.utils.StateToken;
import cc.kune.core.shared.dto.GroupDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.GSpaceArmor;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
@@ -53,7 +54,7 @@
@Inject
public EntityHeaderPanel(final Provider<FileDownloadUtils> downloadProvider,
final CoreResources images, final GuiProvider bindings, final GSpaceArmor armor,
- final EntityTextLogo entityTextLogo) {
+ final EntityTextLogo entityTextLogo, final I18nTranslationService i18n) {
this.entityTextLogo = entityTextLogo;
mainPanel = new HorizontalPanel();
mainPanel.setWidth("100%");
@@ -63,7 +64,7 @@
vpanel.setWidth("100%");
vpanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
mainPanel.add(entityTextLogo);
- toolbar = new ActionFlowPanel(bindings);
+ toolbar = new ActionFlowPanel(bindings, i18n);
vpanel.add(toolbar);
mainPanel.add(vpanel);
armor.getEntityHeader().add(mainPanel);
Modified: trunk/src/main/java/cc/kune/core/server/i18n/I18nTranslationServiceDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/i18n/I18nTranslationServiceDefault.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/core/server/i18n/I18nTranslationServiceDefault.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -20,29 +20,34 @@
package cc.kune.core.server.i18n;
import cc.kune.common.client.utils.TextUtils;
-import cc.kune.core.server.UserSession;
+import cc.kune.core.server.UserSessionManager;
import cc.kune.core.server.manager.I18nTranslationManager;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.domain.I18nTranslation;
import com.google.inject.Inject;
-import com.google.inject.Provider;
import com.google.inject.Singleton;
@Singleton
public class I18nTranslationServiceDefault extends I18nTranslationService {
private final I18nTranslationManager translationManager;
+ private final UserSessionManager userSessionManager;
- // private final Provider<UserSession> userSessionProvider;
-
@Inject
public I18nTranslationServiceDefault(final I18nTranslationManager translationManager,
- final Provider<UserSession> userSessionProvider) {
+ final UserSessionManager userSessionManager) {
this.translationManager = translationManager;
- // this.userSessionProvider = userSessionProvider;
+ this.userSessionManager = userSessionManager;
}
+ @Override
+ public boolean isRTL() {
+ return userSessionManager.isUserLoggedIn() ? userSessionManager.getUser().getLanguage().getDirection().equals(
+ RTL)
+ : false;
+ }
+
/**
* If the text is not in the db, it stores the text pending for translation.
*
@@ -72,13 +77,11 @@
@Override
public String tWithNT(final String text, final String noteForTranslators) {
String language;
-
- // final UserSession userSession = userSessionProvider.get();
- // if (userSession.isUserLoggedIn()) {
- // language = userSession.getUser().getLanguage().getCode();
- // } else {
- language = I18nTranslation.DEFAULT_LANG;
- // }
+ if (userSessionManager.isUserLoggedIn()) {
+ language = userSessionManager.getUser().getLanguage().getCode();
+ } else {
+ language = I18nTranslation.DEFAULT_LANG;
+ }
final String encodeText = TextUtils.escapeHtmlLight(text);
String translation = translationManager.getTranslation(language, text, noteForTranslators);
if (translation == UNTRANSLATED_VALUE) {
Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/I18nTranslationManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/I18nTranslationManagerDefault.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/I18nTranslationManagerDefault.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -175,7 +175,8 @@
final String escapedTranslation = TextUtils.escapeHtmlLight(translation);
trans.setText(escapedTranslation);
persist(trans);
- langCache.clear();
+ // reset cache for this lang
+ langCache.remove(lang);
return escapedTranslation;
} else {
throw new DefaultException("Trying to translate a unknown item");
Modified: trunk/src/main/java/cc/kune/core/shared/dto/I18nLanguageDTO.java
===================================================================
--- trunk/src/main/java/cc/kune/core/shared/dto/I18nLanguageDTO.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/core/shared/dto/I18nLanguageDTO.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -23,68 +23,68 @@
public class I18nLanguageDTO implements IsSerializable {
- private String code;
- private String englishName;
- private String nativeName;
- private String direction;
- private String pluralization;
- private String dateFormat;
- private String dateFormatShort;
+ private String code;
+ private String dateFormat;
+ private String dateFormatShort;
+ private String direction;
+ private String englishName;
+ private String nativeName;
+ private String pluralization;
- public String getCode() {
- return code;
- }
+ public String getCode() {
+ return code;
+ }
- public String getDateFormat() {
- return dateFormat;
- }
+ public String getDateFormat() {
+ return dateFormat;
+ }
- public String getDateFormatShort() {
- return dateFormatShort;
- }
+ public String getDateFormatShort() {
+ return dateFormatShort;
+ }
- public String getDirection() {
- return direction;
- }
+ public String getDirection() {
+ return direction;
+ }
- public String getEnglishName() {
- return englishName;
- }
+ public String getEnglishName() {
+ return englishName;
+ }
- public String getNativeName() {
- return nativeName;
- }
+ public String getNativeName() {
+ return nativeName;
+ }
- public String getPluralization() {
- return pluralization;
- }
+ public String getPluralization() {
+ return pluralization;
+ }
- public void setCode(final String code) {
- this.code = code;
- }
+ public void setCode(final String code) {
+ this.code = code;
+ }
- public void setDateFormat(String dateFormat) {
- this.dateFormat = dateFormat;
- }
+ public void setDateFormat(final String dateFormat) {
+ this.dateFormat = dateFormat;
+ }
- public void setDateFormatShort(String dateFormatShort) {
- this.dateFormatShort = dateFormatShort;
- }
+ public void setDateFormatShort(final String dateFormatShort) {
+ this.dateFormatShort = dateFormatShort;
+ }
- public void setDirection(final String direction) {
- this.direction = direction;
- }
+ public void setDirection(final String direction) {
+ this.direction = direction;
+ }
- public void setEnglishName(final String englishName) {
- this.englishName = englishName;
- }
+ public void setEnglishName(final String englishName) {
+ this.englishName = englishName;
+ }
- public void setNativeName(final String nativeName) {
- this.nativeName = nativeName;
- }
+ public void setNativeName(final String nativeName) {
+ this.nativeName = nativeName;
+ }
- public void setPluralization(final String pluralization) {
- this.pluralization = pluralization;
- }
+ public void setPluralization(final String pluralization) {
+ this.pluralization = pluralization;
+ }
}
Modified: trunk/src/main/java/cc/kune/core/shared/i18n/I18nTranslationService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/shared/i18n/I18nTranslationService.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/core/shared/i18n/I18nTranslationService.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -21,8 +21,12 @@
import cc.kune.common.client.utils.Pair;
+import com.google.gwt.i18n.client.HasDirection.Direction;
+
public abstract class I18nTranslationService {
+ protected static final String RTL = "rtl";
+
// Also in I18nTranslation
protected static final String UNTRANSLATED_VALUE = null;
@@ -32,6 +36,12 @@
return text;
}
+ public Direction getDirection() {
+ return isRTL() ? Direction.RTL : Direction.LTR;
+ }
+
+ public abstract boolean isRTL();
+
/**
* Use [%d] to reference the Integer parameters
*
Modified: trunk/src/main/java/cc/kune/domain/I18nLanguage.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/I18nLanguage.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/domain/I18nLanguage.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -45,255 +45,256 @@
@Table(name = "globalize_languages")
public class I18nLanguage implements HasId {
- @Field(index = Index.TOKENIZED, store = Store.NO)
- @Column(name = "code", unique = true)
- private String code;
+ @Field(index = Index.TOKENIZED, store = Store.NO)
+ @Column(name = "code", unique = true)
+ private String code;
- @Column(name = "date_format")
- private String dateFormat;
+ @Column(name = "date_format")
+ private String dateFormat;
- @Column(name = "date_format_short")
- private String dateFormatShort;
+ @Column(name = "date_format_short")
+ private String dateFormatShort;
- @Column(name = "direction")
- private String direction;
+ @Column(name = "direction")
+ private String direction;
- @Field(index = Index.TOKENIZED, store = Store.NO)
- @Column(name = "english_name")
- private String englishName;
+ @Field(index = Index.TOKENIZED, store = Store.NO)
+ @Column(name = "english_name")
+ private String englishName;
- @Column(name = "english_name_locale")
- private String englishNameLocale;
+ @Column(name = "english_name_locale")
+ private String englishNameLocale;
- @Column(name = "english_name_modifier")
- private String englishNameModifier;
+ @Column(name = "english_name_modifier")
+ private String englishNameModifier;
- @Id
- // Is not GeneratedValue
- @DocumentId
- @Column(name = "id", unique = true, nullable = false)
- private Long id;
+ @Id
+ // Is not GeneratedValue
+ @DocumentId
+ @Column(name = "id", unique = true, nullable = false)
+ private Long id;
- @Column(name = "iso_639_1", length = 2)
- private String iso6391;
+ @Column(name = "iso_639_1", length = 2)
+ private String iso6391;
- @Column(name = "iso_639_2", length = 3, unique = true)
- private String iso6392;
+ @Column(name = "iso_639_2", length = 3, unique = true)
+ private String iso6392;
- @Column(name = "iso_639_3", length = 3, unique = true)
- private String iso6393;
+ @Column(name = "iso_639_3", length = 3, unique = true)
+ private String iso6393;
- @Column(name = "macro_language")
- private Boolean macroLanguage;
+ @Column(name = "macro_language")
+ private Boolean macroLanguage;
- @Field(index = Index.TOKENIZED, store = Store.NO)
- @Column(name = "native_name")
- private String nativeName;
+ @Field(index = Index.TOKENIZED, store = Store.NO)
+ @Column(name = "native_name")
+ private String nativeName;
- @Column(name = "native_name_locale")
- private String nativeNameLocale;
+ @Column(name = "native_name_locale")
+ private String nativeNameLocale;
- @Column(name = "native_name_modifier")
- private String nativeNameModifier;
+ @Column(name = "native_name_modifier")
+ private String nativeNameModifier;
- @Pattern(regex = "^[c=\\d?:%!<>&|() ]+$")
- @Column(name = "pluralization")
- @Length(max = 200)
- private String pluralization;
+ @Pattern(regex = "^[c=\\d?:%!<>&|() ]+$")
+ @Column(name = "pluralization")
+ @Length(max = 200)
+ private String pluralization;
- @Column(name = "rfc_3066", unique = true)
- private String rfc3066;
+ @Column(name = "rfc_3066", unique = true)
+ private String rfc3066;
- @Column(name = "scope", length = 1)
- private String scope;
+ @Column(name = "scope", length = 1)
+ private String scope;
- public I18nLanguage() {
- this(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
- }
+ public I18nLanguage() {
+ this(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+ null);
+ }
- // Only for tests
- public I18nLanguage(final Long id, final String englishName, final String nativeName, final String code) {
- this.id = id;
- this.englishName = englishName;
- this.nativeName = nativeName;
- this.code = code;
- }
+ // Only for tests
+ public I18nLanguage(final Long id, final String englishName, final String nativeName, final String code) {
+ this.id = id;
+ this.englishName = englishName;
+ this.nativeName = nativeName;
+ this.code = code;
+ }
- // code is iso6391 || iso6392 || rfc3306 (see DatabaseInicializer)
- public I18nLanguage(final Long id, final String code, final String direction, final String englishName,
- final String englishNameLocale, final String englishNameModifier, final String iso6391,
- final String iso6392, final String iso6393, final Boolean macroLanguage, final String nativeName,
- final String nativeNameLocale, final String nativeNameModifier, final String pluralization,
- final String rfc3066, final String scope, final String dateFormat) {
- this.id = id;
- this.iso6391 = iso6391;
- this.iso6392 = iso6392;
- this.iso6393 = iso6393;
- this.rfc3066 = rfc3066;
- this.englishName = englishName;
- this.englishNameLocale = englishNameLocale;
- this.englishNameModifier = englishNameModifier;
- this.nativeName = nativeName;
- this.nativeNameLocale = nativeNameLocale;
- this.nativeNameModifier = nativeNameModifier;
- this.macroLanguage = macroLanguage;
- this.direction = direction;
- this.pluralization = pluralization;
- this.scope = scope;
- this.code = code;
- this.dateFormat = dateFormat;
- }
+ // code is iso6391 || iso6392 || rfc3306 (see DatabaseInicializer)
+ public I18nLanguage(final Long id, final String code, final String direction,
+ final String englishName, final String englishNameLocale, final String englishNameModifier,
+ final String iso6391, final String iso6392, final String iso6393, final Boolean macroLanguage,
+ final String nativeName, final String nativeNameLocale, final String nativeNameModifier,
+ final String pluralization, final String rfc3066, final String scope, final String dateFormat) {
+ this.id = id;
+ this.iso6391 = iso6391;
+ this.iso6392 = iso6392;
+ this.iso6393 = iso6393;
+ this.rfc3066 = rfc3066;
+ this.englishName = englishName;
+ this.englishNameLocale = englishNameLocale;
+ this.englishNameModifier = englishNameModifier;
+ this.nativeName = nativeName;
+ this.nativeNameLocale = nativeNameLocale;
+ this.nativeNameModifier = nativeNameModifier;
+ this.macroLanguage = macroLanguage;
+ this.direction = direction;
+ this.pluralization = pluralization;
+ this.scope = scope;
+ this.code = code;
+ this.dateFormat = dateFormat;
+ }
- public String getCode() {
- return code;
- }
+ public String getCode() {
+ return code;
+ }
- public String getDateFormat() {
- return dateFormat;
- }
+ public String getDateFormat() {
+ return dateFormat;
+ }
- public String getDateFormatShort() {
- return dateFormatShort;
- }
+ public String getDateFormatShort() {
+ return dateFormatShort;
+ }
- public String getDirection() {
- return this.direction;
- }
+ public String getDirection() {
+ return this.direction;
+ }
- public String getEnglishName() {
- return this.englishName;
- }
+ public String getEnglishName() {
+ return this.englishName;
+ }
- public String getEnglishNameLocale() {
- return this.englishNameLocale;
- }
+ public String getEnglishNameLocale() {
+ return this.englishNameLocale;
+ }
- public String getEnglishNameModifier() {
- return this.englishNameModifier;
- }
+ public String getEnglishNameModifier() {
+ return this.englishNameModifier;
+ }
- @Override
- public Long getId() {
- return this.id;
- }
+ @Override
+ public Long getId() {
+ return this.id;
+ }
- public String getIso6391() {
- return this.iso6391;
- }
+ public String getIso6391() {
+ return this.iso6391;
+ }
- public String getIso6392() {
- return this.iso6392;
- }
+ public String getIso6392() {
+ return this.iso6392;
+ }
- public String getIso6393() {
- return this.iso6393;
- }
+ public String getIso6393() {
+ return this.iso6393;
+ }
- public Boolean getMacroLanguage() {
- return this.macroLanguage;
- }
+ public Boolean getMacroLanguage() {
+ return this.macroLanguage;
+ }
- public String getNativeName() {
- return this.nativeName;
- }
+ public String getNativeName() {
+ return this.nativeName;
+ }
- public String getNativeNameLocale() {
- return this.nativeNameLocale;
- }
+ public String getNativeNameLocale() {
+ return this.nativeNameLocale;
+ }
- public String getNativeNameModifier() {
- return this.nativeNameModifier;
- }
+ public String getNativeNameModifier() {
+ return this.nativeNameModifier;
+ }
- public String getPluralization() {
- return this.pluralization;
- }
+ public String getPluralization() {
+ return this.pluralization;
+ }
- public String getRfc3066() {
- return this.rfc3066;
- }
+ public String getRfc3066() {
+ return this.rfc3066;
+ }
- public String getScope() {
- return this.scope;
- }
+ public String getScope() {
+ return this.scope;
+ }
- @Column(unique = true)
- public void setCode(final String code) {
- this.code = code;
- }
+ @Column(unique = true)
+ public void setCode(final String code) {
+ this.code = code;
+ }
- public void setDateFormat(final String dateFormat) {
- this.dateFormat = dateFormat;
- }
+ public void setDateFormat(final String dateFormat) {
+ this.dateFormat = dateFormat;
+ }
- public void setDateFormatShort(final String dateFormatShort) {
- this.dateFormatShort = dateFormatShort;
- }
+ public void setDateFormatShort(final String dateFormatShort) {
+ this.dateFormatShort = dateFormatShort;
+ }
- public void setDirection(final String direction) {
- this.direction = direction;
- }
+ public void setDirection(final String direction) {
+ this.direction = direction;
+ }
- public void setEnglishName(final String englishName) {
- this.englishName = englishName;
- }
+ public void setEnglishName(final String englishName) {
+ this.englishName = englishName;
+ }
- public void setEnglishNameLocale(final String englishNameLocale) {
- this.englishNameLocale = englishNameLocale;
- }
+ public void setEnglishNameLocale(final String englishNameLocale) {
+ this.englishNameLocale = englishNameLocale;
+ }
- public void setEnglishNameModifier(final String englishNameModifier) {
- this.englishNameModifier = englishNameModifier;
- }
+ public void setEnglishNameModifier(final String englishNameModifier) {
+ this.englishNameModifier = englishNameModifier;
+ }
- @Override
- public void setId(final Long id) {
- this.id = id;
- }
+ @Override
+ public void setId(final Long id) {
+ this.id = id;
+ }
- public void setIso6391(final String iso6391) {
- this.iso6391 = iso6391;
- }
+ public void setIso6391(final String iso6391) {
+ this.iso6391 = iso6391;
+ }
- public void setIso6392(final String iso6392) {
- this.iso6392 = iso6392;
- }
+ public void setIso6392(final String iso6392) {
+ this.iso6392 = iso6392;
+ }
- public void setIso6393(final String iso6393) {
- this.iso6393 = iso6393;
- }
+ public void setIso6393(final String iso6393) {
+ this.iso6393 = iso6393;
+ }
- public void setMacroLanguage(final Boolean macroLanguage) {
- this.macroLanguage = macroLanguage;
- }
+ public void setMacroLanguage(final Boolean macroLanguage) {
+ this.macroLanguage = macroLanguage;
+ }
- public void setNativeName(final String nativeName) {
- this.nativeName = nativeName;
- }
+ public void setNativeName(final String nativeName) {
+ this.nativeName = nativeName;
+ }
- public void setNativeNameLocale(final String nativeNameLocale) {
- this.nativeNameLocale = nativeNameLocale;
- }
+ public void setNativeNameLocale(final String nativeNameLocale) {
+ this.nativeNameLocale = nativeNameLocale;
+ }
- public void setNativeNameModifier(final String nativeNameModifier) {
- this.nativeNameModifier = nativeNameModifier;
- }
+ public void setNativeNameModifier(final String nativeNameModifier) {
+ this.nativeNameModifier = nativeNameModifier;
+ }
- public void setPluralization(final String pluralization) {
- this.pluralization = pluralization;
- }
+ public void setPluralization(final String pluralization) {
+ this.pluralization = pluralization;
+ }
- public void setRfc3066(final String rfc3066) {
- this.rfc3066 = rfc3066;
- }
+ public void setRfc3066(final String rfc3066) {
+ this.rfc3066 = rfc3066;
+ }
- public void setScope(final String scope) {
- this.scope = scope;
- }
+ public void setScope(final String scope) {
+ this.scope = scope;
+ }
- @Override
- public String toString() {
- return "I18nLanguage[" + englishName + "]";
- }
+ @Override
+ public String toString() {
+ return "I18nLanguage[" + englishName + "]";
+ }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -263,13 +263,12 @@
@Override
public void setBackImage(final String url) {
final String bodyProp = "#FFFFFF url('" + url + "') fixed top left";
- // final String bodyProp = "#FFFFFF url('" + url +
- // "') fixed no-repeat top left";
DOM.setStyleAttribute(groupSpaceWrapper.getElement(), CSS.A.BACKGROUND, bodyProp);
}
@Override
public void setContentVisible(final boolean visible) {
+ // FIXME: remove this?
// NotifyUser.info("Visible: " + visible);
// docContainer.getElement().getStyle().setOpacity(visible ? 1d : .0d);
// docFooter.getElement().getStyle().setOpacity(visible ? 1d : .0d);
Modified: trunk/src/main/java/cc/kune/gspace/client/i18n/I18nTranslatorPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/i18n/I18nTranslatorPanel.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/gspace/client/i18n/I18nTranslatorPanel.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -29,7 +29,7 @@
final I18nToTranslateGridPanel toTranslateGrid, final I18nTranslatedGridPanel translatedGrid,
final I18nTranslateRecomendPanel transRecommend, final CoreResources res) {
super(TRANSLATOR_PANEL_ID, "", false, false, images, TRANSLATOR_ERROR_ID, i18n.t("Close"), null,
- null, null, transGroup);
+ null, null, transGroup, i18n.getDirection());
setIcon(res.language());
this.lanSelectorPanel = lanSelectorPanel;
this.toTranslateGrid = toTranslateGrid;
Modified: trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsPanel.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsPanel.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -39,7 +39,7 @@
public GroupOptionsPanel(final EntityHeader entityHeader, final I18nTranslationService i18n,
final NotifyLevelImages images, final GroupOptionsCollection entityOptionsGroup) {
super(GROUP_OP_PANEL_ID, "", false, false, images, GROUP_OPTIONS_ERROR_ID, i18n.t("Close"), null,
- null, null, entityOptionsGroup);
+ null, null, entityOptionsGroup, i18n.getDirection());
this.entityHeader = entityHeader;
super.setIconCls("k-options-icon");
super.setTitle(i18n.t(CoreMessages.GROUP_OPTIONS_DIALOG_TITLE));
Modified: trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPanel.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPanel.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -37,7 +37,7 @@
public UserOptionsPanel(final EntityHeader entityHeader, final I18nTranslationService i18n,
final NotifyLevelImages images, final UserOptionsCollection userOptionsGroup) {
super(USER_OP_PANEL_ID, "", false, images, USER_OPTIONS_ERROR_ID, i18n.t("Close"), null, null, null,
- userOptionsGroup);
+ userOptionsGroup, i18n.getDirection());
super.setIconCls("k-options-icon");
super.setTitle(i18n.t(CoreMessages.USER_OPTIONS_DIALOG_TITLE));
}
Modified: trunk/src/main/java/cc/kune/gspace/client/resources/gSpaceArmor.css
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/resources/gSpaceArmor.css 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/gspace/client/resources/gSpaceArmor.css 2011-11-12 02:58:35 UTC (rev 1603)
@@ -7,9 +7,6 @@
.mainPanel {
border-top: 2px solid white;
- /* border-bottom: 7px solid transparent;
- border-right: 17px solid transparent;
- border-left: 17px solid transparent; */
}
.k-spaces {
@@ -34,10 +31,6 @@
overflow: hidden;
background-color: #fff !important;
padding: 0px 5px;
- /*kfilter: alpha(opacity = 38) !important;
- -moz-opacity: 0.38 !important;
- -khtml-opacity: 0.38 !important;
- opacity: 0.38 !important; */
}
.entityCentralContainer {
@@ -55,7 +48,6 @@
-webkit-border-bottom-right-radius: 7px;
-moz-border-radius-bottomright: 7px;
border-bottom-right-radius: 7px;
- /* padding: 7px 10px 0px 17px; */
overflow: hidden;
}
@@ -165,15 +157,6 @@
border-top-right-radius: 7px;
}
-/* Fix wave scroll problem
-.docEditor div {
- overflow-y: visible;
-}
-
-div.docEditor div {
- position: static;
-}
-*/
.docFooter {
border-left: 1px solid #959595;
border-right: 1px solid #959595;
@@ -203,16 +186,14 @@
border-bottom-left-radius: 7px;
}
-.entityToolsNorth { /* margin: 10px; */
+.entityToolsNorth {
}
-.entityToolsNorth span { /* font-size: 20px;
- font-weight: bold; */
-
+.entityToolsNorth span {
}
-.entityToolsCenter { /* margin: 10px; */
+.entityToolsCenter {
overflow: visible !important;
padding-top: 10px;
clear: both;
Modified: trunk/src/main/java/cc/kune/gspace/client/resources/gSpaceArmorTheme.css
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/resources/gSpaceArmorTheme.css 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/gspace/client/resources/gSpaceArmorTheme.css 2011-11-12 02:58:35 UTC (rev 1603)
@@ -41,8 +41,7 @@
color: c2;
}
-.k-sn-3rd-panel { /* background-color: #a05a2c; */
-
+.k-sn-3rd-panel {
}
.entityToolsCenter span {
Modified: trunk/src/main/java/cc/kune/gspace/client/themes/GSpaceThemeSelectorPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/themes/GSpaceThemeSelectorPanel.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/gspace/client/themes/GSpaceThemeSelectorPanel.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -22,14 +22,15 @@
import cc.kune.common.client.actions.ui.ActionExtensibleView;
import cc.kune.common.client.actions.ui.ActionFlowPanel;
import cc.kune.common.client.actions.ui.bind.GuiProvider;
+import cc.kune.core.shared.i18n.I18nTranslationService;
import com.google.inject.Inject;
public class GSpaceThemeSelectorPanel extends ActionFlowPanel implements ActionExtensibleView {
@Inject
- public GSpaceThemeSelectorPanel(final GuiProvider guiProvider) {
- super(guiProvider);
+ public GSpaceThemeSelectorPanel(final GuiProvider guiProvider, final I18nTranslationService i18n) {
+ super(guiProvider, i18n);
}
}
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsTablePanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsTablePanel.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsTablePanel.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -85,7 +85,7 @@
final int rowCount = flex.getRowCount();
final FolderItemWidget itemWidget = new FolderItemWidget((ImageResource) item.getIcon(),
item.getText(), item.getStateToken());
- final ActionSimplePanel toolbar = new ActionSimplePanel(guiProvider);
+ final ActionSimplePanel toolbar = new ActionSimplePanel(guiProvider, i18n);
final long modifiedOn = item.getModififiedOn();
if (modifiedOn != FolderViewerView.NO_DATE) {
// String dateFormat = session.getCurrentLanguage().getDateFormatShort();
Modified: trunk/src/main/java/cc/kune/lists/client/actions/NewListAction.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/NewListAction.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/lists/client/actions/NewListAction.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -51,7 +51,8 @@
@Override
public void actionPerformed(final ActionEvent event) {
- final Builder builder = new PromptTopDialog.Builder(ID, "Name of the new list?", false, true);
+ final Builder builder = new PromptTopDialog.Builder(ID, i18n.t("Name of the new list?"), false,
+ true, i18n.getDirection());
builder.width("300px").height("50px").firstButtonTitle(i18n.t("Create")).sndButtonTitle(
i18n.t("Cancel")).firstButtonId(CREATE_ID).sndButtonId(CANCEL_ID).width(270);
builder.textboxId(TEXTBOX_ID);
Modified: trunk/src/main/java/cc/kune/lists/client/actions/NewListPostAction.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/NewListPostAction.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/lists/client/actions/NewListPostAction.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -57,7 +57,8 @@
@Override
public void actionPerformed(final ActionEvent event) {
if (session.isLogged()) {
- final Builder builder = new PromptTopDialog.Builder(ID, "Title of the new post?", false, true);
+ final Builder builder = new PromptTopDialog.Builder(ID, i18n.t("Title of the new post?"), false,
+ true, i18n.getDirection());
builder.width("300px").height("50px").firstButtonTitle(i18n.t("Post")).sndButtonTitle(
i18n.t("Cancel")).firstButtonId(CREATE_ID).sndButtonId(CANCEL_ID).width(270);
builder.textboxId(TEXTBOX_ID);
Modified: trunk/src/main/java/cc/kune/pspace/client/PSpacePanel.java
===================================================================
--- trunk/src/main/java/cc/kune/pspace/client/PSpacePanel.java 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/java/cc/kune/pspace/client/PSpacePanel.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -23,6 +23,7 @@
import cc.kune.common.client.actions.ui.IsActionExtensible;
import cc.kune.common.client.actions.ui.bind.GuiProvider;
import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.GSpaceArmor;
import cc.kune.pspace.client.PSpacePresenter.PSpaceView;
@@ -66,9 +67,9 @@
@Inject
public PSpacePanel(final GuiProvider guiProvider, final CoreResources res, final GSpaceArmor wsArmor,
- final PSpaceInDevelopment inDevelopment) {
+ final PSpaceInDevelopment inDevelopment, final I18nTranslationService i18n) {
widget = uiBinder.createAndBindUi(this);
- actionPanel = new ActionFlowPanel(guiProvider);
+ actionPanel = new ActionFlowPanel(guiProvider, i18n);
actionPanelContainer.add(actionPanel);
final Element layer = mainPanel.getWidgetContainerElement(messagePanel);
layer.addClassName("k-publicspace-msg");
Modified: trunk/src/main/webapp/ws.html
===================================================================
--- trunk/src/main/webapp/ws.html 2011-11-11 18:50:03 UTC (rev 1602)
+++ trunk/src/main/webapp/ws.html 2011-11-12 02:58:35 UTC (rev 1603)
@@ -3,7 +3,6 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Kune</title>
-
<!-- Use this if you want to force some language as default
<meta name="gwt:property" content="locale=es" />
-->
Added: trunk/src/test/java/cc/kune/core/client/i18n/I18nUrlUtilsTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/client/i18n/I18nUrlUtilsTest.java (rev 0)
+++ trunk/src/test/java/cc/kune/core/client/i18n/I18nUrlUtilsTest.java 2011-11-12 02:58:35 UTC (rev 1603)
@@ -0,0 +1,38 @@
+package cc.kune.core.client.i18n;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class I18nUrlUtilsTest {
+
+ @Test
+ public void simpleLangChange() {
+ assertEquals("?locale=eu", I18nUrlUtils.changeLang("?locale=es", "eu"));
+ assertEquals("?locale=eu#", I18nUrlUtils.changeLang("?locale=es#", "eu"));
+ assertEquals("?locale=eu#hash", I18nUrlUtils.changeLang("?locale=es#hash", "eu"));
+ assertEquals("?locale=eu&some=value&someother=someothervalue#hash",
+ I18nUrlUtils.changeLang("?locale=es&some=value&someother=someothervalue#hash", "eu"));
+ assertEquals("?locale=eu&some=value&someother=someothervalue#",
+ I18nUrlUtils.changeLang("?locale=es&some=value&someother=someothervalue#", "eu"));
+ assertEquals("?locale=eu&log_level=INFO&gwt.codesvr=127.0.0.1:9997#inbox",
+ I18nUrlUtils.changeLang("?locale=pt-BR&log_level=INFO&gwt.codesvr=127.0.0.1:9997#inbox", "eu"));
+ assertEquals("?locale=eu&log_level=INFO&gwt.codesvr=127.0.0.1:9997#admin",
+ I18nUrlUtils.changeLang("?locale=es&log_level=INFO&gwt.codesvr=127.0.0.1:9997#admin", "eu"));
+ assertEquals("?locale=eu", I18nUrlUtils.changeLang("", "eu"));
+ assertEquals("?locale=eu#", I18nUrlUtils.changeLang("#", "eu"));
+ assertEquals("?locale=eu#hash", I18nUrlUtils.changeLang("#hash", "eu"));
+ assertEquals("?locale=eu&some=value&someother=someothervalue#hash",
+ I18nUrlUtils.changeLang("?some=value&someother=someothervalue#hash", "eu"));
+ assertEquals("?locale=eu&some=value&someother=someothervalue#",
+ I18nUrlUtils.changeLang("?some=value&someother=someothervalue#", "eu"));
+ assertEquals("?locale=eu&log_level=INFO&gwt.codesvr=127.0.0.1:9997#inbox",
+ I18nUrlUtils.changeLang("?locale=pt-BR&log_level=INFO&gwt.codesvr=127.0.0.1:9997#inbox", "eu"));
+ assertEquals("?locale=eu&log_level=INFO&gwt.codesvr=127.0.0.1:9997#admin",
+ I18nUrlUtils.changeLang("?log_level=INFO&gwt.codesvr=127.0.0.1:9997#admin", "eu"));
+ assertEquals("?locale=es&log_level=INFO&gwt.codesvr=127.0.0.1:9997#signin(admin)",
+ I18nUrlUtils.changeLang("?locale=ar&log_level=INFO&gwt.codesvr=127.0.0.1:9997"
+ + "#signin(admin)", "es"));
+ }
+
+}
More information about the kune-commits
mailing list