Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d89db03

Browse files
authored
Update hoi4localisationadder.py
Improve checking for keys already present in the localisation file.
1 parent 86133f2 commit d89db03

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

‎python2/hoi4localisationadder.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,9 @@ def readfile(name):
127127
print("Output file " + args.output + " is empty or doesn't exist, creating a new english localisation file.")
128128
output_lines.append("l_english:")
129129
for line in lines:
130-
for i,parsed_line in enumerate(parsed_file[0]):
131-
if parsed_line in line:
130+
for i, parsed_line in enumerate(parsed_file[0]):
131+
match = re.match(r"^([^#:]*):", line)
132+
if match and match.group(1).strip() == parsed_line.strip():
132133
print(parsed_line + " already in output file, skipping")
133134
parsed_file[0].remove(parsed_file[0][i])
134135
if len(parsed_file[0]) > 0:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /