Set correct end line in twlang.py for strings with context

This commit is contained in:
furo 2024-08-30 20:15:26 +02:00
parent edcc3245f4
commit d40cc86bfa

View file

@ -37,7 +37,7 @@ def decode(fileobj, elements_per_key):
if current_key: if current_key:
if len(data[current_key]) != 1+elements_per_key: if len(data[current_key]) != 1+elements_per_key:
raise LanguageDecodeError("Wrong number of elements per key", fileobj.name, index) raise LanguageDecodeError("Wrong number of elements per key", fileobj.name, index)
data[current_key].append(index) data[current_key].append(index - 1 if current_context else index)
if line in data: if line in data:
raise LanguageDecodeError("Key defined multiple times: " + line, fileobj.name, index) raise LanguageDecodeError("Key defined multiple times: " + line, fileobj.name, index)
data[(line, current_context)] = [index - 1 if current_context else index] data[(line, current_context)] = [index - 1 if current_context else index]