GetUserLanguages

Returns a string array of language locale codes for the user’s browser. You can use this information to send language- and country-appropriate to a microsite.

note: This function doesn’t work with CloudPages. To retrieve language information for CloudPages, use the Platform.Request.GetRequestHeader() function to retrieve the Accept-Language header.

Syntax

Platform.Request.GetUserLanguages()

Usage

To execute this function, call it without any parameters.

<!-- prettier-ignore -->
<script runat="server">
  var langs = Platform.Request.GetUserLanguages(); 
  
  var defaultLangs = langs[0];
</script>

The code example returns a locale code derived from the user’s browser headers.

en-US