The SQL engine uses only the error numbers internally. Those are what the engine know about, and are how it complains about "bad code" that it receives from the SQL client. The error message displayed below the Msg line contains a description of the error in the current locale (in this case, essentially a human language like English, Spanish, French, etc).
The process of getting the text description is simply a table lookup, there's no "magic" associated with it. The table of error messages changes constantly, usually with every service pack.