Skip to content

Commit

Permalink
fix profession parser
Browse files Browse the repository at this point in the history
  • Loading branch information
mqrause committed Oct 31, 2024
1 parent b39baa0 commit 3ee908f
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions lang/string_extractor/parsers/profession.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,27 @@ def parse_profession(json, origin):

desc_male = ""
desc_female = ""
if type(json["description"]) is dict:
if "male" in json["description"]:
desc_male = json["description"]["male"]
desc_female = json["description"]["female"]
elif "str" in json["description"]:
desc_male = desc_female = json["description"]["str"]
else:
desc_male = desc_female = json["description"]
has_description = "description" in json
if has_description:
if type(json["description"]) is dict:
if "male" in json["description"]:
desc_male = json["description"]["male"]
desc_female = json["description"]["female"]
elif "str" in json["description"]:
desc_male = desc_female = json["description"]["str"]
else:
desc_male = desc_female = json["description"]

write_text(name_male, origin, context="profession_male",
comment="Profession name for male")
write_text(desc_male, origin, context="prof_desc_male",
comment="Description of profession \"{}\" for male".
format(name_male))
if has_description:
write_text(desc_male, origin, context="prof_desc_male",
comment="Description of profession \"{}\" for male".
format(name_male))

write_text(name_female, origin, context="profession_female",
comment="Profession name for female")
write_text(desc_female, origin, context="prof_desc_female",
comment="Description of profession \"{}\" for female".
format(name_female))
if has_description:
write_text(desc_female, origin, context="prof_desc_female",
comment="Description of profession \"{}\" for female".
format(name_female))

0 comments on commit 3ee908f

Please sign in to comment.