skip to Main Content

This question is NOT about translating the content of a web page. It is about the Exceptions thrown in the JavaScript engine.

I am wondering if all international installations of browsers, installed on international OSs, produce the exception STACK in english or in the native language.

I am NOT asking about any of the following:

  • Translating a web page.
  • The runtime language choice of a web page.

I am asking about a different language install of the browser where all of the UI in the browser is in the installed language including the menus, etc.

For example in the English Chrome browser I get an exception stack like this:

myState.js:10 Uncaught TypeError: Cannot read properties of undefined (reading 'stack')
    at new MyStateError (myState.js:10:17)
    at createState (myState.js:22:11)
    at statetest.html:16:23

Will it be the same for a French or Spanish installed browser? Or will the French installed version look like this:

myState.js:10 Non capturé TypeError : Impossible de lire les propriétés d'une valeur indéfinie (lecture de 'stack')
    à new MyStateError (myState.js:10:17)
    à créerÉtat (myState.js:22:11)
    à statetest.html:16:23

I don’t have a second machine on which I can install a different language OS and browser. Can someone that has a non-English install of a browser let me know what they get. (Again I am not concerned with page translations, I am looking for someone that has a full Non-English language version installed on a non-English OS)

You can run these lines of code in Dev Tools to find out:

let a = new Error('Testing');
console.log(a.stack)

UPDATE (2024-12-19)

I do not understand why people downvote and request to close a VALID QUESTION!! I am working on some code and I need to understand how the Exception Stack will be generated for browsers that are not running in English. I did figure it out thanks to a suggestion by @traktor and I will post it below.

2

Answers


  1. Chosen as BEST ANSWER

    First, than you @Traktor. Your suggestion lead me to accidentaly tell my Mac that I wanted to switch the default OS language to French and that allowed me to test this easily.

    I hope that someone else also finds this information useful.

    Here is my test code:

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Document</title>
    </head>
    <body>
    <script>
      function one() {
        try {
          two();
        }
    
        catch(ex) {
          console.log(ex.stack);
        }
      }
    
      function two() {
        three();
      }
      function three() {
        throw new Error('asd')
      }
    </script>
    <button onclick="one()">Click me!!!</button>
    </body>
    </html>

    And my results from Chrome, Firefox and Safari are below. I will text on Edge, Android and IOS later, but I hope those are similar.

    International Exception Stack Text:

    Below is the value of ex.stack:

    Chrome:

    • English:

      Error: asd
         at three (test1.html:26:11)
         at two (test1.html:23:5)
         at one (test1.html:12:7)
         at HTMLButtonElement.onclick (test1.html:29:25)
      
    • French:

      Error: asd
        at three (test1.html:26:11)
        at two (test1.html:23:5)
        at one (test1.html:12:7)
        at HTMLButtonElement.onclick (test1.html:29:25)
      

    Firefox:

    • English:

      three@http://localhost:8888/I18NExceptions/test1.html:28:11
      two@http://localhost:8888/I18NExceptions/test1.html:25:5
      one@http://localhost:8888/I18NExceptions/test1.html:12:7
      onclick@http://localhost:8888/I18NExceptions/test1.html:1:1
      
    • French:

      three@http://localhost:8888/I18NExceptions/test1.html:26:11
      two@http://localhost:8888/I18NExceptions/test1.html:23:5
      one@http://localhost:8888/I18NExceptions/test1.html:12:7
      onclick@http://localhost:8888/I18NExceptions/test1.html:1:1
      

    Safari:

    • English:
      three@http://localhost:8888/I18NExceptions/test1.html:28:20
      two@http://localhost:8888/I18NExceptions/test1.html:25:10
      one@http://localhost:8888/I18NExceptions/test1.html:12:10
      onclick@http://localhost:8888/I18NExceptions/test1.html:31:4
      
    • French:
      three@http://localhost:8888/I18NExceptions/test1.html:28:20
      two@http://localhost:8888/I18NExceptions/test1.html:25:10
      one@http://localhost:8888/I18NExceptions/test1.html:12:10
      onclick@http://localhost:8888/I18NExceptions/test1.html:31:4
      

  2. This answer describes Firefox behavior. It may or may not apply to browsers in general.

    • under settings, scroll down to the language section.
    • choose a language other than your default, adding a new one if needed, but pick one that you can recognize the words for "settings" and "language" to revert the change later.
    • Firefox chrome (menus and presentation that uses text rather than icons) changes to the language chosen. E.G. for French, items listed in the hamburger menu and their associated pages were presented in Français, along with right click menus in French and invitations to translate English language web pages.

    Errors in English, with help

    Syntax errors were still reported on the console in English. However, a help link was added to console output: [en savoir plus] linking to a page on the French version of MDN explaining the error reported in English. Example

    let x = 1;
    let x = 2;
    

    generated console output of

    Uncaught SyntaxError: redeclaration of let x

    [en savoir plus]:

    Note

    The en savoir plus link contains URL parameters of unknown usage:

        ?utm_source=mozilla&utm_medium=firefox-console-errors&utm_campaign=default)
    

    While I suspect other major browsers probably do something similar, without testing additional browsers I can’t say for certain. If you already know they don’t, you could always suggest Firefox to your friend.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search