HighDots Forums  

specify language as in <span lang="en">?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss specify language as in <span lang="en">? in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #21  
Old   
VK
 
Posts: n/a

Default Re: specify language as in <span lang="en">? - 05-19-2006 , 08:11 AM







Jan Wagner wrote:
Quote:
VK wrote:
It seems overlooked in Aural CSS specs. Use behavior twinpair (IE 5.5+,
FF1.0+, Moz Suite 1.0+, Camino 1.0+, NN8+)
snip nice code

Thanks for the interesting solution! Looks pretty good, though
complex (or rather, just about complex enough to suit me very well
;-)). I'll give that one a go, thx for sharing.
Oops... sorry for a typo in lang.htc file (copy'n'paste damn it) Must
be:

<?xml version="1.0"?>
<public>
<component>
<attach event="oncontentready" onevent="constructor()" />
</component>
<script type="text/Jscript"><!--
function constructor() {
element.setAttribute('lang','fi');
}
//--></script>
</public>

So function declaration was omited. The defective variant still works
but shows warning sign in IE as you maybe already noticed. Sorry again.



Reply With Quote
  #22  
Old   
Jan Wagner
 
Posts: n/a

Default Re: specify language as in <span lang="en">? - 05-19-2006 , 10:53 AM






VK wrote:
Quote:
Jukka K. Korpela wrote:
Huh? A table column may have a lang attribute when declared using <col
lang="...">. Whether programs support this is a different issue.

And a very interesting one: because neither IE nor FF nor other browser
I'm aware of do not support this coding. Overall colgroup/col support
on browsers except IE is very poor, especially on FF. The only
attribute really recognized universally in col is width. This way <col
lang="fi"> would have an academical value only: profoundly correct and
utterly useless.

OP is welcome to try it though as I may be trolling again.
LOL... Unfortunately you weren't just trolling - it did not work
with colgroup/col in my test setup, tried it in FF and IE using the
JAWS demo version. <col lang=".."> was not recognized or honored,
what a shame.

- Jan



Reply With Quote
  #23  
Old   
Jan Wagner
 
Posts: n/a

Default Re: specify language as in <span lang="en">? - 05-19-2006 , 11:21 AM



VK wrote:
Quote:
Oops... sorry for a typo in lang.htc file (copy'n'paste damn it) Must
be:

?xml version="1.0"?
public
component
attach event="oncontentready" onevent="constructor()" /
/component
script type="text/Jscript"><!--
function constructor() {
element.setAttribute('lang','fi');
}
//--></script
/public

So function declaration was omited. The defective variant still works
but shows warning sign in IE as you maybe already noticed. Sorry again.
Thanks for your help! However even this code, and some further
fiddling around, did not work with JAWS in IE nor in FF. Haven't
checked if it would work in HT Reader and Dolphin HAL, it just might.
However since I'd rather like to have the same markup or method work
with all screen readers, it looks like I'll just have to get off my
lazy ass and write that <td lang="xx"> lang attribute inserter
script for Dreamweaver to get this done in the more "generally
supported" way. Still, thanks for your code, much appreciated!

- Jan


Reply With Quote
  #24  
Old   
VK
 
Posts: n/a

Default Re: specify language as in <span lang="en">? - 05-19-2006 , 11:37 AM



VK wrote:
Quote:
?xml version="1.0"?
public
component
attach event="oncontentready" onevent="constructor()" /
/component
script type="text/Jscript"><!--
function constructor() {
element.setAttribute('lang','fi');
}
//--></script
/public
Jan Wagner wrote:
Quote:
Thanks for your help! However even this code, and some further
fiddling around, did not work with JAWS in IE nor in FF.Haven't
checked if it would work in HT Reader and Dolphin HAL, it just might.
Could you elaborate on this if you have some? (it is important to me to
know for binding/behavior support). I have a weak - to say the least -
idea about JAWS but of course I can gougle out for that. Yet behaviors
are being applied on the parsing stage, thus then load event fired the
job is already done. Maybe JAWS intercept data stream right from the
server? You mean lang attribute doesn't set at all, as no behavior
attached? No errors?

Quote:
However since I'd rather like to have the same markup or method work
with all screen readers, it looks like I'll just have to get off my
lazy ass and write that <td lang="xx"> lang attribute inserter
script for Dreamweaver to get this done in the more "generally
supported" way. Still, thanks for your code, much appreciated!
As I'm in a creative mood :-) there is another option: use XSLT
transformed with patched DTD, so resulting table cells would have
default value "fi" for lang attribute (and say "Micro$oft must die!" as
default for text fields). Yet it is /really/ easier to use
search/replace in your editor :-))



Reply With Quote
  #25  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: specify language as in <span lang="en">? - 05-19-2006 , 02:56 PM



Alan J. Flavell <flavell (AT) physics (DOT) gla.ac.uk> scripsit:

