Skip to content

Commit 1aef349

Browse files
committed
dictgen: limit alignment length
1 parent 23b0ab2 commit 1aef349

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dictgen.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ def vgui_translation_parse(name):
101101
return trans
102102

103103
def create_translations_file(name, trans):
104-
maxlength = len(max(trans, key=len)) + 1
104+
maxlength = min(72, len(max(trans, key=len)) + 1)
105105

106106
# we are working in UTF-8, it's easier to handle than UTF-16
107107
with open(name, "w", encoding = 'utf-8',newline = '\r\n') as f:
108108
f.write(HEADER)
109109
for t in trans:
110-
length = maxlength - len(t)
110+
length = max(1, maxlength - len(t))
111111

112112
f.write('"%s"%*s""\n' % (t, length, ' '))
113113
f.write(FOOTER)

0 commit comments

Comments
 (0)