Set Browser Language

Set Browser Language

Overview

The setBrowserLanguage API allows you to manually set the browser language for a visitor. This value is stored in localStorage. By setting the browser language explicitly, you can set it programmatically based on your application logic to be used by the survey for fetching questions based on the language set.

Signature

window.Wingify = window.Wingify || [];
window.Wingify.push(['setBrowserLanguage', language]);

Arguments

ParameterData TypeRequiredDescription
languagestringYesThe language code to set (see Supported languages under Usage Notes). This value will be stored in localStorage.

Example

window.Wingify = window.Wingify || [];
// Set browser language to English
window.Wingify.push(['setBrowserLanguage', 'en']);

// Set browser language to Spanish
window.Wingify.push(['setBrowserLanguage', 'es']);

// Set browser language to French
window.Wingify.push(['setBrowserLanguage', 'fr']);

Use-cases

  • This will be used in surveys to show the question in the set browser language.

Notes

  • Add this API before SmartCode so the language preference is available from the initial survey execution on page load.
  • The language value is stored in localStorage with the key vwo_bL.
  • The value persists across browser sessions until explicitly changed or cleared.
  • Use a supported language code from the table below.
  • If no custom language is set, Wingify falls back to the default browser language value available in settings.
  • This API is intended for Survey language resolution.

Supported languages

LanguageCode
Arabicar
Bengalibn
Chinese Simplifiedzh-Hans
Chinese Traditionalzh-Hant
Danishda
Dutchnl
Englishen
Finnishfi
Frenchfr
Germande
Greekgr
Gujaratigu
Hebrewhe
Hindihi
Hungarianhu
Indonesianid
Japaneseja
Kannadakn
Koreanko
Malayalamml
Marathimr
Norwegianno
Portuguese (Brazil)pt-BR
Russianru
Spanishes
Swedishsv
Tamilta
Telugute
Turkishtr