Quote:
They are not supposed to have, and they don't have, any
direct effect on styling, any more than a class attribute has.

Hmmm... actually, some browsers will use lang attributes to influence
their default choice of font, for example. I don't think such
behaviour is actually wrong.
Agreed, but I don't count it as an effect on styling _in CSS terms_. Though,
admittedly, it would in a sense be describable as CSS rules. In reality,
however, the choice of the default fonts for different
languages/scripts/encodings (browser vendors really managed to mess this up)
is affected by _browser settings_ outside any CSS considerations.

(Besides, I do think such behaviour is often "wrong" in the sense of
producing practically wrong results for pages that use language markup for,
say, transliterated names or titles or passages. If I mention Dostoyevsky,
writing his name as transliterated, it's still a name in Russian and
lang="ru" would be adequate for it, but I dare not use it, since browsers
could then do an uncalled-for font change in the middle of text.)

Quote:
http://www.w3.org/TR/REC-html40/stru...tml#h-11.3.2.1

Titled "Inheritance of alignment specifications", I see ...

Now this is remarkable. I wonder how many other readers have managed
to find that yet?
Few, I'm afraid. And they tend to forget its existence, or at least the
exact location, but I was lucky this time to manage to pick it up. :-)

Quote:
So, in a section which purports to explain the inheritance of cell
alignment, it actually states, almost as a throwaway aside, that HTML
lang, dir, and style attributes are supposed to inherit from cols to
cells in the same way as valign.
Indeed, and it uses the word "inherit", which is not defined in HTML
terminology, so we need to take it intuitively or to assume it's analogous
with the CSS inheritance concept, which is misunderstood by most people who
try to understand CSS.

Quote:
This seems to mean that an explicit <style...> attribute on a col
could be used to influence the presentation of the whole column,
provided some other style attribute did not supervene. In ways that a
class or id applied to the col and called-out from a stylesheet could
*not* (other than the limited shortlist of properties which I cited
before). *Is* that what it means?
That's a good question. Are there any more questions? :-)

Seriously, I take this is a conflict between HTML and CSS specifications,
and I think the CSS approach is what we are supposed to assume - for
presentational issues. I think the CSS approach is based on difficulties
that would arise in visual rendering, if tables were treated as truly
two-dimensional, with each cell being a "descendant" (in some sense) of a
column as well as of a row. On the other hand, such issues probably do not
affect lang attribute considerations, so I'd expect that they are _meant_ to
be "inherited" from columns to cells, in the absence of lang attribute for
the cell or its row.

Some simple testing: On Opera 8.54 and Firefox 1.5.0.3, if I set <col
lang="fi"> for a column, the cells in that column match the selector
:lang(fi)
but do not match
[lang="fi"]
This is what I'd expect, since the cells do not have a lang attribute but
they have their language specified via "inheritance" (in the fuzzy HTML
meaning) from the <col> element.

IE 6 knows nothing about such selectors. IE 7 beta seems to fail to support
:lang(...) at all but has at least some support to attribute selectors like
[lang="fi"]. I'm not surprised at seeing that IE 7 gets the situation wrong
(or at least differently from the reasonable interpretation): [lang="fi"]
matches not only elements with lang="fi" but also table cells that "inherit"
language information from <col lang="fi"> - or from a parent element (e.g.,
from <tr lang="fi">)!

Thus, now and in the foreseeable future, the only way to style texts
differently depending on their language, in a manner that works in the
majority of browsing situations is to use class attributes and class
selectors, no matter how redundant they are logically in the presence of
lang attributes.



Reply With Quote
  #26  
Old   
Alan J. Flavell
 
Posts: n/a

Default Re: specify language as in <span lang="en">? - 05-19-2006 , 02:59 PM



On Fri, 19 May 2006, Alan J. Flavell wrote:

Quote:
Hmmm... actually, some browsers will use lang attributes to influence
their default choice of font, for example. I don't think such
behaviour is actually wrong.
Oh dear, this is getting further and further away from stylesheets,
but now that the thread is under way, I'm reluctant to try to restart
it in the *.html group...

