HTML esoterica – en-GB vs. en_GB

(htmhell.dev)

112 points | by edent 2 days ago

17 comments

  • SyzygyRhythm 7 hours ago
    The page doesn't seem to quite spell out the answer, which is that lang and locale have nothing to do with each other. It's basically coincidence that they look even similar. The locale came from basically an ad-hoc system from X/Open in the late 80s, while lang comes from RFC 5646 in 2009. The two become more obviously different if you need to specify anything complicated, like sr_RS.UTF-8@latin or zh-cmn-Hans-CN.
    • dasyatidprime 5 hours ago
      This is basically correct. It's worth an addendum though that IETF language tags are in turn based substantially on ISO 639 language codes and ISO 3166 country codes, and while AFAIK POSIX doesn't mandate the use of these vocabularies, it's de facto common practice to use them for the language and territory parts of POSIX locales as well. So there's some indirect, distant shared background. Beyond that, the two strings contain intersecting but differing sets of information because they were made for different purposes: affecting the ambient behavior of a user environment and its applications versus describing the language of content on the Internet. For instance, a POSIX locale can imply a default character set for text I/O, which is out of scope for an IETF language tag.
    • fanf2 1 hour ago
      IETF MIME language tags go back to RFC 1766 (1995)

      https://www.rfc-editor.org/info/rfc1766/

    • account42 5 hours ago
      The situation is much more blurry than you make it out to be since the locale is the primary means to specify a language on POSIX systems. Sure, a locale string can encompass much more than just the language but the xx_XX part is still primarily about language.
    • JdeBP 1 hour ago
      Don't sell the RFCs short. RFC 1766 is an ad-hoc system too, from the 1990s. (-:
  • numpad0 6 hours ago
    > A language only tells you about the language. A locale, by contrast, tells you about the user's preferences.

    I think it's more like, it just so happens that choosing language resources based on this pair of parameters is useful, because neither of these are particularly good boundaries.

    There are people like Spanish speakers in the US, German speakers in Switzerland, Portuguese speakers in Brazil, things like that. So either of languages or flags alone is not enough, but combinations of both works 99% of the time. So that gets used.

    • PennRobotics 5 hours ago
      I was raised in the US and work in Germany, but I set my region to Ireland because, as you say, it represents my preferences and daily work best.

      If I set my locale to en_US, I get Letter-size paper and USD and MM/DD/YYYY as defaults---all different from what I use every day.

      Setting de_DE means writing "a million and change" as 1.000.000,69 which sometimes causes problems copying data from one window to another but mostly confuses me.

      An Irish locale gives me preferred formats for numbers, dates, currency, language, and print defaults.

      • account42 4 hours ago
        > Setting de_DE means writing "a million and change" as 1.000.000,69 which sometimes causes problems copying data from one window to another but mostly confuses me.

        It also breaks programs all the time because a lot of languages make the users locale the default for formatting and parsing numbers even though there are many use cases where you want a neutral, fixed format.

        It's sad that POSIX-likes are still stuck on the concept of a fixed set of locales instead of something more flexible where you can have a sensible choice of RFC 3339 dates with untranslated English text and your local currency but formatted with a . decimal separator. Instead we have to use hacks like en_DK that only partially fix the issue for some.

        • 1718627440 4 hours ago
          > make the users locale the default for formatting and parsing numbers even though there are many use cases where you want a neutral

          This is just the usual case of not selecting a different locale meaning the locale is inherited from the parent. You can just specify the locale instead of omitting it, if you want another one.

          > It's sad that POSIX-likes are still stuck on the concept of a fixed set of locales

          That's not really the case. The locale names are just labels for your favorite settings and they are prepopulated with the official ones (who's names are standardized). You can name your locale "what_my_grandma_likes_to_read".

          As an example for en_GB:

              $ cat /usr/share/i18n/locales/en_GB
              comment_char %
              escape_char /
              
              % This file is part of the GNU C Library and contains locale data.
              % The Free Software Foundation does not claim any copyright interest
              % in the locale data contained in this file.  The foregoing does not
              % affect the license of the GNU C Library as a whole.  It does not
              % exempt you from the conditions of the license if your use would
              % otherwise be governed by that license.
              
              % English language locale for Britain
              % Source: RAP
              % Address: Sankt Jo//rgens Alle 8
              %    DK-1615 Ko//benhavn V, Danmark
              % Contact: Keld Simonsen
              % Email: Keld.Simonsen@dkuug.dk
              % Tel: +45 - 31226543
              % Fax: +45 - 33256543
              % Language: en
              % Territory: GB
              % Revision: 4.3
              % Date: 1996-10-15
              % Users: general
              
              LC_IDENTIFICATION
              title      "English locale for Britain"
              source     "RAP"
              address    "Sankt J<U00F8>rgens Alle 8, DK-1615 K<U00F8>benhavn V, Danmark"
              contact    "Keld Simonsen"
              email      "bug-glibc-locales@gnu.org"
              tel        ""
              fax        ""
              language   "British English"
              territory  "United Kingdom"
              revision   "1.0"
              date       "2000-06-28"
              
              category "i18n:2012";LC_IDENTIFICATION
              category "i18n:2012";LC_CTYPE
              category "i18n:2012";LC_COLLATE
              category "i18n:2012";LC_TIME
              category "i18n:2012";LC_NUMERIC
              category "i18n:2012";LC_MONETARY
              category "i18n:2012";LC_MESSAGES
              category "i18n:2012";LC_PAPER
              category "i18n:2012";LC_NAME
              category "i18n:2012";LC_ADDRESS
              category "i18n:2012";LC_TELEPHONE
              category "i18n:2012";LC_MEASUREMENT
              END LC_IDENTIFICATION
              
              LC_CTYPE
              copy "i18n"
              
              translit_start
              include "translit_combining";""
              translit_end
              END LC_CTYPE
              
              LC_COLLATE
              % Copy the template from ISO/IEC 14651
              copy "iso14651_t1"
              END LC_COLLATE
              
              LC_MONETARY
              int_curr_symbol         "GBP "
              currency_symbol         "<U00A3>"
              mon_decimal_point       "."
              mon_thousands_sep       ","
              mon_grouping            3;3
              positive_sign           ""
              negative_sign           "-"
              int_frac_digits         2
              frac_digits             2
              p_cs_precedes           1
              p_sep_by_space          0
              n_cs_precedes           1
              n_sep_by_space          0
              p_sign_posn             1
              n_sign_posn             1
              END LC_MONETARY
              
              LC_NUMERIC
              decimal_point           "."
              thousands_sep           ","
              grouping                3;3
              END LC_NUMERIC
              
              LC_TIME
              abday       "Sun";"Mon";"Tue";"Wed";"Thu";"Fri";"Sat"
              day         "Sunday";/
                          "Monday";/
                          "Tuesday";/
                          "Wednesday";/
                          "Thursday";/
                          "Friday";/
                          "Saturday"
              abmon       "Jan";"Feb";/
                          "Mar";"Apr";/
                          "May";"Jun";/
                          "Jul";"Aug";/
                          "Sep";"Oct";/
                          "Nov";"Dec"
              mon         "January";/
                          "February";/
                          "March";/
                          "April";/
                          "May";/
                          "June";/
                          "July";/
                          "August";/
                          "September";/
                          "October";/
                          "November";/
                          "December"
              d_t_fmt     "%a %d %b %Y %T %Z"
              d_fmt       "%d//%m//%y"
              t_fmt       "%T"
              am_pm       "am";"pm"
              t_fmt_ampm  "%l:%M:%S %P %Z"
              date_fmt    "%a %e %b %H:%M:%S %Z %Y"
              week    7;19971130;4
              first_weekday 2
              END LC_TIME
              
              LC_MESSAGES
              copy "en_US"
              END LC_MESSAGES
              
              LC_PAPER
              copy "i18n"
              END LC_PAPER
              
              LC_TELEPHONE
              tel_int_fmt    "+%c %a %l"
              tel_dom_fmt    "%A %l"
              int_select     "00"
              int_prefix     "44"
              END LC_TELEPHONE
              
              LC_MEASUREMENT
              copy "i18n"
              END LC_MEASUREMENT
              
              LC_NAME
              copy "en_US"
              END LC_NAME
              
              LC_ADDRESS
              postal_fmt    "%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"
              country_name "United Kingdom"
              country_ab2   "GB"
              country_ab3   "GBR"
              country_num   826
              country_car    "GB"
              lang_name     "English"
              lang_ab      "en"
              lang_term    "eng"
              lang_lib    "eng"
              END LC_ADDRESS
          • account42 3 hours ago
            > This is just the usual case of not selecting a different locale meaning the locale is inherited from the parent. You can just specify the locale instead of omitting it, if you want another one.

            No it's a consequence of having the notion of a program global locale in the first place even though most programs have to effectively deal with more than one (e.g. user interface and internal data).

            > That's not really the case. The locale names are just labels for your favorite settings and they are prepopulated with the official ones (who's names are standardized). You can name your locale "what_my_grandma_likes_to_read".

            And I can also patch all programs to behave like I want but that's not how the system is supposed to work and as a result I would be fighting resistance at every way. Editing locales is really beyond even most power users and definitely not something exposed in any GUI. As a result, you will also run into programs that break on your fancy locale because they only support the standard ones that everyone uses.

            • toyg 21 minutes ago
              > Editing locales is really beyond even most power users and definitely not something exposed in any GUI.

              This is the real issue. At some point, IIRC in the early Windows era, I think there were ways to customize one's locale via GUI; but they were a nightmare for software vendors to support, so they were abandoned in favour of relying on static (predictable) posix codes. And tbh, even supporting those properly seems to still be a challenge for most vendors to this day, so the idea that custom mixed locales could ever become mainstream is a bit of a pipe dream.

      • Moru 4 hours ago
        I'm a Swede. Half Sweden (maybe exaggerated :-) is using English as main language and wants it on their computer so we set GB in windows. But now we have to live with pound as currency, some weird date format and number format. It's a lot of work to get everything correct so in the end many goes back to Swedish language because the number and date formats are more important. Not to mention distance in miles...

        And every version of windows you have less control over which format to use where. In w95 you could easily set all these manually for each unit. Now I have to search the web to find instructions for the simplest things.

        • SlackingOff123 3 hours ago
          Interesting. I'm European, but not Swedish and I configure my Windows installation with "English (United States)" as the default language together with "English (Sweden)" as the Regional format which sets the measurements to Metric and dates to ISO.

          Is this language combo maybe what half of Sweden was looking for all along?

      • CatMustard 2 hours ago
        > Setting de_DE means writing "a million and change" as 1.000.000,69

        I'm Irish and one of my pet peeves is when a site shows prices in e.g. Usd as $10,000.50 and then when I change the currency to Euro it now decides I must want it formatted as 10.000,50€, a format that completely breaks my brain.

        Actually using the fact that I have an Irish locale apparently isn't necessary because 'this is how """Europeans""" do money'.

    • rafabulsing 0 minutes ago
      > There are people like [...] Portuguese speakers in Brazil

      There sure are. 200 million of them, in fact :)

    • Theodores 1 hour ago
      The author is English, and the 'discovery' that 'locale' is not the same as 'lang' is a bit of an 'aha' moment because we aren't like you, in having a clearly different language to the default 'Simplified American English' (as we say, snarkily, in the UK, out of earshot of those noisy 'mericans).

      In the UK, setting the computer to whatever the UK should be is handled by a nice drop-down at installation time, shielding us from ever knowing whether it is en-GB or en_GB. Everything works after that, albeit with some fuzziness with Wikipedia and Google Translate, where English is a mix of OG and Simplified.

      The quirks are not catastrophic, it is not as if we get a foreign language if the settings are off. You can have an office worker use en-US settings for years without them knowing any better.

      Anyway, now I know that locale is to be confused with lang, with the chances of me remembering whether it is a dash or an underscore that I need, time to give the SVG 'switch' statement a go. This can make an SVG locale (or is it lang?) specific, unlike anything in standard HTML/CSS. However, it does nae work, for me, and this could be because I am using underscore rather than minus, or vice-versa. This would also mean the examples on MDN are also wrong, because they don't work in modern browsers.

  • trebligdivad 1 hour ago
    I wish some Locale would treat _ and - as equivalent for searches and case-insensitive comparisons, so we could all stop worrying about which is the right one to use in many different places.
  • nubinetwork 3 hours ago
    > For example, this is valid HTML ...(snip)... That says the site's name is in French but the description is in English. That will parse perfectly.

    Is this why I get websites that triggers google translate despite already being in my language, or why it only translates parts of the page?

  • hibbelig 7 hours ago
    I don’t unterstand this. In order to write correct text i have to know some conventions, such as number formatting. So just language and locale are kind of hard to separate. Why dies the author say that the locale doesn’t matter for strings in OGP metadata?
  • IanCal 3 hours ago
    > Is 5.99 describing the cost in a mark, a yen, a buck, or a pound?

    Maybe I’m missing a reference someone else mentioned but on the face of it this isn’t a valid thing. Locale doesn’t change the currency independently, or certainly shouldn’t. If something is $5.99 when someone views it in Japan it should not be rendered as ¥5.99

    Yes, you can use to choose what price to show someone but that’s a different step, that’s part of the request.

    Edit - though whether 5.999 is almost six thousand or is under 6 could be a point.

    • 47282847 3 hours ago
      It’s not an ideal example, but later in the text it makes more sense: 5,999 is locale dependent: it can be either a thousands separator or decimal. And that makes a huge difference: is it almost 6, or almost 6000.

      Edit: Your edit just now points in the same direction. :)

    • Telaneo 1 hour ago
      > If something is $5.99 when someone views it in Japan it should not be rendered as ¥5.99

      Heck, it probably shouldn't even be rendered as ¥960.69, or whatever the conversion is the moment you lay your eyes on it.

      I find locales to be a very bad solution to a problem I'm not even sure we should have. Just give me ISO 8601 and metric units and we're all good, but the fact that currency somehow got lumped into all this is just the cherry on top of the shit sandwich.

  • bentley 7 hours ago
    For English content I just use <html lang=en>: quiets the validator, makes no difference in rendering, so simple I don’t even think about it.
    • charan345 4 hours ago
      It makes more difference than it seems once hyphenation gets involved. hyphens: auto picks the break dictionary from lang, so lang=en and lang=en-GB produce different line breaks in browsers that support it. Spellcheck in contenteditable reads it too. Invisible on short pages, but on long-form text it is the one place the region subtag earns its keep.
    • ukdstore 4 hours ago
      It does change a couple of things. CSS hyphens: auto only hyphenates text that has a lang, and screen readers with automatic language switching use it to pick the voice, so en-GB can get a British voice where one is installed. For a plain English page, lang=en covers most of it.
  • sph 8 hours ago
    I must say - great domain name.
  • nathell 6 hours ago
    > a Facebook recommendation is not the same as a living standard.

    Sure it’s not. Remember how Facebook used to offer RSS feeds until 2015?

    Conformance to standards (let alone development of standards) in the interest of interoperability is against the needs of a digital giant, unless it strengthens their hegemony. It’s a variant of the ‘embrace–extend–extinguish’ tactic. It could be dubbed SSS: Standardize–Support–Subvert.

  • cobychapple 5 hours ago
    In related fuckery… JS Intl throws on the underscore form. `Intl.getCanonicalLocales("EN_US")` is a RangeError, so piping og:locale into a formatter needs a replace first. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
  • dmitrygr 7 hours ago
    > mark, a yen, a buck, or a pound

    Nice reference. :)

  • bearcatty 1 hour ago
    [dead]
  • nexkit 2 hours ago
    [dead]
  • sitetoolsbox 4 hours ago
    [dead]
  • JimmyAIPPT 5 hours ago
    [dead]
  • sf012607 4 hours ago
    [dead]