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.
Default: the device language
Section titled “Default: the device language”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.
Set the language for all surveys
Section titled “Set the language for all surveys”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 languageResponsly.shared.setLocale(nil)Responsly.setLocale("pl")
// back to the device languageResponsly.setLocale(null)Responsly.setLocale('pl')
// back to the device languageResponsly.setLocale(null)Responsly.setLocale('pl');
// back to the device languageResponsly.setLocale(null);ResponslySDK.SetLocale("pl");
// back to the device languageResponslySDK.SetLocale(null);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:
- Surveys are shown in that language.
- The languages audience rule is checked against it instead of the device language.
- 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.
Set the language for one survey
Section titled “Set the language for one survey”showSurvey takes a locale option that applies to that call only.
Responsly.shared.showSurvey("AbCd1234", options: ResponslyShowOptions(locale: "pl"))Responsly.showSurvey("AbCd1234", ShowOptions(locale = "pl"))Responsly.showSurvey('AbCd1234', { locale: 'pl' })Responsly.showSurvey('AbCd1234', locale: 'pl');ResponslySDK.ShowSurvey("AbCd1234", new ShowOptions { 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.
Which language wins
Section titled “Which language wins”| Order | Source |
|---|---|
| 1 | locale passed to showSurvey |
| 2 | setLocale |
| 3 | The device’s preferred language |
Language and targeting
Section titled “Language and targeting”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:
ptin the list matchespt,pt-BRandpt-PT.pt-BRin the list matches onlypt-BR.- Case and the
_/-separator do not matter.
A survey filtered out by this rule reports locale_mismatch. The full rules are in Targeting.