Adding a BiDi page to Showcase


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@8544 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/ContentWidget.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/ContentWidget.java
index 2b201a2..9e13a80 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/ContentWidget.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/ContentWidget.java
@@ -35,6 +35,8 @@
 import com.google.gwt.sample.showcase.client.content.cell.CwCellTable;
 import com.google.gwt.sample.showcase.client.content.cell.CwCellTree;
 import com.google.gwt.sample.showcase.client.content.cell.CwCellValidation;
+import com.google.gwt.sample.showcase.client.content.i18n.CwBidiFormatting;
+import com.google.gwt.sample.showcase.client.content.i18n.CwBidiInput;
 import com.google.gwt.sample.showcase.client.content.i18n.CwConstantsExample;
 import com.google.gwt.sample.showcase.client.content.i18n.CwConstantsWithLookupExample;
 import com.google.gwt.sample.showcase.client.content.i18n.CwDateTimeFormat;
@@ -452,7 +454,9 @@
         runAsyncCode(CwPluralFormsExample.class),
         runAsyncCode(CwConstantsExample.class),
         runAsyncCode(CwConstantsWithLookupExample.class),
-        runAsyncCode(CwDictionaryExample.class)));
+        runAsyncCode(CwDictionaryExample.class),
+        runAsyncCode(CwBidiFormatting.class),
+        runAsyncCode(CwBidiInput.class)));
   }
 
   protected void prefetchListsAndMenus() {
@@ -618,3 +622,4 @@
     }
   }
 }
+
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/Showcase.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/Showcase.java
index 23e8d52..44540e8 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/Showcase.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/Showcase.java
@@ -39,6 +39,8 @@
 import com.google.gwt.sample.showcase.client.content.cell.CwCellTable;
 import com.google.gwt.sample.showcase.client.content.cell.CwCellTree;
 import com.google.gwt.sample.showcase.client.content.cell.CwCellValidation;
+import com.google.gwt.sample.showcase.client.content.i18n.CwBidiFormatting;
+import com.google.gwt.sample.showcase.client.content.i18n.CwBidiInput;
 import com.google.gwt.sample.showcase.client.content.i18n.CwConstantsExample;
 import com.google.gwt.sample.showcase.client.content.i18n.CwConstantsWithLookupExample;
 import com.google.gwt.sample.showcase.client.content.i18n.CwDateTimeFormat;
@@ -397,6 +399,10 @@
         images.catI18N());
     setupMainMenuOption(catI18N, new CwMessagesExample(constants),
         images.catI18N());
+    setupMainMenuOption(catI18N, new CwBidiInput(constants),
+        images.catI18N());
+    setupMainMenuOption(catI18N, new CwBidiFormatting(constants),
+        images.catI18N());
     setupMainMenuOption(catI18N, new CwPluralFormsExample(constants),
         images.catI18N());
     setupMainMenuOption(catI18N, new CwConstantsExample(constants),
@@ -597,3 +603,4 @@
         getCurrentReferenceStyleName("Application"), callback);
   }
 }
+
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseConstants.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseConstants.java
index bba9b84..00480e7 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseConstants.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseConstants.java
@@ -22,6 +22,8 @@
 import com.google.gwt.sample.showcase.client.content.cell.CwCellTable;
 import com.google.gwt.sample.showcase.client.content.cell.CwCellTree;
 import com.google.gwt.sample.showcase.client.content.cell.CwCellValidation;
+import com.google.gwt.sample.showcase.client.content.i18n.CwBidiFormatting;
+import com.google.gwt.sample.showcase.client.content.i18n.CwBidiInput;
 import com.google.gwt.sample.showcase.client.content.i18n.CwConstantsExample;
 import com.google.gwt.sample.showcase.client.content.i18n.CwConstantsWithLookupExample;
 import com.google.gwt.sample.showcase.client.content.i18n.CwDateTimeFormat;
@@ -77,14 +79,15 @@
     CwFlexTable.CwConstants, CwBasicText.CwConstants, CwRichText.CwConstants,
     CwFileUpload.CwConstants, CwAbsolutePanel.CwConstants,
     CwHyperlink.CwConstants, CwFrame.CwConstants, CwStackPanel.CwConstants,
