Skip to content

Commit

Permalink
Rename form variable, run black
Browse files Browse the repository at this point in the history
  • Loading branch information
lognaturel committed Jul 23, 2020
1 parent 631ea08 commit 0c477f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
13 changes: 4 additions & 9 deletions pyxform/survey.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,23 +593,18 @@ def _setup_choice_translations(name, choice_value, itext_id):
for d in element.get_translations(self.default_language):

translation_path = d["path"]
translation_key = "form"
form = "long"

if "guidance_hint" in d["path"]:
translation_path = d["path"].replace("guidance_hint", "hint")
translation_key = "guidance"
form = "guidance"

self._translations[d["lang"]][translation_path] = self._translations[
d["lang"]
].get(translation_path, {})

self._translations[d["lang"]][translation_path].update(
{
translation_key: {
"text": d["text"],
"output_context": d["output_context"],
}
}
{form: {"text": d["text"], "output_context": d["output_context"],}}
)

# This code sets up translations for choices in filtered selects.
Expand Down Expand Up @@ -752,7 +747,7 @@ def itext(self):
)
continue

if media_type == "form":
if media_type == "long":
# I'm ignoring long types for now because I don't know
# how they are supposed to work.
itext_nodes.append(
Expand Down
2 changes: 1 addition & 1 deletion pyxform/tests_v1/test_repeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def test_output_with_guidance_hint_translation_relative_path(self):
xml__contains=[
'<translation lang="English">',
'<value> Name of <output value=" ../pos "/> </value>',
'<value form="guidance"> More <output value=" ../pos "/> </value>'
'<value form="guidance"> More <output value=" ../pos "/> </value>',
],
)

Expand Down

0 comments on commit 0c477f0

Please sign in to comment.