Closed (fixed)
Project:
Drupal core
Version:
6.x-dev
Component:
language system
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
11 Jan 2008 at 08:52 UTC
Updated:
7 Feb 2008 at 09:51 UTC
Jump to comment: Most recent file
Comments
Comment #1
hass commentedAside - code filter seems buggy and have eaten my code above...
Comment #2
dvessel commentedThis should have been added long ago. It's perfectly valid even with xhtml strict.
I think it would help rtl conditions and make it more feature complete.
Comment #3
hass commentedUps, maybe this is my theme that missing this... i will take a look...
Comment #4
hass commentedSo - i've checked all core themes and the direction does not exists in page.tpl.php, yet.
Comment #5
vladimir.dolgopolov commented@hass: your suggestion is to add $language->direction variable into template page.tpl.php?:
But as said in http://drupal.org/node/132442
"$language->direction being an intereger (0 or LANGUAGE_LTR for left to right and 1 or LANGUAGE_RTL for right to left)"
So we need a string representation of it.
Comment #6
gábor hojtsyThen we probably need a $direction variable generated from the page template preprocessor.
Comment #7
hass commented@vladimir.dolgopolov: Yep :-)
Comment #8
dvessel commentedThis should cover it.
Comment #9
vladimir.dolgopolov commentedI think it's better to use "direction" value as variable of $language object, not as plain var (so we use $language->language):
and so on
// $language is now an object
// http://drupal.org/node/132442#language-var
Comment #10
dvessel commentedIt's already been established what $language contains. Within it *->dir exists and anyone who needs that data knows it's there. A separate variable is being used here specific to templates so $direction is fine.
Comment #11
vladimir.dolgopolov commentedMy only suggestion here: let's use "language related stuff" in templates one way - either as object or as variables.
Comment #12
cburschkaIs there a design policy that forbids the following?
Sorry if there are more than these two possibilities for direction; if so, the design does have to be more complex.
Comment #13
gábor hojtsyArancaytar: the policy is that we'd like to have simpler templates then that. The whole preprocess magic is there to get off this burden from the themers. I see that using $direction for this and using $language->... for all others is a bit inconsistent, but I am not sure how should we stuff up the language object for the theme. What should be a good name for the direction string attribute?
Comment #14
cburschka$language->direction_attribute or $language->dir_att? Just going by instinct...
Edit: Although using abbreviations would make it somewhat harder to follow.
Comment #15
hass commented"$language->dir" sounds good to me.
Comment #16
vladimir.dolgopolov commentedSo we have 2 options concerning 'dir' variable:
a) update only "includes\theme.inc:template_preprocess_page()" and use it only for themes, like this:
b) set the variable on early stages and use it in scripts (core, modules) too.
I'd prefer (a).
Comment #17
gábor hojtsyI think it is fine to have it in the page theme only for now. AFAIK, no other theme functions expose the language so far. If they would, we would need to do this somewhere more central to avoid code repetition, but language support in Drupal 6 is on the page level.
Comment #18
hass commented@Gabor: does "page level" means - only:
or a
$directionvariable and this code:Comment #19
gábor hojtsyhass: my comment on page level language handling has no relation to any source code whatsoever, it just means we don't have a feature to specify a language of a paragraph or a table. We do have node language support, but we don't specify it's direction on the node template; our CSS also sets a global direction attribute for the whole page.
Comment #20
hass commentedHmmm... and what are we doing now? :-)
Comment #21
gábor hojtsy$language->dir from #16/2 above looks logical to me.
Comment #22
cburschkaUnless somebody else wants to, I could make the new patch.
Edit: Am I right in assuming that the previous patch of chameleon.theme should not be changed? It uses a different variable set than those provided in theme.inc, setting language to be a string rather than an object, which helps it in placing the variables directly into quotes.
Comment #23
cburschkaThis modifies patch #8 to replace $variables['direction'] and $direction with $variables['language']->dir and $language->dir. The documentation comment in page.tpl.php is also updated. Chameleon continues to use $language and $direction as strings.
Comment #24
cburschkaMarking CNR.
Comment #25
hass commentedYou change here doesn't look correct:
Comment #26
hass commentedHmmm, no. The language object should exist every time and NULL makes no sense inside HTML.
Comment #27
hass commentedTested all core themes + my own in LTR and RTL. Looks good.
Comment #28
hass commentedI get the following notice on page
update.php?op=resultsif i'm running an update.notice: Undefined property: stdClass::$dir in C:\Inetpub\wwwroot\drupal6\themes\garland\maintenance-page.tpl.php on line 16.Comment #29
cburschkaIt /is/ bad code; not E_NOTICE-safe. I copied the previous patch without checking anything aside from the $language->dir change, sorry. I'll bring in the corrected patch in a moment.
Comment #30
cburschkaWait, that particular error indicates that $language is an object, but $language->dir isn't set. I'm not sure how that works... isn't the variable assignment in theme.inc always run?
I stand ready to replace the theme.inc code with
which would prevent warnings (or even fatals) if $GLOBALS['language'] failed to be an object. But the error specified seems to be caused by something else... hass, could you var_dump or print_r the variables in maintenance-page.tpl.php and in theme.inc before and after the language variable is supposed to be set? I'd do it, but it'd have to wait until tonight...
Comment #31
cburschka$language->dir isn't set on maintenance-page.tpl.php, but is set in page.tpl.php
I'll try to figure out what is going on here.
Comment #32
cburschkamaintenance-page.tpl.php does not use includes/theme.inc to populate its variables. I'm figuring out where it does get populated so I'll know what file to update. As good as fixed.
Comment #33
cburschkaI feel a bit silly for missing it now. But hey. Patch follows shortly.
Comment #34
cburschkaFinally! Notice is gone on my update pages now.
Comment #35
cburschka2 commits on includes/theme.inc since last checkout (#210479 and #212409). Patch applies with 8 lines offset; not critical but it's no bother to re-roll.
Comment #36
dvessel commentedMinor coding style nitpick. Inside chameleon.theme:
How about structuring it like the rest by removing the isset() and !empty()?
Comment #37
cburschkaYou're right. The existing code already makes no sense - if the other themes don't need to isset()-wrap, then chameleon doesn't need to either. Both checks removed here.
Comment #38
dvessel commentedLooks good.
It wouldn't hurt to have a followup patch after this gets in to remove the direction from style-rtl.css from all the themes.
Comment #39
gábor hojtsyThe chameleon code seems to be broken. You did:
And then used $language later as if it was a language code. Not good.
Comment #40
hass commented@dvessel:
never heard about this possibility... are you sure? Any reference?
Comment #41
cburschka@Gabor: Oh my, how silly. Fixed.
Comment #42
dvessel commentedugh, me bad review. It's ready now. :)
@hass, direction is done through the markup with the patch. I'd argue that it's not a style, it's more integral to the structure of the page. Might not make much practical difference but it makes more sense.
Comment #43
gábor hojtsyThanks, committed.
Comment #44
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.