-    CwCookies.CwConstants, CwNumberFormat.CwConstants,
-    CwDateTimeFormat.CwConstants, CwMessagesExample.CwConstants,
-    CwConstantsExample.CwConstants, CwConstantsWithLookupExample.CwConstants,
-    CwDictionaryExample.CwConstants, CwDecoratorPanel.CwConstants,
-    CwAnimation.CwConstants, CwDatePicker.CwConstants,
-    CwPluralFormsExample.CwConstants, CwCellList.CwConstants,
-    CwCellTable.CwConstants, CwCellTree.CwConstants, CwCellBrowser.CwConstants,
-    CwCellValidation.CwConstants, CwCellSampler.CwConstants {
+    CwCookies.CwConstants, CwNumberFormat.CwConstants, CwBidiInput.CwConstants,
+    CwBidiFormatting.CwConstants, CwDateTimeFormat.CwConstants,
+    CwMessagesExample.CwConstants, CwConstantsExample.CwConstants,
+    CwConstantsWithLookupExample.CwConstants, CwDictionaryExample.CwConstants,
+    CwDecoratorPanel.CwConstants, CwAnimation.CwConstants,
+    CwDatePicker.CwConstants, CwPluralFormsExample.CwConstants,
+    CwCellList.CwConstants, CwCellTable.CwConstants, CwCellTree.CwConstants,
+    CwCellBrowser.CwConstants, CwCellValidation.CwConstants,
+    CwCellSampler.CwConstants {
 
   /**
    * The path to source code for examples, raw files, and style definitions.
@@ -164,3 +167,4 @@
    */
   String mainTitle();
 }
+
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseConstants.properties b/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseConstants.properties
index 23c1ab4..fa5628d 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseConstants.properties
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseConstants.properties
@@ -24,7 +24,7 @@
 cwAbsolutePanelLeft = <b>Left:</b>
 cwAbsolutePanelItemsToMove = <b>Items to move:</b>
 cwAbsolutePanelTop = <b>Top:</b>
-cwAbsolutePanelWidgetNames = Hello World, Button, Grid 
+cwAbsolutePanelWidgetNames = Hello World, Button, Grid
 cwAnimationName = Animations
 cwAnimationDescription = Animate your application with timed effects.
 cwAnimationStart = Start
@@ -47,15 +47,28 @@
 cwBasicTextPasswordLabel = <b>Password text box:</b>
 cwBasicTextReadOnly = read only
 cwBasicTextSelected = Selected
+cwBidiFormattingName = Bidirectional Text Formatting
+cwBidiFormattingDescription = Class BidiFormatter contains methods to protect a string (for example, a Hebrew topic name) from being garbled and/or garbling what follows it when displayed in the opposite-direction context (for example, an English UI).
+cwBidiFormattingArg0Label = <b>Argument {0}:</b>
+cwBidiFormattingArg1Label = <b>Argument {1}:</b>
+cwBidiFormattingArg2Label = <b>Argument {2}:</b>
+cwBidiFormattingNonbidiFormattedLabel = <b>Message formatted without BidiFormatter:</b>
+cwBidiFormattingBidiFormattedLabel = <b>Message formatted with BidiFormatter:</b>
+cwBidiFormattingLinkText = This example interacts with the sample interface:
+cwBidiFormattingTemplateLabel = <b>Message template:</b>
+cwBidiInputName = Bidirectional Text Input
+cwBidiInputDescription = The TextBox and TextArea widgets implement the HasDirectionEstimator interface. With a direction estimator defined, these widgets adjust their direction automatically according to the text entered so far. A direction estimator is defined by default when at least one of the application's locales is right-to-left.
+cwBidiInputBidiAreaLabel = <b>The following TextArea has the default direction estimator in effect, and is thus bidi-aware. Check it by replacing the right-to-left text with some English, e.g. the sample strings above:</b>
+cwBidiInputRtlAreaLabel = Without a direction estimator, the widget's direction is unaffected by the value the user types in. This makes the entry of opposite-direction text confusing and inconvenient.<br><b>Try typing "(212) 765 4321" or "Hi, how are you?" into the following right-to-left TextArea (which had the direction estimator turned off):</b>
 cwCheckBoxName = Checkbox
 cwCheckBoxDescription = Basic Checkbox Widgets
 cwCheckBoxCheckAll = <b>Check all days that you are available:</b>
 cwCheckBoxDays = Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
 cwConstantsExampleDescription = Interface Constants makes it possible to localize strings, numbers, and maps of strings onto strings. This example isn't terribly exciting, but it does demonstrate how to localize constants. The labels and color choices below are provided by the localized implementation of the sample interface ExampleConstants.
 cwConstantsExampleName = Constants
-cwConstantsExampleLinkText = This example interacts with the sample interface: 
+cwConstantsExampleLinkText = This example interacts with the sample interface:
 cwConstantsWithLookupExampleDescription = Interface ConstantsWithLookup makes it possible to dynamically look up localized values using method names as string keys.
-cwConstantsWithLookupExampleLinkText = This example interacts with the sample interface: 
+cwConstantsWithLookupExampleLinkText = This example interacts with the sample interface:
 cwConstantsWithLookupExampleMethodName = <b>Name of method:</b>
 cwConstantsWithLookupExampleName = Constants With Lookup
 cwConstantsWithLookupExampleResults = <b>Lookup results:</b>
@@ -173,7 +186,7 @@
 cwMessagesExampleArg1Label = <b>Argument {1}:</b>
 cwMessagesExampleArg2Label = <b>Argument {2}:</b>
 cwMessagesExampleFormattedLabel = <b>Formatted message:</b>
-cwMessagesExampleLinkText = This example interacts with the sample interface: 
+cwMessagesExampleLinkText = This example interacts with the sample interface:
 cwMessagesExampleTemplateLabel = <b>Message template:</b>
 cwNumberFormatName = Number Format
 cwNumberFormatDescription = Class NumberFormat supports locale-sensitive formatting and parsing of numbers using a flexible pattern-based syntax. In addition to custom patterns, several standard patterns are also available for convenience.
@@ -187,7 +200,7 @@
 cwPluralFormsExampleDescription = Plural Forms provide a way to create message translations that depend on the count of something.
 cwPluralFormsExampleArg0Label = <b>Argument {0}:</b>
 cwPluralFormsExampleFormattedLabel = <b>Formatted message:</b>
-cwPluralFormsExampleLinkText = This example interacts with the sample interface: 
+cwPluralFormsExampleLinkText = This example interacts with the sample interface:
 cwRadioButtonName = Radio Button
 cwRadioButtonDescription = Basic RadioButton Widget
 cwRadioButtonColors = blue, red, yellow, green
@@ -243,21 +256,22 @@
 # The following constants need to be translated in all languages.
 categoryCells = Cell Widgets
 cwCellBrowserName = Cell Browser
-cwCellBrowserDescription = Browser through dynamic data using the CellBrowser. 
+cwCellBrowserDescription = Browser through dynamic data using the CellBrowser.
 cwCellListName = Cell List
 cwCellListDescription = Render a large, custom list quickly using CellList.
 cwCellSamplerName = Cell Sampler
-cwCellSamplerDescription = The table below contains an example of most Cells provided in the API. Editable cells remember changes between table redraws until the changes are committed.  
+cwCellSamplerDescription = The table below contains an example of most Cells provided in the API. Editable cells remember changes between table redraws until the changes are committed.
 cwCellTableName = Cell Table
-cwCellTableDescription = Do you want to display large amounts of data in your application? Use CellTable to render large tables quickly. 
+cwCellTableDescription = Do you want to display large amounts of data in your application? Use CellTable to render large tables quickly.
 cwCellTableColumnAddress = Address
 cwCellTableColumnCategory = Category
 cwCellTableColumnFirstName = First Name
 cwCellTableColumnLastName = Last Name
 cwCellTreeName = Cell Tree
-cwCellTreeDescription = Render large trees dynamically using CellTree.  
+cwCellTreeDescription = Render large trees dynamically using CellTree.
 cwCellValidationName = Cell Validation
-cwCellValidationDescription = Validate user data as they enter it using cell validation techniques. Cells will maintain their edited state until you confirm the change. The fields below turn blue while the address is validated, then turn red if the address is invalid.   
+cwCellValidationDescription = Validate user data as they enter it using cell validation techniques. Cells will maintain their edited state until you confirm the change. The fields below turn blue while the address is validated, then turn red if the address is invalid.
 cwCellValidationColumnAddress = Address
 cwCellValidationColumnName = Name
 cwCellValidationError = ERROR: Address must be of the form: ### &lt;street name&gt;
+
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseConstants_ar.properties b/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseConstants_ar.properties
index 03fcbd4..2ee54c1 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseConstants_ar.properties
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseConstants_ar.properties
@@ -121,7 +121,7 @@
 cwDockPanelSouth2 = هذا هو العنصر الجنوبي الثاني
 cwDockPanelWest = هذا هو العنصر الغربي
 cwFileUploadName = تصعيد ملف
-cwFileUploadDescription = تصعيد الملف بشكل غير متزامن باستخدام امكانية اجاكس لتصعيد الملفات 
+cwFileUploadDescription = تصعيد الملف بشكل غير متزامن باستخدام امكانية اجاكس لتصعيد الملفات
 cwFileUploadNoFileError = يجب عليك اختيار ملف للتصعيد
 cwFileUploadSelectFile = <b>قم باختيار ملف:</b>
 cwFileUploadSuccessful = تم تصعيد الملف!
@@ -168,7 +168,7 @@
 cwMenuBarHelpOptions = المحتويات , كعكه الحظ , عن gwt
 cwMenuBarPrompts = شكرا لاختيارك عنصر من القائمة. اختيار جيد فعلا. الا يوجد شيء افضل تقوم به بدلا من اختيارك عنصرا من القائمة؟
 cwMessagesExampleName = رسائل
-cwMessagesExampleDescription = ان واجهة الرسائل تمكن من توليد رسائل بمتغيرات محددة الانواع والتي يمكن التحقق من صحتها خلال التجميع 
+cwMessagesExampleDescription = ان واجهة الرسائل تمكن من توليد رسائل بمتغيرات محددة الانواع والتي يمكن التحقق من صحتها خلال التجميع
 cwMessagesExampleArg0Label = <b>متغير {0}:</b>
 cwMessagesExampleArg1Label = <b>متغير {1}:</b>
 cwMessagesExampleArg2Label = <b>متغير {2}:</b>
@@ -262,3 +262,17 @@
 cwCellValidationColumnName = اس
 cwCellValidationError = يجب أن خطأ : العنوان يكون من النموذج : ### &lt;اسم الشار&gt;
 
+# The following phrases need official translations.
+cwBidiFormattingName = تنسيق النصوص ثنائية الاتجا
+cwBidiFormattingDescription = فئة BidiFormatter يحتوي على طرق لحماية سلسلة (على سبيل المثال ، اسم الموضوع باللغة الانجليزية) يتم مشوه و / أو الغربلة ما بعدها ، عندما عرض في سياق الاتجاه المعاكس ، (علىسبيل المثال ، اللغة العربية واجهة المستخدم)
+cwBidiFormattingArg0Label = <b>متغير {0}:</b>
+cwBidiFormattingArg1Label = <b>متغير {1}:</b>
+cwBidiFormattingArg2Label = <b>متغير {2}:</b>
+cwBidiFormattingNonbidiFormattedLabel = <b>تنسيق الرسالة دون BidiFormatter :</b>
+cwBidiFormattingBidiFormattedLabel = <b>رسالة منسقة مع BidiFormatter :</b>
+cwBidiFormattingLinkText = هذا المثال يتفاعل مع واجهة العينة :
+cwBidiFormattingTemplateLabel = <b>رسالة قالب :</b>
+cwBidiInputName = إدخال النص ثنائي الاتجا
+cwBidiInputDescription = صندوق النص والحاجيات ناحية النص تطبيق الواجهة HasDirectionEstimator. مع مقدر اتجاه محدد ، هذه الحاجيات ضبط اتجاهها تلقائيا وفقا للنص دخلت حتى الآن. يتم تعريف مقدر الاتجاه بشكلافتراضي عند واحد على الأقل من لغات للتطبيق من اليمين إلى اليسار
+cwBidiInputBidiAreaLabel = <b>وفيما يلي ناحية النص لديه مقدر الاتجاه في الواقع الافتراضي ، وبالتالي بيدى على علم بها. التحقق من ذلك عن طريق استبدال النص من اليمين إلى اليسار مع بعض الإنجليزية ، على سبيلالمثال السلاسل عينة أعلاه</b>
+cwBidiInputRtlAreaLabel = بدون مقدر الاتجاه ، اتجاه القطعة هي التي لم تتأثر قيمة أنواع المستخدم فيها وهذا يجعل دخول النص عكس الاتجاه ، مربكة وغير مريح<br><b>حاول كتابة <span dir=ltr>"(212) 765 4321"</span> أو <span dir=ltr>"Hi, how are you?"</span> في ناحية النص التالي من اليمين إلى اليسار (الذي كان مقدر اتجاه إيقاف)</b>
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseConstants_fr.properties b/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseConstants_fr.properties
index 16c0be9..a0c8504 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseConstants_fr.properties
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseConstants_fr.properties
@@ -262,3 +262,17 @@
 cwCellValidationColumnName = Nom
 cwCellValidationError = Erreur: l'adresse doit être de la forme: ### &lt;nom de la rue&gt;
 
+# The following phrases need official translations.
+cwBidiFormattingName = Formatage du texte bidirectionnel
+cwBidiFormattingDescription = Classe BidiFormatter contient des méthodes pour protéger une chaîne (par exemple, un nom de sujet en hébreu) d'être déformé et / ou garbling ce qui suit c'est lorsqu'elle est affichée dans le cadre de direction opposée (par exemple, une interface en anglais).
+cwBidiFormattingArg0Label = <b>Argument {0}:</b>
+cwBidiFormattingArg1Label = <b>Argument {1}:</b>
+cwBidiFormattingArg2Label = <b>Argument {2}:</b>
+cwBidiFormattingNonbidiFormattedLabel = <b>Message mis en forme sans BidiFormatter:</b>
+cwBidiFormattingBidiFormattedLabel = <b>Message mis en forme avec BidiFormatter:</b>
+cwBidiFormattingLinkText = Cet exemple interagit avec l'interface échantillon:
+cwBidiFormattingTemplateLabel = <b>Modèle de message:</b>
+cwBidiInputName = Saisie de texte bidirectionnel
+cwBidiInputDescription = La zone de texte et des widgets texte implémenter l'interface HasDirectionEstimator. Avec un estimateur de direction définie, ces widgets ajuster leur direction automatiquement en fonction du texte saisi à ce jour. Un estimateur de direction est définie par défaut lorsque au moins l'un des lieux de l'application est de droite à gauche.
+cwBidiInputBidiAreaLabel = <b>Le texte suivant a TextArea l'estimateur direction par défaut en vigueur, et est donc bidi-Aware. Vérifiez-en remplaçant le texte de droite à gauche avec un peu d'anglais, par exemple, les cordes exemple ci-dessus:</b>
+cwBidiInputRtlAreaLabel = Sans un estimateur de la direction, la direction du widget n'est pas affectée par la valeur que l'utilisateur tape po ce qui rend l'entrée de texte en direction opposée à confusion et incommode. <br> <b> Essayez de taper "(212) 765 4321" ou "Salut, comment êtes-vous? " dans le texte suivant TextArea de droite à gauche (qui avait l'estimateur direction éteint): </b>
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseConstants_zh.properties b/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseConstants_zh.properties
index f0f28fc..8f3c213 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseConstants_zh.properties
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseConstants_zh.properties
@@ -262,3 +262,17 @@
 cwCellValidationColumnName =名称
 cwCellValidationError =错误:地址必须是形式:### &lt;街道名称&gt;
 
