How does WordPress know wich language is chosen when there is a database connection error

When I have a db connection error in WordPress, WordPress shows the following error:

Error establishing a database connection

But when my website’s language is set to german, the message shows:

Fehler beim Aufbau einer Datenbankverbindung

Which is basically the same error message but in german. But how does WP know which language is chosen, since it could not connect to the database server?