qooxdoo / qooxdoo

qooxdoo - Universal JavaScript Framework
http://qooxdoo.org
Other
766 stars 261 forks source link

No support for RTL languages (BZ#4867) #4948

Closed qx-bug-importer closed 8 years ago

qx-bug-importer commented 13 years ago

Stefan Andersson (dev) wrote:

qx.locale.Manager

It is very important to us to have full support for RTL languages. Here we will add all our changes to the code to make it completely RTL compatible. RTL compatibility is important to get spread. We share this code with the community.

Starting with the qx.locale.Manager :

Adding direction in the class. The direction should be pulled by the generator and put in the $$locales array to be accessible by the framework. Until that has been implemented it need to be set by ugly coding...

assigned to Stefan Andersson (dev)

qx-bug-importer commented 13 years ago

Stefan Andersson (dev) wrote:

Implemented cldr_layout_orientation_characters

Manager.diff (text/plain)

Index: framework/source/class/qx/locale/Manager.js
===================================================================
--- framework/source/class/qx/locale/Manager.js (revision 26143)
+++ framework/source/class/qx/locale/Manager.js (working copy)
@@ -198,7 +198,20 @@
       return this.__language;
     },

+    /**
+     * Get the direction of the current locale
+     *
+     * This is either right-to-left or nothing (default: left-to-right) for the direction of the language.
+     *
+     * @return {String} "left-to-right" or "right-to-left"
+     */
+    getDirection : function() {
+      var cldr_id = "cldr_layout_orientation_characters";
+      var dir = this.localize(cldr_id, [], this.__locale);

+      return (dir == cldr_id ? "left-to-right" : dir);
+    },
+
     /**
      * Get the territory code of the current locale
      *
qx-bug-importer commented 13 years ago

Stefan Andersson (dev) wrote:

misc cldr.py

to push cldr_layout_orientation_characters info

None (default: left-to-right) when LTR languages

and

"right-to-left" for RTL languages

Please push this for the 1.4 release then it will be easier to attach all the classes we have changed cause this is the basis of the change of layout.

cldr.diff (text/plain)

Index: tool/pylib/misc/cldr.py
===================================================================
--- tool/pylib/misc/cldr.py (revision 26143)
+++ tool/pylib/misc/cldr.py (working copy)
@@ -150,7 +150,16 @@

     return data

+def extractOrientation(tree):
+    data = {}

+    layoutOrientationCharactersNode = tree.find("layout/orientation")
+    if layoutOrientationCharactersNode != None:
+        data['cldr_layout_orientation_characters'] = layoutOrientationCharactersNode.attrib["characters"]
+
+    return data
+
+
 def parseCldrFile(filename, outputDirectory=None):
     tree = ElementTree.parse(filename)

@@ -171,6 +180,7 @@

     data.update(extractDelimiter(tree))
     data.update(extractNumber(tree))
+    data.update(extractOrientation(tree))

     return data
qx-bug-importer commented 13 years ago

Stefan Andersson (dev) wrote:

any theme...

The theme needs to tell what text directions it supports by textDirection. Here in the Classic theme.

Classic.diff (text/plain)

Index: framework/source/class/qx/theme/Classic.js
===================================================================
--- framework/source/class/qx/theme/Classic.js  (revision 26144)
+++ framework/source/class/qx/theme/Classic.js  (working copy)
@@ -32,5 +32,7 @@
     font : qx.theme.classic.Font,
     appearance : qx.theme.classic.Appearance,
     icon : qx.theme.icon.Oxygen
-  }
+  },
+
+   textDirection : ["left-to-right", "right-to-left"]
 });
qx-bug-importer commented 13 years ago

Stefan Andersson (dev) wrote:

The qx.theme.manager.Meta class

The manager needs to read and store the supported text directions of a theme. Reading textDirection from the main theme file.

Meta.diff (text/plain)

Index: framework/source/class/qx/theme/manager/Meta.js
===================================================================
--- framework/source/class/qx/theme/manager/Meta.js (revision 26144)
+++ framework/source/class/qx/theme/manager/Meta.js (working copy)
@@ -45,7 +45,16 @@
       check : "Theme",
       nullable : true,
       apply : "_applyTheme"
-    }
+    },
+
+       /**
+        * The support for text direction of the theme.
+        */
+       textDirectionSupported :
+       {
+      check : [ "left-to-right", "right-to-left" ],
+      nullable : true
+       }
   },

@@ -75,6 +84,7 @@
         font = value.meta.font || null;
         icon = value.meta.icon || null;
         appearance = value.meta.appearance || null;
+        textDirectionSupported = value.meta.textDirection || null;
       }

       var colorMgr = qx.theme.manager.Color.getInstance();
@@ -88,6 +98,8 @@
       fontMgr.setTheme(font);
       iconMgr.setTheme(icon);
       appearanceMgr.setTheme(appearance);
+
+           this.setTextDirectionSupported(textDirection);
     },
qx-bug-importer commented 13 years ago

Stefan Andersson (dev) wrote:

Update

Meta.diff (text/plain)

Index: framework/source/class/qx/theme/manager/Meta.js
===================================================================
--- framework/source/class/qx/theme/manager/Meta.js (revision 26144)
+++ framework/source/class/qx/theme/manager/Meta.js (working copy)
@@ -45,7 +45,16 @@
       check : "Theme",
       nullable : true,
       apply : "_applyTheme"
