Skip to content

Commit

Permalink
Don't add language of original as language of translated Edition (#79)
Browse files Browse the repository at this point in the history
Task: https://phabricator.wikimedia.org/T228489

It confused the language of original with actual language of the edition,
adding both.

Fixed in the live URI version. Will have to be tested in the local batch version, to
see if the problem occurs there as well.
  • Loading branch information
Vesihiisi committed Jul 19, 2019
1 parent 66fab29 commit 51e7068
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions importer/Edition.py
Expand Up @@ -267,13 +267,13 @@ def set_language(self):
lang_map = self.data_files["languages"]
if self.mode == "uri":
found_languages = []
for el in self.raw_data:
graph = el.get("@graph")
if graph and len(graph) > 1:
for el in graph[1]:
if graph[1][el] == "Language":
found_languages.append(graph[1].get("langCode"))

text_record = [
x for x in self.raw_data if x.get("@type") == "Text"]
for tr in text_record:
raw_languages = tr.get("language")
for rl in raw_languages:
if rl.get("@id"):
found_languages.append(rl["@id"].split("/")[-1])
if found_languages:
for lang in found_languages:
lang_q = [x.get("q")
Expand Down

0 comments on commit 51e7068

Please sign in to comment.