Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Multilingual HTML?

1 view
Skip to first unread message

Stan Brown

unread,
Apr 26, 2023, 2:55:39 PM4/26/23
to
On 26 Apr 2023 10:59:07 GMT, Stefan Ram wrote:
>
> One could write:
> ... my course, Which holds not
> <span class="American">color</span>
> <span class="British">colour</span>
> with the time ...

I'm not sure what "not" means above, but anyway ...

> and offer two different style sheets "American" and "British". Then
> people could choose the language to be used for the display in
> their browsers where they choose a stylesheet.

This is an interesting idea. Your British stylesheet would have

span.American { display:none; }

and your American stylesheet would have

span.British { display:none; }

You don't need to supply any CSS for the "want to show" language,
since display:inline is the default.

But why do it with classes? The "lang" attribute already exists. I'm
too lazy to look up the language codes, but I think they are as
follows:

<span lang="en-US">color</span>
<span lang="en-GB">colour</span>

and then your GB stylesheet would have

span:lang(en-us) { display:none; }

while your US one would have

span:lang(en-gb) { display:none; }

> However, could there be a safe fallback for browsers without CSS?

What do you mean by "fallback"? Presumably having someone read "the
colour color of her eyes" is bad, so the only possible fallback is
one that preselects either the US or the GB style. In that case you
don't really need a method for people to select one of two
stylesheets, bur rather to select the other stylesheet if the default
one is not to their liking.

However, I believe that English speakers understand that there are
spelling variants in different dialects, and they don't find it
troublesome to read them. Why not just specify either <html lang="en-
US"> or <html lang="en-GB"> and then spell everything the correct way
for that variannt?

> BTW: This is a quotation from Shakespeare who, according to my
> sources, actually wrote "color", even though he was British AFAIK!

The -our spellings, I believe I read somewhere, were _added_ in
British English after the US gained its independence. :-)

> PS: I do not want to go through the hassle to prepare two
> different documents when they differ only by a few words.

Understandable. But if you follow my suggestion, you also eliminate
the hassle (less, but still greater than zero) of identifying words
with variant spelling and creating duplicates with two different
wrappers.

--
Stan Brown, Tehachapi, California, USA
https://BrownMath.com/

Ben Bacarisse

unread,
Apr 26, 2023, 4:07:34 PM4/26/23
to
r...@zedat.fu-berlin.de (Stefan Ram) writes:

> One could write:
>
> ... my course, Which holds not
> <span class="American">color</span>
> <span class="British">colour</span>
> with the time ...

I'd suggest the lang attribute with BCP 47 tags en-GB and en-US.

> and offer two different style sheets "American" and
> "British". Then people could choose the language to
> be used for the display in their browsers where they
> choose a stylesheet.
>
> However, could there be a safe fallback for browsers
> without CSS?

You could use the hidden attribute on the elements you don't want shown,
but I'd bet that browsers with no CSS support will not honour hidden
attributes either. The two I have (lynx and w3m) are like that.

> I.e., I just need two different element types, say "normal"
> and "invisible", so that without customizations in CSS,
> "normal" elements are visible and "invisible" are not:
>
> ... my course, Which holds not
> <normal class="American">color</span>
> <invisible class="British">colour</span>
> with the time ...

Yes, if there were an element that was not displayed by default, you
could use that. The closest that comes to mind is <s>...</s> but that
displays in the non-CSS browsers I have.

> . It's just that I am not aware of such element types!
>
> BTW: This is a quotation from Shakespeare who, according to my
> sources, actually wrote "color", even though he was British AFAIK!

Spelling was not standardised then and most editions use both spellings
for colour/color. The one I have use colour in that particular quote.
Of course, what he actually wrote (by hand for the players) is another
matter. I don't know whether the early publishers took care to copy the
various spellings. It was probably not considered very important.

--
Ben.

Ben Bacarisse

unread,
Apr 26, 2023, 5:07:39 PM4/26/23
to
Ben Bacarisse <ben.u...@bsb.me.uk> writes:

> r...@zedat.fu-berlin.de (Stefan Ram) writes:

>> BTW: This is a quotation from Shakespeare who, according to my
>> sources, actually wrote "color", even though he was British AFAIK!
>
> Spelling was not standardised then and most editions use both spellings
> for colour/color. The one I have use colour in that particular quote.
> Of course, what he actually wrote (by hand for the players) is another
> matter. I don't know whether the early publishers took care to copy the
> various spellings. It was probably not considered very important.

Got interested in this. The First Folio (1623) is available online in
facsimile and XML (well done The Bodleian). The text file I had first
searched used "color" only in Macbeth which seemed suspicious, and
indeed the First Folio has only "colour" in that play.

