Closed (duplicate)
Project:
Drupal core
Version:
6.x-dev
Component:
locale.module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
27 Mar 2006 at 16:33 UTC
Updated:
29 Mar 2007 at 14:59 UTC
Jump to comment: Most recent file
Comments
Comment #1
druvision commentedSince the issue was opened, language direction support was added to the i18n module. However, it's agreed this should really be moved be core.
The solution, should be in core level, and the modules' CSS files should be doubled. A simple function should decide which CSS file to load. I realy don't see the need to hussle with another module (great as it is).
The direction field is needed in the languages table in core. This would make so many things much simpler.
For example, in drupal 5.0 there is a separate style sheet for each core module. Attached is RTL versions of the style sheets.
Having the language direction in core would enable us to automatically load the correct style sheets according to the current language. Doing it in core is correct for all themes. It's inefficient to duplicate the work for each module.
In the 5.0 beta 1 version, there are 16 modules which require attention. In each module folder, there is a CSS file, whose name we've changed from modulename.css to modulename-rtl.css. Hence, the following additional files are attached:
admin-rtl.css, aggregator-rtl.css, block-rtl.css, book-rtl.css, comment-rtl.css, defaults-rtl.css, forum-rtl.css, help-rtl.css, menu-rtl.css, node-rtl.css, poll-rtl.css, profile-rtl.css, search-rtl.css, system-rtl.css, taxonomy-rtl.css, user-rtl.cssIn order to continue with the efficiency purpose in the base of the file names, we must load the new files instead of the present files.
In the current RTL localization of Drupal Israel, the CSS files upload code have to be repeatedly copied fo each new theme (code below). Of course, it will be more efficient to upload it once, generically, on core.
Currently, The following code is added in page.tpl.php to change the default styles array:
The following action loads the new array instead of the default array:
There must be a more generic way to do it - and that's why I think that adding the language direction attriute to core is a good idea.
The attached files are for beta 1. Some location and CSS changes were done in beta 2 - updated files will hopefully follow - but having the direction attribute to files is an important base for it all. Once the base exist, we can update files as needed.
Comment #2
druvision commentedTo summerize, we believe Drupal's core should have an RTL (/TTB) version of each of the css files of the core modules added to the core distribution, and add a function which will select the right file. We will supply the right RTL file.
We believe that If the core will allow dual files, then contrib modules will also start to add this option. Also, if the function which loads CSS files will select the right version, then it will be done automatically for contrib modules as well, without writing any special functions.
Amnon Levav
Drupal Israel
Comment #3
killes@www.drop.org commentedI think the right table to add this is the locales_meta table. It already contains language specific stuff like the way that plurals are handled.
The question is: How do we get this information /into/ that table? The plurals for example are added from the PO files. However, I don't think that rtl is a valid header for PO files.
Comment #4
Steven commentedHave you considered automatic mirrorring of CSS files?
Comment #5
Steven commentedComment #6
druvision commented>> KILLES asked: How do we get this information /into/ that table
Hi Killes,
I hope I understand you correctly. I think "this" in your question means = "the RTL information".
Language direction (LTR / RTL / TTB) is a constant language attribute. The default is LTR, so there are only 20-30 constant values to put info the locales_meta table. Not such a big deal.
I suggested adding a "direction" column to the locales_meta table (this will provide more flexibility for developers). Your suggestion of a property is also possible but more difficult to work with.
A good strating list of locales contains "ar", "fa", "he", "ur" and "yi" (ref: http://drupal.org/node/3696). There are 10-20 more languages (ref: http://www.i18nguy.com/temp/rtl.html) but I suggest they will be added upon request.
Here is the basic code from http://drupal.org/node/3696:
Yes, Steven. We have considered automatic mirrorring of CSS files:
1. We have already defined a general algorithm for that, but it won't always work, so such an automatic conversion can only be used as a deafult, with a possibility for override.
2. Automatic CSS mirring is an additional layer. First deal with having the language direction in the database, and define the architecture. Only then we can create various algorithms. I think this is the right order.
3. Once we have the basic core DB structure covered, we can make PHPTemplate smarter. Automatic CSS mirroring must also have the ability to override it on a per-template basis. Sometimes it's needed. We can allow CSS to take the mirrored file, if available, and later even try to create it, but this is an advance solution.
Comment #7
Saied Taghavi commenteddear levavie,
after a search in forum and reading lots of topics about drupal rtl support it seems that your approach is better than others and more acceptable. but it is not clear that this approach and attached file(s) cab be applied to drupal 4.7.4 (current stable version). i want to ask you if possible describe your approach a bit clear specifically for latest stable version.
thanks
Comment #8
druvision commentedHi Saied,
This whole post is related to drupal 5.0 RTL support.
Drupal 4.7.x is much easier - but please open a separate issue for that. You simply need to use the BIDI theme (or download similar RTL themes from here. Find somebody that will translate it for you...
Amnon
Comment #9
druvision commentedFor the meanwhile I've add a new 5.0 theme, Garland RTL, which implements my RTL ideas. Your help is welcome for testing and submitting fixes.
Currently, the RTL language detection code is hardcoded inside page.tpl.php - I hope it will be moved to core, so it will be available for all themes. Anyway, this is a big advancement over the previous state.
Comment #10
druvision commentedTo summerize the thread above:
Currently, anyone who needs to know the language direction must hardcode it. The following code is used by the new Garland RTL theme, which aims to be the standard theme for RTL languages:
Locale.module must provide information about the language direction.
It will be more efficient to store those values as an array.
Suggested API
Suggested implementation
Of couse if we want to be generic, we can store those values a new column, named 'direction', in the 'locales_meta' table, and initialized by drupal DB creation:
This brings us to the alternate implementation:
But this seems like an overkill. All we need is an array of 10-20 constant values, so I will go with the first implementation.
So, please review & commit the 1st implementation
Comment #11
druvision commentedComment #12
druvision commentedChanging the function name in the title to locale_get_direction ($locale)
Comment #13
dries commentedThe API looks good, but we'll want to pull this out of the database. People can add custom languages (or derivative languages such special language dialects) through the user interface. Thus, it is impossible to use a static array.
As for the CSS, would it be possible to have a small rtl.css or ltr.css that gets included? If so, could the other stylesheets be 100% agnostic? It would be great if we could isolate the RTL/LTR specific bits but I doubt that is possible.
Comment #14
z.stolar commentedAbout CSS - In Drupal Israel we already did some work to provide core RTL CSS files. These files are also provided with the RTL version of Garland - Garlandrtl.
I think breaking the CSS into two seperate files (e.g. defaults-sizes-and-colors.css and defaults-directionality.css) would be a nightmare to work with. However, since core CSS files are hardly changed during a release's life span, it's quite easy to have two versions of the CSS files, and have a core function to load the correct one.
As already stated elsewhere, this would hopefuly incourage contrib modules authors to include two version of their CSS, or at least would enable other people to easily contribute the RTL CSS, in the same way it is done with translations.
Comment #15
alaa commenteddries in a perfect world an rtl css should be a mirror of the default ltr css.
so padding, border and margine values for left and right should be reversed, for floats and text-align we should change the value from left to right and vice versa.
but browser bugs (rtl support sucks in all browsers, IE is not the exception here) and complex designs require tweaks and hacks.
I doubt we can ask themer's to cope with all that, but for module css (specially core), I'm sure we can have perfect mirrors (generated or hand made) and let themers worry about the bugs and the hacks.
Comment #16
druvision commentedThis thread had two discussions going on parallel (I expect more to come):
The first issue (locale_get_direction API) has passed review and solution has been decided (the API concept is approved. The language direction property needs to be saved in the database) - please assign it to the right person to do the change!
For the second issue (Location of CSS RTL files for core and contrib modules) - decision has yet to be taken on where to save them (no, we can't do it automatically).
Those issues should be discussed on separate threads.
I am now splitting up the discussion - this will enable us to move forward more smoothly.
Since we don't have a separate RTL compenent to the drupal project, I will leave this issue as a summary issue to hold the current status of RTL translation. Please post specific information to the relevant issues.
Comment #17
druvision commentedNew splitted issues:
Comment #18
druvision commentedIssues 1 and 2 seem to be solved by the Budapest internationalization meeting finding, while issue #3 is still open, so I hope to summerize it soon.
Comment #19
druvision commentedI've summerized issue #3 here: Automatically load RTL CSS files
Comment #20
gábor hojtsyIssues are split, and Drupal 6 core already has support for RTL languages (although not RTL CSS yet), so marking this issue duplicate.