Quote:
So, in a section which purports to explain the inheritance of cell
alignment, it actually states, almost as a throwaway aside, that
HTML lang, dir, and style attributes are supposed to inherit from
cols to cells in the same way as valign. (I guess this calls for
some tests on actual browsers, ...
Here's a simple test that I threw together. I think it does
what we have been discussing, and investigates the inheritance
of the html attributes dir, lang, style, align and valign from
the col element to the td cells in that column:
http://ppewww.ph.gla.ac.uk/~flavell/tests/tbltest.html

On the side it also tests the selectors [lang=ru] and :lang(ru)

The first column is neutral, so it should serve as an exhibit of
the browser's defaults.

My test values of these attributes have been applied explicitly to the
cell in the middle of the second row.

And they have also been applied to the third column. Thus, if it all
has worked, both cells in the third column should resemble the
explicitly marked cell i.e the one in the middle of the second row.
Am I making some kind of sense?

Results...

The only browser which is doing anything evident with the lang= HTML
attribute is Seamonkey, which is changing the font for the explicitly
marked cell. But not for the third column.

Seamonkey is honouring the selectors for [lang=ru] and :lang=ru
(the explicitly marked cell is bold and oblique).

Seamonkey is not honouring *any* of the attributes for the third
column: not even the align and valign.

Konqueror (linux, 3.1.3) is behaving rather like Seamonkey, except
that it's not honouring the :lang(ru) selector.

Opera 8.54 - for the third column it is honouring the HTML align and
valign attributes, but nothing more.

It's applying the style rules for both [lang=ru] and :lang(ru) , but
on the explicitly marked cell, only.

Opera 9 beta is doing the same.

IE6 is the only one, of these tested, that inherits more than the
align and valign attributes of the third column: like the explicitly
styled cell, it's showing the third column content in red and rtl (so
it's inheriting at least style and dir from the col element, in
addition to align and valign). But, as we know, it honours neither
[lang=ru] nor :lang(ru)

Conclusion: using col in any of these ways is not currently feasible
in a WWW context. (And this is, I think, the first time in several
years that IE has managed to beat the opposition in terms of meeting
the specification!). That's assuming that my tests were not
fundamentally flawed, which is why I'm putting them up for review.

--



Reply With Quote
  #27  
Old   
Alan J. Flavell
 
Posts: n/a

Default Re: specify language as in <span lang="en">? - 05-19-2006 , 04:27 PM



On Fri, 19 May 2006, Jukka K. Korpela wrote:

Quote:
Some simple testing: On Opera 8.54 and Firefox 1.5.0.3, if I set <col
lang="fi"> for a column, the cells in that column match the selector
:lang(fi)
but do not match
[lang="fi"]

This is what I'd expect, since the cells do not have a lang
attribute but they have their language specified via "inheritance"
(in the fuzzy HTML meaning) from the <col> element.
Curious. Your observations seem to be at variance with mine in
this respect. Do you have a test case to compare with, or can you
already see what's the difference between yours and mine please? -
http://ppewww.ph.gla.ac.uk/~flavell/tests/tbltest.html

thanks


Reply With Quote
  #28  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: specify language as in <span lang="en">? - 05-19-2006 , 04:54 PM



Alan J. Flavell <flavell (AT) physics (DOT) gla.ac.uk> scripsit:

Quote:
Curious. Your observations seem to be at variance with mine in
this respect. Do you have a test case to compare with, or can you
already see what's the difference between yours and mine please? -
http://ppewww.ph.gla.ac.uk/~flavell/tests/tbltest.html
I'm getting more and more confused, and I should be in bed now, but my
current test page is
http://www.cs.tut.fi/~jkorpela/test/lang.html

I wonder whether the differences depend on the properties we use. I guess I
was first misled to think that Opera uses a background color for the cells
in a column when it perhaps just uses if for the <col> element somehow and
the background shines through.



Reply With Quote
  #29  
Old   
Alan J. Flavell
 
Posts: n/a

Default Re: specify language as in <span lang="en">? - 05-19-2006 , 05:30 PM



On Sat, 20 May 2006, Jukka K. Korpela wrote:

Many thanks...

Quote:
I wonder whether the differences depend on the properties we use. I
guess I was first misled to think that Opera uses a background color
for the cells in a column when it perhaps just uses if for the <col
element somehow and the background shines through.
I'm sorry to say that I think that is indeed the explanation for what
your page is doing. As you know, the CSS spec calls for the
background to "shine through" from the col element to the cells, if no
non-transparent background intervenes.[1] I'm afraid that has confused
the interpretation of the result. If I change your :lang(fi) text
colour from black to red, then the last column, first two rows, remain
black, whereas they should be red if the <col> language was really
propagating to the <td> cells. The last row is red, of course,
because of its <tr lang="fi">.

thanks

[1] by way of explanation if any readers need this...
As usual, I shall break the rules by citing a W3C work in progress, on
the grounds that it's the nearest that we've got to a current spec.:
http://www.w3.org/TR/CSS21/tables.html#q4
http://www.w3.org/TR/CSS21/tables.html#table-layers


Reply With Quote
  #30  
Old   
Alan J. Flavell
 
Posts: n/a

Default Re: specify language as in <span lang="en">? - 05-19-2006 , 06:31 PM



On Sat, 20 May 2006, Jukka K. Korpela wrote:

[test case details]

I'm afraid I just found
https://bugzilla.mozilla.org/show_bug.cgi?id=915

Seems to have been open since 1998.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.