Unfortunately all the plays are not available in one combined XML file
(tut, tut, Bodleian) but after downloading them one by one it does seem
that the first published edition (of 36 of the 37 plays) used only
"colour". On the other hand, "honour" and "honor" both appear, as do
"labor" and "labour".

Johnson's dictionary (1755) picked "colour", "honour" and "labour" so
they were seen as more widely used by educated writers by that time..

--
Ben.

JJ

unread,
Apr 26, 2023, 6:12:52 PM4/26/23
to
On 26 Apr 2023 10:59:07 GMT, Stefan Ram wrote:
> One could write:
>
> ... my course, Which holds not
> <span class="American">color</span>
> <span class="British">colour</span>
> with the time ...
>
> and offer two different style sheets "American" and
> "British". Then people could choose the language to
> be used for the display in their browsers where they
> choose a stylesheet.
>
> However, could there be a safe fallback for browsers
> without CSS?
>
> I.e., I just need two different element types, say "normal"
> and "invisible", so that without customizations in CSS,
> "normal" elements are visible and "invisible" are not:
>
> ... my course, Which holds not
> <normal class="American">color</span>
> <invisible class="British">colour</span>
> with the time ...
>
> . It's just that I am not aware of such element types!
>
> BTW: This is a quotation from Shakespeare who, according to my
> sources, actually wrote "color", even though he was British AFAIK!
>
> PS: I do not want to go through the hassle to prepare two
> different documents when they differ only by a few words.

Not possible without CSS.

Without CSS, by far, content can be hidden/show using the SUMMARY-DETAILS
tags. But it can only used to provide additional toggleable content. It
can't be used to switch the display between two contents.

If the HTML viewer doesn't support CSS, there's a chance that it doesn't
support HTML5. e.g. a minimal HTML viewer, instead of a full blown
("modern") web browser with CSS disabled.

Arno Welzel

unread,
Apr 27, 2023, 11:36:35 AM4/27/23
to
Stefan Ram, 2023-04-26 12:59:

> One could write:
>
> ... my course, Which holds not
> <span class="American">color</span>
> <span class="British">colour</span>
> with the time ...
>
> and offer two different style sheets "American" and
> "British". Then people could choose the language to
> be used for the display in their browsers where they
> choose a stylesheet.

This is a quite unusual way to handle this.

The preferred way to allow different languages for the same URL is
content negotiation so the server will send the content in the preferred
language according to the "Accept-Language" header the browser sends to
the server. This is also the language the user can set on his own in the
browser as global preference.

Another way would be to map the URL to language, for example:

https://site.example/en-us/ for American English
https://site.example/en-gb/ for British English

and so on.

Where the default can determined using the "Accept-Language" header when
the user visits https://site.example/ without any language part.

> However, could there be a safe fallback for browsers
> without CSS?

No - that's why it is a bad idea.

> I.e., I just need two different element types, say "normal"
> and "invisible", so that without customizations in CSS,
> "normal" elements are visible and "invisible" are not:

There is no element type which is invisible without CSS.

[...]
> PS: I do not want to go through the hassle to prepare two
> different documents when they differ only by a few words.

Any modern CMS supports multilingual content, even WordPress. But if the
difference is just a few words, I wonder if it is even worth the trouble.

--
Arno Welzel
https://arnowelzel.de

Jukka K. Korpela

unread,
Apr 30, 2023, 10:30:13 AM4/30/23
to
Stefan Ram wrote:

> One could write:
>
> ... my course, Which holds not
> <span class="American">color</span>
> <span class="British">colour</span>
> with the time ...
>
> and offer two different style sheets "American" and
> "British". Then people could choose the language to
> be used for the display in their browsers where they
> choose a stylesheet.

Choosing a language or a style sheet is not simple in browsers. You
would need to have your own tool for that on the page, e.g. a button or
a dropdown menu. And since this would probably be JavaScript driven, you
could just as well implement the whole thing in JavaScript. You could
then have just general code that replaces strings, e.g. “color” by
“colour”, according to a simple mapping table, in the entire document,
without no extra markup.

> However, could there be a safe fallback for browsers
> without CSS?

Not if the alternatives are included into the document as elements,
since all elements in the body are visible by default. Well, there’s the
attribute “hidden”, but then you would need to rely on support to it,
and it is really meant to be removed using JavaScript.

But you can have data in attributes and make it displayed with CSS, as
suggested in answers hide. Yet another way is to place the textual
alternatives in CSS as strings, e.g.

<span class=color><span>color</span></span>

in HTML, and

.color span { display: none; }
.color:after { content: "colour"; }

