From 6be02b29c82687d519f4c860bdfbac0dedbf1db2 Mon Sep 17 00:00:00 2001 From: Faraphel Date: Sat, 30 Dec 2023 16:52:16 +0100 Subject: [PATCH] made the steam language challenge dynamic depending on the language --- source/survey/WebMission.py | 8 +++++++- surveys.json | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/source/survey/WebMission.py b/source/survey/WebMission.py index 9466f7d..9ac5983 100644 --- a/source/survey/WebMission.py +++ b/source/survey/WebMission.py @@ -230,7 +230,13 @@ class WebMission(BaseSurvey): self._success() page = self.browser.web.page() - page.runJavaScript(self.check_condition, resultCallback=check_callback) + + # preprocess the condition + condition = self.check_condition + condition = condition.replace("#LANGUAGE_CODE#", translate.get_language()) + + # run the condition + page.runJavaScript(condition, resultCallback=check_callback) # data collection diff --git a/surveys.json b/surveys.json index 9074957..2bf4983 100644 --- a/surveys.json +++ b/surveys.json @@ -167,7 +167,7 @@ "sp": "Cambiar el idioma a EspaƱol." }, "url": "https://store.steampowered.com/", - "check": "document.getElementsByTagName('html')[0].lang == 'fr'", + "check": "document.getElementsByTagName('html')[0].lang == '#LANGUAGE_CODE#'", "skip_time": 60 },