Skip to content

Commit

Permalink
Change: List languages with name instead of ISO code in the commit me…
Browse files Browse the repository at this point in the history
…ssages. (#55)
  • Loading branch information
TrueBrain committed Sep 30, 2021
1 parent 0625924 commit da67590
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions scripts/lang_sync
Expand Up @@ -402,8 +402,9 @@ class EintsLanguageInfo:
@type last_change: C{None} or C{str}
"""

def __init__(self, isocode, parent_lang, last_change):
def __init__(self, isocode, name, parent_lang, last_change):
self.isocode = isocode
self.name = name
self.parent_lang = parent_lang
self.last_change = last_change

Expand Down Expand Up @@ -436,6 +437,7 @@ def get_eints_languages():
isocode = line.get("isocode")
if isocode is None or len(isocode) == 0:
continue
name = line.get("name", isocode)

plang = line.get("base_isocode")
if plang is None:
Expand All @@ -446,7 +448,7 @@ def get_eints_languages():
# last_change = line.get("changetime")
# XXX Parse and validate the last change date

el = EintsLanguageInfo(isocode, plang, None)
el = EintsLanguageInfo(isocode, name, plang, None)
result.append(el)

eints_files_cache = result
Expand Down Expand Up @@ -1044,7 +1046,7 @@ def perform_download(ll_files, el_files, credits_handle, path_base):
if credits_handle is not None:
credits = collect_credits(current_strings, parsed)
if len(credits) > 0:
credits_handle.write(el.isocode + ": " + credits + "\n")
credits_handle.write(el.name.lower() + ": " + credits + "\n")
credits_handle.flush() # Flush it to disk, so it is preserved on crash.
write_parsed_lines(parsed, path, eolstyle)

Expand Down
4 changes: 2 additions & 2 deletions webtranslate/pages/download_list.py
Expand Up @@ -47,7 +47,7 @@ def download_list(userauth, prjname):

pdata = pmd.pdata
response.content_type = "text/plain; charset=UTF-8"
lines = ["isocode,base_isocode,changetime"]
lines = ["isocode,name,base_isocode,changetime"]
for lng, ldata in pdata.languages.items():
tstamp = get_newest_change(ldata)
if tstamp is None:
Expand All @@ -60,7 +60,7 @@ def download_list(userauth, prjname):
else:
parent_lng = pdata.base_language

line = "{},{},{}".format(ldata.name, parent_lng, text)
line = "{},{},{},{}".format(ldata.name, ldata.info.name, parent_lng, text)
lines.append(line)

return "\n".join(lines) + "\n"

0 comments on commit da67590

Please sign in to comment.