in a style sheet for British English.

But this really means using CSS to do content manipulation in a clumsy
way, instead of doing it in a scripting language.
> PS: I do not want to go through the hassle to prepare two
> different documents when they differ only by a few words.
There are several differences between British and American English. They
are not limited to some spelling differences but include vocabulary
differences, phraseology, punctuation, etc. One of the few differences
for which there are tools in HTML is the use of quotation marks. You
could use the <q> element instead of explicit quotation marks and set
language-specific quotation marks in CSS.

As a reader, even if I preferred American English for example, I would
surely prefer consistent British English to a mixed language where some
words are in American spelling but quotation marks, dashes, etc. in
British style, British words like luggage and elevator in the text, etc.

--
Yucca, https://jkorpela.fi

Jukka K. Korpela

unread,
May 3, 2023, 6:19:20 AM5/3/23
to
Stefan Ram wrote:

> "Jukka K. Korpela" <juk...@gmail.com> writes:
>> Choosing a language or a style sheet is not simple in browsers. You
>> would need to have your own tool for that on the page, e.g. a button or
>> a dropdown menu.
>
> For the same reason, every page needs a "print" button?

I haven’t seen a browser without a “print” function. Changing a style
sheet has never been a common function in browsers.

> I found the choice between "No Style" and "Default Style"/"Basic
> Page Style" in both IE and Firefox in in the "Style"/"Page Style"
> sub menu of the "View" menu.

IE is practically dead. IE and Firefox together surely have less than
10% share,
probably much less. On Chrome, the currently leading browser, there’s
nothing
resembling style sheet change. You can install add-ons for such things,
like Stylish for setting up your own CSS rules for all pages or for
pages in specific domains. But most people don’t know about such things.

>> You could then have just general code that replaces strings,
>> e.g. “color” by “colour”, according to a simple mapping
>> table, in the entire document, without no extra markup.
>
> This also would replace "color" by "colour" when it is
> to be quoted as a literal string, e.g., on a page about
> differences between American English and British English.
> So I think, it's safer for use manual markup for this.

That’s a rare example. But the possibility of mixing language
forms inside a page makes it even less attractive to use HTML and
CSS to handle translation.

Yucca

Arno Welzel

unread,
May 5, 2023, 3:40:56 AM5/5/23
to
Stefan Ram, 2023-05-02 17:56:

> "Jukka K. Korpela" <juk...@gmail.com> writes:
>> Choosing a language or a style sheet is not simple in browsers. You
>> would need to have your own tool for that on the page, e.g. a button or
>> a dropdown menu.
>
> For the same reason, every page needs a "print" button?

Printing in a browswer is quite simple - just press Ctrl+P or use the
menu command "Print".

But there is no similar command to switch between languages. And which
standard defines, what languages a website supports, so that a browser
could offer the selection to the user? I only know the opposite
direction: a browser can tell the server what languages are supported
using the "Accept-Language" header and the server can use that
information to decide what language will be served.

The original idea was, that a user does not have to choose at all but
that websites automatically uses the desired language if possible.
However for search engines it is quite confusing if the same URL
provides different translations of the same text depending on the
"Accept-Language" header so the idea was more or less given up in favor
of redirecting the user to a language specific URL if needed.

> I found the choice between "No Style" and "Default Style"/"Basic
> Page Style" in both IE and Firefox in in the "Style"/"Page Style"
> sub menu of the "View" menu.

IE is no longer supported and can be seen as irrelevant.

Firefox is also a niche browser nowadays with less than 5% market share.

The real relevant browser are Chrome or Safari - and both do *not*
provide a simple menu command to disable stylesheets.

Jukka K. Korpela

unread,
May 5, 2023, 9:42:36 AM5/5/23
to
Arno Welzel wrote:

> Printing in a browswer is quite simple - just press Ctrl+P or use the
> menu command "Print".

On mobile devices, it is different. But I would not suggest a “print”
button on web pages for them either.

Digression: It’s a bit different with “To the top” issue. I have partly
changed my mind on this and even implemented a “Top of page” button on
some pages of mine, after realizing that none of the browsers I have
used on my phones has a simple way to get to the start.

> But there is no similar command to switch between languages. And which
> standard defines, what languages a website supports, so that a browser
> could offer the selection to the user?

Once upon a time, there was a version of HTML that had
<link rel=alternate hreflang=... href=...>
for this. And it seems that it’s actually still in the current “living
standard”:
https://html.spec.whatwg.org/multipage/links.html#rel-alternate
It says somewhat oddly:
“If the alternate keyword is used with the hreflang attribute, and that
attribute's value differs from the document element's language, it
indicates that the referenced document is a translation.”
(Of course, the element could just as well refer to the original from a
translation, or the different versions might be simply the same content
in different languages without any of them being, in principle, a
translation.)

