Skip to content

Commit 14b37b4

Browse files
authored
Merge pull request #8 from MichalZr6/main
Improve detection of translated entries in .ts files
2 parents 9399356 + 93d40df commit 14b37b4

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

.github/README.md

Whitespace-only changes.

.github/update.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def translation_mod_ratio(translation_mods_translation):
208208
def get_qt_translations(languages):
209209
data = {}
210210

211-
for language in [key for key, value in base_mod_existing(languages).items() if value == True]:
211+
for language in get_languages():
212212
data_type = {}
213213
for type in ["mapeditor", "launcher"]:
214214
count_translated = 0
@@ -221,7 +221,17 @@ def get_qt_translations(languages):
221221
root = ET.fromstring(tmp_str)
222222
for item_context in root.iter('context'):
223223
for item_message in item_context.iter('message'):
224-
if list(item_message.iter('translation'))[0].get("type") == None:
224+
translator_comment = item_message.find('translatorcomment')
225+
translation = item_message.find('translation')
226+
227+
if (
228+
translation is not None
229+
and (
230+
translation.get("type") is None
231+
or (translator_comment is not None and "AI-generated" in translator_comment.text)
232+
or (translation.text is not None and translation.text.strip() != "")
233+
)
234+
):
225235
count_translated += 1
226236
else:
227237
count_untranslated += 1

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ This tables shows the current translation progress of VCMI. See [here](https://v
2323

2424
|Tool|belarusian|bulgarian|czech|chinese|finnish|french|german|greek|hungarian|italian|japanese|korean|polish|portuguese|romanian|russian|spanish|swedish|norwegian|turkish|ukrainian|vietnamese|
2525
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
26-
|[mapeditor](https://github.com/vcmi/vcmi/tree/develop/mapeditor/translation)|$\color{red}{\textsf{0.1 \%}}$|$\color{red}{\textsf{0.1 \%}}$|$\color{orange}{\textsf{82.4 \%}}$|$\color{orange}{\textsf{82.4 \%}}$|$\color{red}{\textsf{0.1 \%}}$|$\color{red}{\textsf{45.1 \%}}$|$\color{green}{\textsf{100.0 \%}}$|$\color{red}{\textsf{0.1 \%}}$|$\color{red}{\textsf{62.5 \%}}$|$\color{red}{\textsf{62.5 \%}}$|$\color{red}{\textsf{0.1 \%}}$|$\color{red}{\textsf{0.1 \%}}$|$\color{orange}{\textsf{83.9 \%}}$|$\color{green}{\textsf{100.0 \%}}$|$\color{red}{\textsf{0.1 \%}}$|$\color{red}{\textsf{49.9 \%}}$|$\color{red}{\textsf{62.5 \%}}$|$\color{red}{\textsf{0.1 \%}}$|$\color{red}{\textsf{0.1 \%}}$|$\color{red}{\textsf{0 \%}}$|$\color{red}{\textsf{19.3 \%}}$|$\color{red}{\textsf{16.1 \%}}$|
27-
|[launcher](https://github.com/vcmi/vcmi/tree/develop/launcher/translation)|$\color{red}{\textsf{0.3 \%}}$|$\color{red}{\textsf{0.3 \%}}$|$\color{green}{\textsf{100.0 \%}}$|$\color{green}{\textsf{100.0 \%}}$|$\color{red}{\textsf{0.3 \%}}$|$\color{green}{\textsf{94.4 \%}}$|$\color{green}{\textsf{100.0 \%}}$|$\color{red}{\textsf{0.3 \%}}$|$\color{green}{\textsf{93.3 \%}}$|$\color{green}{\textsf{93.3 \%}}$|$\color{red}{\textsf{0.3 \%}}$|$\color{red}{\textsf{0.3 \%}}$|$\color{green}{\textsf{94.4 \%}}$|$\color{green}{\textsf{100.0 \%}}$|$\color{red}{\textsf{0.3 \%}}$|$\color{green}{\textsf{94.4 \%}}$|$\color{green}{\textsf{93.3 \%}}$|$\color{green}{\textsf{100.0 \%}}$|$\color{red}{\textsf{0.3 \%}}$|$\color{red}{\textsf{0 \%}}$|$\color{green}{\textsf{94.4 \%}}$|$\color{orange}{\textsf{79.3 \%}}$|
26+
|[mapeditor](https://github.com/vcmi/vcmi/tree/develop/mapeditor/translation)|$\color{orange}{\textsf{89.5 \%}}$|$\color{orange}{\textsf{88.5 \%}}$|$\color{orange}{\textsf{89.3 \%}}$|$\color{orange}{\textsf{89.8 \%}}$|$\color{orange}{\textsf{89.8 \%}}$|$\color{orange}{\textsf{89.4 \%}}$|$\color{green}{\textsf{100.0 \%}}$|$\color{orange}{\textsf{88.2 \%}}$|$\color{orange}{\textsf{89.4 \%}}$|$\color{orange}{\textsf{89.4 \%}}$|$\color{orange}{\textsf{88.5 \%}}$|$\color{orange}{\textsf{85.8 \%}}$|$\color{orange}{\textsf{89.9 \%}}$|$\color{green}{\textsf{100.0 \%}}$|$\color{orange}{\textsf{88.2 \%}}$|$\color{orange}{\textsf{89.4 \%}}$|$\color{orange}{\textsf{89.4 \%}}$|$\color{orange}{\textsf{88.6 \%}}$|$\color{orange}{\textsf{88.7 \%}}$|$\color{orange}{\textsf{88.5 \%}}$|$\color{orange}{\textsf{88.6 \%}}$|$\color{orange}{\textsf{88.7 \%}}$|
27+
|[launcher](https://github.com/vcmi/vcmi/tree/develop/launcher/translation)|$\color{red}{\textsf{0.3 \%}}$|$\color{red}{\textsf{0.3 \%}}$|$\color{green}{\textsf{100.0 \%}}$|$\color{green}{\textsf{100.0 \%}}$|$\color{red}{\textsf{0.3 \%}}$|$\color{green}{\textsf{95.0 \%}}$|$\color{green}{\textsf{100.0 \%}}$|$\color{red}{\textsf{0.3 \%}}$|$\color{green}{\textsf{95.0 \%}}$|$\color{green}{\textsf{95.0 \%}}$|$\color{red}{\textsf{0.3 \%}}$|$\color{red}{\textsf{0.3 \%}}$|$\color{green}{\textsf{95.0 \%}}$|$\color{green}{\textsf{100.0 \%}}$|$\color{red}{\textsf{0.3 \%}}$|$\color{green}{\textsf{95.0 \%}}$|$\color{green}{\textsf{95.0 \%}}$|$\color{green}{\textsf{100.0 \%}}$|$\color{red}{\textsf{0.3 \%}}$|$\color{red}{\textsf{0.3 \%}}$|$\color{green}{\textsf{95.0 \%}}$|$\color{green}{\textsf{94.4 \%}}$|
2828

2929
## Mods translation status
3030

0 commit comments

Comments
 (0)