+# The following phrases need official translations.
+cwBidiFormattingName = 双向文本格式
+cwBidiFormattingDescription = 类BidiFormatter包含的方法来保护一个字符串(对于例如,希伯来topic name)从正在出现乱码和/或garbling what如下显示它when in相反- direction上下文(例如,一英文UI)。
+cwBidiFormattingArg0Label = <b>论据 {0}:</b>
+cwBidiFormattingArg1Label = <b>论据 {1}:</b>
+cwBidiFormattingArg2Label = <b>论据 {2}:</b>
+cwBidiFormattingNonbidiFormattedLabel = <b>消息格式不BidiFormatter:</b>
+cwBidiFormattingBidiFormattedLabel = <b>消息格式与BidiFormatter:</b>
+cwBidiFormattingLinkText = 这个例子与样品交互界面:
+cwBidiFormattingTemplateLabel = <b>消息模板:</b>
+cwBidiInputName = 双向文字输入
+cwBidiInputDescription = 文本框和TextArea控件实现HasDirectionEstimator接口。有了明确的方向估计,这些小部件自动调整自己的方向,根据输入的文字至今。估计是指一个方向时,默认情况下,至少在应用程序的区域设置之一是从右到左。
+cwBidiInputBidiAreaLabel = <b>下面的文本区具有有效的默认方向估计,因而是比迪烟感知。检查取代一些英文例如,从右到左的文本中上面的示例字符串:</b>
+cwBidiInputRtlAreaLabel = 如果没有一个方向估计,该Widget的方向是由值不受影响,只有这使得相反方向的文本输入混乱和不便的用户类型。<br><b>尝试键入“(212)7654321”或“嗨,你好吗?“到下面从右到左的文本区(其中有方向估计关闭):</b>
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/BlogMessages.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/BlogMessages.java
new file mode 100644
index 0000000..265718d
--- /dev/null
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/BlogMessages.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2010 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.sample.showcase.client.content.i18n;
+
+import com.google.gwt.i18n.client.Messages;
+
+/**
+ * Internationalized messages.
+ */
+public interface BlogMessages extends Messages {
+  String userComment(String username, String numberOfPosts,
+      String commentedPostName);
+}
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/BlogMessages.properties b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/BlogMessages.properties
new file mode 100644
index 0000000..9ecf016
--- /dev/null
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/BlogMessages.properties
@@ -0,0 +1,17 @@
+#
+# Copyright 2010 Google Inc.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+#
+
+userComment = User {0} ({1} posts) added a comment on ''{2}''
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/BlogMessages_ar.properties b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/BlogMessages_ar.properties
new file mode 100644
index 0000000..184903e
--- /dev/null
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/BlogMessages_ar.properties
@@ -0,0 +1,18 @@
+#
+# Copyright 2010 Google Inc.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+#
+
+# The following phrases need official translations.
+userComment = وأضاف المستخد {0} ({1} وظيفة) وتعليقا على ''{2}''
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/BlogMessages_fr.properties b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/BlogMessages_fr.properties
new file mode 100644
index 0000000..4a8e643
--- /dev/null
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/BlogMessages_fr.properties
@@ -0,0 +1,18 @@
+#
+# Copyright 2010 Google Inc.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+#
+
+# The following phrases need official translations.
+userComment = Utilisateur {0} ({1}  postes) a ajouté un commentaire sur ''{2}''
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/BlogMessages_zh.properties b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/BlogMessages_zh.properties
new file mode 100644
index 0000000..c2c244b
--- /dev/null
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/BlogMessages_zh.properties
@@ -0,0 +1,18 @@
+#
+# Copyright 2010 Google Inc.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+#
+
+# The following phrases need official translations.
+userComment = 用户 {0} ({1} 个) 增加了评论 ''{2}''
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/CwBidiFormatting.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/CwBidiFormatting.java
new file mode 100644
index 0000000..9c098e8
--- /dev/null
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/CwBidiFormatting.java
@@ -0,0 +1,278 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.sample.showcase.client.content.i18n;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.RunAsyncCallback;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.KeyUpEvent;
+import com.google.gwt.event.dom.client.KeyUpHandler;
+import com.google.gwt.i18n.client.Constants;
+import com.google.gwt.i18n.client.LocaleInfo;
+import com.google.gwt.i18n.shared.BidiFormatter;
+import com.google.gwt.sample.showcase.client.ContentWidget;
+import com.google.gwt.sample.showcase.client.ShowcaseAnnotations.ShowcaseData;
+import com.google.gwt.sample.showcase.client.ShowcaseAnnotations.ShowcaseRaw;
+import com.google.gwt.sample.showcase.client.ShowcaseAnnotations.ShowcaseSource;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.Anchor;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HasVerticalAlignment;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Example file.
+ */
+@ShowcaseRaw( {"BlogMessages.java", "BlogMessages.properties"})
+public class CwBidiFormatting extends ContentWidget {
+  /**
+   * The constants used in this Content Widget.
+   */
+  @ShowcaseSource
+  public static interface CwConstants extends Constants,
+      ContentWidget.CwConstants {
+    String cwBidiFormattingArg0Label();
+
+    String cwBidiFormattingArg1Label();
+
+    String cwBidiFormattingArg2Label();
+
+    String cwBidiFormattingBidiFormattedLabel();
+
+    String cwBidiFormattingDescription();
+
+    String cwBidiFormattingLinkText();
+
+    String cwBidiFormattingName();
+
+    String cwBidiFormattingNonbidiFormattedLabel();
+
+    String cwBidiFormattingTemplateLabel();
+  }
+
+  /**
+   * The {@link TextBox} where the user enters argument 0.
+   */
+  @ShowcaseData
+  private TextBox arg0Box = null;
+
+  /**
+   * The {@link TextBox} where the user enters argument 1.
+   */
+  @ShowcaseData
+  private TextBox arg1Box = null;
+
+  /**
+   * The {@link TextBox} where the user enters argument 2.
+   */
+  @ShowcaseData
+  private TextBox arg2Box = null;
+
+  /**
+   * A {@link com.google.gwt.i18n.shared.BidiFormatter} instance used for
+   * bidi-formatting of user input.
+   */
+  @ShowcaseData
+  private BidiFormatter bidiFormatter =
+      BidiFormatter.getInstanceForCurrentLocale();
+
+  /**
+   * An instance of the constants.
+   */
+  @ShowcaseData
+  private CwConstants constants;
+
+  /**
+   * The blog messages used in this example.
+   */
+  @ShowcaseData
+  private BlogMessages blogMessages = null;
+
+  /**
+   * The {@link HTML} used to display the message.
+   */
+  @ShowcaseData
+  private HTML message = null;
+
+  /**
+   * The {@link HTML} used to display the bidi formatted message.
+   */
+  @ShowcaseData
+  private HTML bidiFormattedMessage = null;
+
+  /**
+   * Constructor.
+   *
+   * @param constants the constants
+   */
+  public CwBidiFormatting(CwConstants constants) {
+    super(constants);
+    this.constants = constants;
+    registerSource("BlogMessages.java");
+    registerSource("BlogMessages.properties");
+  }
+
+  @Override
+  public String getDescription() {
+    return constants.cwBidiFormattingDescription();
+  }
+
+  @Override
+  public String getName() {
+    return constants.cwBidiFormattingName();
+  }
+
+  @Override
+  public boolean hasStyle() {
+    return false;
+  }
+
+  /**
+   * Initialize this example.
+   */
+  @ShowcaseSource
+  @Override
+  public Widget onInitialize() {
+    // Create the internationalized blog messages
+    blogMessages = GWT.create(BlogMessages.class);
+
+    // Use a FlexTable to layout the content
+    FlexTable layout = new FlexTable();
+    FlexCellFormatter formatter = layout.getFlexCellFormatter();
+    layout.setCellSpacing(5);
+
+    // Add a link to the source code of the Interface
+    Anchor link = new Anchor("BlogMessages");
+    link.addClickHandler(new ClickHandler() {
+      public void onClick(ClickEvent event) {
+        selectTab(2);
+      }
+    });
+    HorizontalPanel linkPanel = new HorizontalPanel();
+    linkPanel.setSpacing(3);
+    linkPanel.add(new HTML(constants.cwBidiFormattingLinkText()));
+    linkPanel.add(link);
+    layout.setWidget(0, 0, linkPanel);
+    formatter.setColSpan(0, 0, 2);
+
+    // Show the template for reference
+    String template = blogMessages.userComment("{0}", "{1}", "{2}");
+    layout.setHTML(1, 0, constants.cwBidiFormattingTemplateLabel());
+    layout.setHTML(1, 1, template);
+
+    // Add argument 0
+    arg0Box = new TextBox();
+    // Using an initial value whose direction is opposite the locale's direction
+    // demonstrates the need for and effect of bidi formatting.
+    arg0Box.setText(LocaleInfo.getCurrentLocale().isRTL() ? "Tom Bombadil" :
+      "תומר גרין");
+    layout.setHTML(2, 0, constants.cwBidiFormattingArg0Label());
+    layout.setWidget(2, 1, arg0Box);
+
+    // Add argument 1
+    arg1Box = new TextBox();
+    arg1Box.setText("16");
+    layout.setHTML(3, 0, constants.cwBidiFormattingArg1Label());
+    layout.setWidget(3, 1, arg1Box);
+
+    // Add argument 2
+    arg2Box = new TextBox();
+    // Using an initial value whose direction is opposite the locale's direction
+    // demonstrates the need for and effect of bidi formatting.
+    arg2Box.setText(LocaleInfo.getCurrentLocale().isRTL() ?
+        "How deep is your love?" : "כמה חול יש בחוף?");
+    layout.setHTML(4, 0, constants.cwBidiFormattingArg2Label());
+    layout.setWidget(4, 1, arg2Box);
+
+    // Add the unformatted message
+    message = new HTML();
+    layout.setHTML(5, 0, constants.cwBidiFormattingNonbidiFormattedLabel());
+    layout.setWidget(5, 1, message);
+    formatter.setVerticalAlignment(5, 0, HasVerticalAlignment.ALIGN_TOP);
+
+    // Add the bidi formatted message
+    bidiFormattedMessage = new HTML();
+    layout.setHTML(6, 0, constants.cwBidiFormattingBidiFormattedLabel());
+    layout.setWidget(6, 1, bidiFormattedMessage);
+    formatter.setVerticalAlignment(6, 0, HasVerticalAlignment.ALIGN_TOP);
+
+    // Add handlers to all of the argument boxes
+    KeyUpHandler keyUpHandler = new KeyUpHandler() {
+      public void onKeyUp(KeyUpEvent event) {
+        updateMessages();
+      }
+    };
+    arg0Box.addKeyUpHandler(keyUpHandler);
+    arg1Box.addKeyUpHandler(keyUpHandler);
+    arg2Box.addKeyUpHandler(keyUpHandler);
+
+    // Return the layout Widget
+    updateMessages();
+
+    return layout;
+  }
+
+  @Override
+  protected void asyncOnInitialize(final AsyncCallback<Widget> callback) {
+    GWT.runAsync(CwBidiFormatting.class, new RunAsyncCallback() {
+
+      public void onFailure(Throwable caught) {
+        callback.onFailure(caught);
+      }
+
+      public void onSuccess() {
+        callback.onSuccess(onInitialize());
+      }
+    });
+  }
+
+  @Override
+  protected void setRunAsyncPrefetches() {
+    prefetchInternationalization();
+  }
+
+  /**
+   * Html-escape the input String.
+   * TODO(tomerigo): Use SafeHtml when it becomes available.
+   */
+  @ShowcaseSource
+  private String htmlEscape(String str) {
+      return str.replace("&", "&amp;").replace("<", "&lt;");
+  }
+
+  /**
+   * Update the formatted message.
+   */
+  @ShowcaseSource
+  private void updateMessages() {
+    String arg0 = arg0Box.getText().trim();
+    String arg1 = arg1Box.getText().trim();
+    String arg2 = arg2Box.getText().trim();
+    message.setText(blogMessages.userComment(arg0, arg1, arg2));
+
+    bidiFormattedMessage.setHTML(blogMessages.userComment(
+        bidiFormatter.spanWrap(arg0),
+        // arg1 is intended to be an unsigned number, so bidi formatting is not
+        // needed. However, HTML escaping is a must to avoid an XSS attack hole!
+        htmlEscape(arg1),
+        bidiFormatter.spanWrap(arg2)));
+  }
+}
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/CwBidiInput.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/CwBidiInput.java
new file mode 100644
index 0000000..1834af0
--- /dev/null
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/CwBidiInput.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.sample.showcase.client.content.i18n;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.RunAsyncCallback;
+import com.google.gwt.i18n.client.Constants;
+import com.google.gwt.i18n.client.HasDirection.Direction;
+import com.google.gwt.sample.showcase.client.ContentWidget;
+import com.google.gwt.sample.showcase.client.ShowcaseAnnotations.ShowcaseData;
+import com.google.gwt.sample.showcase.client.ShowcaseAnnotations.ShowcaseSource;
+import com.google.gwt.sample.showcase.client.ShowcaseAnnotations.ShowcaseStyle;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.TextArea;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Example file.
+ */
+@ShowcaseStyle(/* css style names */{".gwt-TextArea"})
+public class CwBidiInput extends ContentWidget {
+  /**
+   * The constants used in this Content Widget.
+   */
+  @ShowcaseSource
+  public static interface CwConstants extends Constants,
+      ContentWidget.CwConstants {
+    String cwBidiInputRtlAreaLabel();
+
+    String cwBidiInputBidiAreaLabel();
+
+    String cwBidiInputDescription();
+
+    String cwBidiInputName();
+  }
+
+  /**
+   * An instance of the constants.
+   */
+  @ShowcaseData
+  private CwConstants constants;
+
+  /**
+   * Constructor.
+   *
+   * @param constants the constants
+   */
+  public CwBidiInput(CwConstants constants) {
+    super(constants);
+    this.constants = constants;
+  }
+
+  @Override
+  public String getDescription() {
+    return constants.cwBidiInputDescription();
+  }
+
+  @Override
+  public String getName() {
+    return constants.cwBidiInputName();
+  }
+
+  /**
+   * Initialize this example.
+   */
+  @ShowcaseSource
+  @Override
+  public Widget onInitialize() {
+    // Create a panel to layout the widgets
+    VerticalPanel vpanel = new VerticalPanel();
+    vpanel.setSpacing(10);
+
+    // Add a bidi-disabled TextArea
+    vpanel.add(new HTML(constants.cwBidiInputRtlAreaLabel()));
+    TextArea disabled = new TextArea();
+    disabled.setDirectionEstimator(false);
+    disabled.setDirection(Direction.RTL);
+    vpanel.add(disabled);
+
+    // Add a bidi-enabled TextArea
+    vpanel.add(new HTML(constants.cwBidiInputBidiAreaLabel()));
+    TextArea enabled = new TextArea();
+    // Since this application includes at least one RTL locale, this TextArea
+    // has automatic direction handling on by default.
+    assert enabled.getDirectionEstimator() != null;
+    enabled.setText("كم عدد حبات الرمل في الشاطئ?");
+    vpanel.add(enabled);
+
+    // Return the panel
+    return vpanel;
+  }
+
+  @Override
+  protected void asyncOnInitialize(final AsyncCallback<Widget> callback) {
+    GWT.runAsync(CwBidiInput.class, new RunAsyncCallback() {
+
+      public void onFailure(Throwable caught) {
+        callback.onFailure(caught);
+      }
+
+      public void onSuccess() {
+        callback.onSuccess(onInitialize());
+      }
+    });
+  }
+
+  @Override
+  protected void setRunAsyncPrefetches() {
+    prefetchTextInput();
+  }
+}