-    }
+    },
+
+       /**
+        * The support for text direction of the theme.
+        */
+       textDirectionSupported :
+       {
+      check : [ "left-to-right", "right-to-left" ],
+      nullable : true
+       }
   },

@@ -75,6 +84,7 @@
         font = value.meta.font || null;
         icon = value.meta.icon || null;
         appearance = value.meta.appearance || null;
+        textDirectionSupported = value.meta.textDirection || null;
       }

       var colorMgr = qx.theme.manager.Color.getInstance();
@@ -88,6 +98,8 @@
       fontMgr.setTheme(font);
       iconMgr.setTheme(icon);
       appearanceMgr.setTheme(appearance);
+
+           this.setTextDirectionSupported(textDirectionSupported);
     },
qx-bug-importer commented 13 years ago

Stefan Andersson (dev) wrote:

The qx.theme.manager.Meta class

Meta.diff (text/plain)

Index: framework/source/class/qx/theme/manager/Meta.js
===================================================================
--- framework/source/class/qx/theme/manager/Meta.js (revision 26158)
+++ framework/source/class/qx/theme/manager/Meta.js (working copy)
@@ -45,7 +45,16 @@
       check : "Theme",
       nullable : true,
       apply : "_applyTheme"
-    }
+    },
+
+       /**
+        * The support for text direction of the theme.
+        */
+       textDirectionSupported :
+       {
+      check : [ "left-to-right", "right-to-left" ],
+      nullable : true
+       }
   },

@@ -67,6 +76,7 @@
       var font = null;
       var icon = null;
       var appearance = null;
+      var textDirectionSupported = null;

       if (value)
       {
@@ -75,6 +85,7 @@
         font = value.meta.font || null;
         icon = value.meta.icon || null;
         appearance = value.meta.appearance || null;
+        textDirectionSupported = value.meta.textDirection || null;
       }

       var colorMgr = qx.theme.manager.Color.getInstance();
@@ -88,6 +99,8 @@
       fontMgr.setTheme(font);
       iconMgr.setTheme(icon);
       appearanceMgr.setTheme(appearance);
+
+           this.setTextDirectionSupported(textDirectionSupported);
     },
qx-bug-importer commented 13 years ago

Stefan Andersson (dev) wrote:

qx.theme.Classic class

Classic.diff (text/plain)

Index: framework/source/class/qx/theme/Classic.js
===================================================================
--- framework/source/class/qx/theme/Classic.js  (revision 26144)
+++ framework/source/class/qx/theme/Classic.js  (working copy)
@@ -32,5 +32,7 @@
     font : qx.theme.classic.Font,
     appearance : qx.theme.classic.Appearance,
     icon : qx.theme.icon.Oxygen
-  }
+  },
+
+   textDirection : ["left-to-right", "right-to-left"]
 });
qx-bug-importer commented 13 years ago

Martin Wittemann (@wittemann) wrote:

* This bug has been marked as a duplicate of BZ#4866 *

qx-bug-importer commented 13 years ago

Thomas Herchenroeder (@thron7) wrote:

Fix duplicate relation.

qx-bug-importer commented 13 years ago

Thomas Herchenroeder (@thron7) wrote:

> Fix duplicate relation.

Nope, it was right.

* This bug has been marked as a duplicate of BZ#4866 *

qx-bug-importer commented 13 years ago

Thomas Herchenroeder (@thron7) wrote:

> > > Fix duplicate relation. > > Nope, it was right. > > * This bug has been marked as a duplicate of BZ#4866 *

Nope, it was wrong.

qx-bug-importer commented 13 years ago

Thomas Herchenroeder (@thron7) wrote:

* BZ#4866 has been marked as a duplicate of this bug. *

qx-bug-importer commented 13 years ago

Thomas Herchenroeder (@thron7) wrote:

* BZ#1809 has been marked as a duplicate of this bug. *

qx-bug-importer commented 13 years ago

Andreas Ecker (@ecker) wrote:

Stefan, thanks for looking into RTL support. But a bug report with many attachments (many of them obsolete now already), easily becomes an unaccessible code dump. I doubt anyone would be able to make real progress given the input in such a form ...

I suggest you create a contribution in qooxdoo-contrib. This would also allow to gather other devs interested in RTL support, and using the available infrastructure for such user-driven contribs (code repository and versioning, wiki for documentation, bugzilla for task tracking, etc.).

qx-bug-importer commented 13 years ago

Stefan Andersson (dev) wrote:

I agree completely, if that is how you want it, but I first looked at it as an enhancement.

But let us create this as the first contribution as you wish. No problem. It is an additive contribution meaning that they need to use the svn diff to update about 100 files of the framework to be able to run it.

We do not have time to copy or remake the files with new versions of all the framework files and with a new namespace too. Too many changes to too many files.

We will put the files as diff files and through a script update their existing framework. How can we upload it?

qx-bug-importer commented 13 years ago

Andreas Ecker (@ecker) wrote:

This bug didn't have an assignee, so I assigned it to you Stefan, as you seem to make good progress according to the posts to the mailing list.

qx-bug-importer commented 12 years ago

Stefan Andersson (dev) wrote:

A contribution called qooxdoo-rtl which we have contributed makes qooxdoo rtl compatible now.