The getUserPreferredLanguage function accepts a user object as input.
If a preferred language is specified in the user object,
it returns their language preference.
If no preferred language is specified,
it defaults to the defaultLanguage.
For example: