• Multilingual HTML?

    From Stefan Ram@21:1/5 to All on Wed Apr 26 10:59:07 2023
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Ram@21:1/5 to Stefan Ram on Wed Apr 26 18:42:46 2023
    ram@zedat.fu-berlin.de (Stefan Ram) writes:
    span.original
    { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px;
    overflow: hidden; padding: 0; position: absolute; width: 1px; }

    It seems that the simpler

    span.original { display:none; }

    will also work!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stan Brown@21:1/5 to Stefan Ram on Wed Apr 26 11:55:35 2023
    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/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Ram@21:1/5 to Stefan Ram on Wed Apr 26 18:39:35 2023
    ram@zedat.fu-berlin.de (Stefan Ram) writes:
    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 ...

    Below is an attempt to have "color" as a fallback in a browser
    without css, but "colour" in a CSS enabled browser.

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head><meta charset="UTF-8" /><title>(unnamed document)</title>
    <style>
    span.american::before { content: attr(data-british); display: inline } span.original
    { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px;
    overflow: hidden; padding: 0; position: absolute; width: 1px; } </style></head>1
    <body><p>... my course, Which holds not
    <span class="american" data-british="colour"><!--
    <span class="original">color</span></span>
    with the time ...</p></body></html>

    In some browsers, you can now choose either "No style"
    to see "color" or "Basic Page Style" to see "colour".

    (If I had know from the start that the solution would be
    CSS based, I would have asked this in a CSS newsgroup!)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to Stefan Ram on Wed Apr 26 21:07:29 2023
    ram@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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to Ben Bacarisse on Wed Apr 26 22:07:35 2023
    Ben Bacarisse <ben.usenet@bsb.me.uk> writes:

    ram@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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From JJ@21:1/5 to Stefan Ram on Thu Apr 27 05:12:50 2023
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arno Welzel@21:1/5 to All on Thu Apr 27 17:36:33 2023
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jukka K. Korpela@21:1/5 to Stefan Ram on Sun Apr 30 17:30:10 2023
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Ram@21:1/5 to Jukka K. Korpela on Tue May 2 15:56:24 2023
    "Jukka K. Korpela" <jukkakk@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 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.

    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.

    But you can have data in attributes and make it displayed with CSS, as >suggested in answers hide.

    Yes, in the meantime I have also started to think about
    this approach.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jukka K. Korpela@21:1/5 to Stefan Ram on Wed May 3 13:19:17 2023
    Stefan Ram wrote:

    "Jukka K. Korpela" <jukkakk@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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arno Welzel@21:1/5 to All on Fri May 5 09:39:13 2023
    Stefan Ram, 2023-05-02 17:56:

    "Jukka K. Korpela" <jukkakk@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.


    --
    Arno Welzel
    https://arnowelzel.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jukka K. Korpela@21:1/5 to Arno Welzel on Fri May 5 16:41:05 2023
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stan Brown@21:1/5 to Jukka K. Korpela on Fri May 5 12:12:32 2023
    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"?



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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)