So a browser could well construct a “Change language” menu. I’m afraid
they don’t, probably because sites are known to provide their own
language changing tools.

> The real relevant browser are Chrome or Safari - and both do *not*
> provide a simple menu command to disable stylesheets.

Indeed. And I don’t even know a complicated way to disable stylesheets
in Chrome, in developer tools (F12), in Stylish, or otherwise. If I
really wanted to see what a page looks like without styles, I would
probably write a “plain” style and enforce it, with !important, in
Stylish. But it would hardly be more than a useless experiment.

I guess one reason behind the development is that most pages would look
just awful or worse without styles. This was not so in the 1990s.

Stan Brown

unread,
May 5, 2023, 3:12:36 PM5/5/23
to
On Fri, 5 May 2023 16:41:05 +0300, Jukka K. Korpela wrote:
>
> Digression: It?s a bit different with ?To the top? issue. I have partly
> changed my mind on this and even implemented a ?Top of page? button on
> some pages of mine, after realizing that none of the browsers I have
> used on my phones has a simple way to get to the start.

I never thought of that, since there's no need for "Top of Page"
where Ctrl+Home exists.

But I can see the use for phones, which don't have those keyboards.
Is there some way in CSS to style the "Top of Page" button as
display:none on regular screens? Some media query that can find
"every screen except phones" or alternatively "every phone screen"?

Arno Welzel

unread,
May 7, 2023, 7:58:10 AM5/7/23
to
Jukka K. Korpela, 2023-05-05 15:41:

> Arno Welzel wrote:
>
>> Printing in a browswer is quite simple - just press Ctrl+P or use the
>> menu command "Print".
>
> On mobile devices, it is different. But I would not suggest a “print”
> button on web pages for them either.

Even on mobile devices printing is possible since Android and iOS have
introduced printing services using WiFi many years ago (Google Cloud
print, Apple AirPrint etc.).

However there this is usually not menu command "print" but rather
"share" and select "printer" as target. Technically a PDF is then
generated and send to the printer. For that reason implementing a
"print" button makes no sense for mobile devices as there is not direct
"print" command either.

> Digression: It’s a bit different with “To the top” issue. I have partly
> changed my mind on this and even implemented a “Top of page” button on
> some pages of mine, after realizing that none of the browsers I have
> used on my phones has a simple way to get to the start.

Yes, "move to the top" is a useful thing and except Opera no other
browser has this implemented. On my own websites I also added a "move to
the top" button which is automatically displayed when scrolling down a
certain amount.

>> But there is no similar command to switch between languages. And which
>> standard defines, what languages a website supports, so that a browser
>> could offer the selection to the user?
>
> Once upon a time, there was a version of HTML that had
> <link rel=alternate hreflang=... href=...>

Yes, I stand correct here: there is indeed a way to find out what
languages are offered by a website - but as you also know, browsers
don't offer anything to use that information for navigation.

Alternate links were never really supported at all for navigation in the
browser. Only in the early days with Netscape Navigator and early
version of Phoenix/Firefox there was support for some meta navigation
elements (including "previous" and "next" page).

It's a petty that these helpful elements are not supported - this could
make things much easier for the users. But I guess since using search
engines is the usual way to find information no one cares about site
specific navigation any longer.

[...]
>> The real relevant browser are Chrome or Safari - and both do *not*
>> provide a simple menu command to disable stylesheets.
>
> Indeed. And I don’t even know a complicated way to disable stylesheets
> in Chrome, in developer tools (F12), in Stylish, or otherwise. If I
> really wanted to see what a page looks like without styles, I would
> probably write a “plain” style and enforce it, with !important, in
> Stylish. But it would hardly be more than a useless experiment.
>
> I guess one reason behind the development is that most pages would look
> just awful or worse without styles. This was not so in the 1990s.

