Skip to content

Language

Surveys use the translations of the form. You add and edit them in Responsly, and they work in the app the same way they do on the web. The SDK only decides which language to ask for.

Without any call, the SDK uses the device’s preferred language. A survey is shown in the form’s translation for that language. If the form has no such translation, the survey appears in the form’s default language.

If your app has its own language setting, pass it to setLocale at startup and whenever the user changes it.

Responsly.shared.setLocale("pl")
// back to the device language
Responsly.shared.setLocale(nil)

The value is a language tag such as pl, en-US or pt-BR. Use the code of the translation you created in the form.

The override does three things:

  1. Surveys are shown in that language.
  2. The languages audience rule is checked against it instead of the device language.
  3. It is recorded as the locale of the response.

The override is saved on the device and survives restarts. It stays until you pass null (nil in Swift) or call reset.

showSurvey takes a locale option that applies to that call only.

Responsly.shared.showSurvey("AbCd1234", options: ResponslyShowOptions(locale: "pl"))

It changes the language that survey is shown in. The languages audience rule is still checked against the SDK’s language (the setLocale value or the device language), not against the per-call option.

OrderSource
1locale passed to showSurvey
2setLocale
3The device’s preferred language

The languages list in the Mobile app tab limits a survey to users of certain languages. It compares the list with the SDK’s language:

  • pt in the list matches pt, pt-BR and pt-PT.
  • pt-BR in the list matches only pt-BR.
  • Case and the _ / - separator do not matter.

A survey filtered out by this rule reports locale_mismatch. The full rules are in Targeting.