Also in some CSS is essential - for example if Webfonts or SVG icons
like "Font Awesome" (<https://fontawesome.com>) are used to display
symbols. When disabling CSS then these symbols will not be displayed at all.

My personal "extreme" usability test is using Lynx in a Linux console.
No CSS, no JavaScript, no images. And still the site should at least be
usable.

Jukka K. Korpela

unread,
May 7, 2023, 9:40:23 AM5/7/23
to
Stan Brown wrote:

> Is there some way in CSS to style the "Top of Page" button as
> display:none on regular screens? Some media query that can find
> "every screen except phones" or alternatively "every phone screen"?

There are several suggested answers at
https://stackoverflow.com/questions/11387805/media-query-to-detect-if-device-is-touchscreen
But none of them offers an effective solution. Besides, being
“touchscreen” or being “phone” (or “mobile”) are logically independent
of being a device on which browsers generally have no built-in “print”
functionality. Browsers running on devices with keyboard normally have
such functionality, typically in a command menu. On phones, the command
menus usually have just a few functions, apparently because the display
is small. But there is no reason why browsers on such devices could not
have rich menus, even with “print”.

Stan Brown

unread,
May 7, 2023, 10:35:47 AM5/7/23
to
On Sun, 7 May 2023 16:38:56 +0300, Jukka K. Korpela
wrote:
> Stan Brown wrote:
>
> > Is there some way in CSS to style the "Top of Page" button as
> > display:none on regular screens? Some media query that can find
> > "every screen except phones" or alternatively "every phone screen"?
>
> There are several suggested answers at
> https://stackoverflow.com/questions/11387805/media-query-to-detect-if-device-is-touchscreen
> But none of them offers an effective solution. Besides, being
> ?touchscreen? or being ?phone? (or ?mobile?) are logically independent
> of being a device on which browsers generally have no built-in ?print?

Thanks for responding, but I was hoping to identify
phones, not touchscreens, in CSS. My concern with
phones is that the only way to get to top of page is to
scroll, scroll, scroll, which can get tedious.

Touchscreen devices and phones are overlapping sets but
by no means identical.

Plenty of touchscreens have full-sized screens,
including the laptop I'm using right now.

Contrariwise, some phones don't have touchscreens. (I'm
sure the percentage is small, but there are are so many
mobile hones that even a small percentage can represent
a significant number. Several brands market
"simplified" phones specifically to the elderly.)

Keith Thompson

unread,
May 7, 2023, 6:16:31 PM5/7/23
to
As a user, I'd say that most tablets should have the same requirements
as phones. (I think you're assuming, not unreasonably, that there's a
convenient Home button if and only if there's a physical keyboard.)

Perhaps a physical keyboard is a more relevant thing to test?

--
Keith Thompson (The_Other_Keith) Keith.S.T...@gmail.com
Working, but not speaking, for XCOM Labs
void Void(void) { Void(); } /* The recursive call of the void */

Stan Brown

unread,
May 7, 2023, 8:04:00 PM5/7/23
to
On Sun, 07 May 2023 15:16:28 -0700, Keith Thompson
wrote:
>
> Stan Brown <the_sta...@fastmail.fm> writes:
> > On Sun, 7 May 2023 16:38:56 +0300, Jukka K. Korpela
> > wrote:
> >> Stan Brown wrote:
> >>
> >> > Is there some way in CSS to style the "Top of Page" button as
> >> > display:none on regular screens? Some media query that can find
> >> > "every screen except phones" or alternatively "every phone screen"?
> >>
> >> There are several suggested answers at
> >> https://stackoverflow.com/questions/11387805/media-query-to-detect-if-device-is-touchscreen
> >> But none of them offers an effective solution. Besides, being
> >> ?touchscreen? or being ?phone? (or ?mobile?) are logically independent
> >> of being a device on which browsers generally have no built-in ?print?
> >
> > Thanks for responding, but I was hoping to identify
> > phones, not touchscreens, in CSS. My concern with
> > phones is that the only way to get to top of page is to
> > scroll, scroll, scroll, which can get tedious.
>
> As a user, I'd say that most tablets should have the same requirements
> as phones. (I think you're assuming, not unreasonably, that there's a
> convenient Home button if and only if there's a physical keyboard.)
>
> Perhaps a physical keyboard is a more relevant thing to test?

I think that's right, but I have no idea how to test it
in CSS, if such a thing is even possible. I'm adamant
about keeping Javascript off my pages.

Jukka K. Korpela

unread,
May 8, 2023, 4:17:50 AM5/8/23
to
Keith Thompson wrote:

> As a user, I'd say that most tablets should have the same requirements
> as phones. (I think you're assuming, not unreasonably, that there's a
> convenient Home button if and only if there's a physical keyboard.)
>
> Perhaps a physical keyboard is a more relevant thing to test?

Even if it were possible to test for such things in CSS, it would not
accurately address the question “Does the browser give the user a simple
way to move to the start of the page?” The browser’s user interface
might well contain a “Home” button that is tappable. And even if there
were a physical keyboard with a “Home” key, perhaps it never occurred to
the user what the key can be used for.

So I think we can ask ourselves whether a “To the top” feature is useful
enough to those who might need it and whether this outweighs the
disturbance that such a feature may cause to those who don’t need it.

Yucca

0 new messages