New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance+BugFix: handle 100% complete translation and plurals-only en_US one #2330
Enhance+BugFix: handle 100% complete translation and plurals-only en_US one #2330
Conversation
…US one This commit allows the generate-translation-stat.lua file to run if there is NOT a line about "Ignored 999 untranslated source text(s)" which will not be present should the translation be 100% complete. It also hides the `mudlet_en_US.ts` translation file from the `qmake` TRANSLATIONS variable because otherwise it will automatically be processed without a `-pluralsonly` option to `lupdate` and that will populate it with hundreds of texts that are not plurals and do not need "translation". This does mean that that language will have to be handled manually (a Mudlet Maker like myself can run it through Qt Linguist to provide the single/plural texts as needed - which currently is 11 cases and which I have done in this commit). Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Hey there! Thanks for helping Mudlet improve. 🌟 You can directly test the changes here:
No need to install anything - just unzip and run. |
total = translated + untranslated, | ||
translatedpc = math.floor((100/(translated + untranslated)) * translated) | ||
} | ||
end | ||
end | ||
|
||
print("lang", "trnsl", "utrnsl", "total", "percentage") | ||
print("lang", "trnsl", "utrnsl", "finish", "unfin", "total", "percentage") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need unfin
? Looking at the logs, it's all 0's. How is that related to handling 100% complete translation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those numbers might not be for the en_US
case and, not being sure which ones are changed under whatever circumstances it isn't too unreasonable to grab all of them, is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But why? They won't be used for anything as far as I know. Better to have simpler code, than more complicated code where you're not sure what's actually relevant or not 🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 YAGNI
Leave a comment if you fear forgetting the stat exists, but if it's not needed, then don't include it in code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to check, I suspect (but have to prove) that if more numerous (plaural) translations are added then they will show up there for the English (American) case - I further suspect that it might be that "untranslated"/"finished" and "unfinished" might relate to different numbers including:
- the total number of strings that are needed (which for languages that have plurals - pretty much all but Japan IIRC) that means more than one per source text when the
tr(...)
source has the third,int
eger, argument. - the number of strings that have an unapproved or approved translation (marked tags containing "unfinished" attribute in the
.ts
XML file) - counting each source text as a single item even if it needs more than one translation dependant on the plural form(s) for that locale.
As I say, I am not sure which of the figures is which, but will check and report what I find out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I didn't know about YAGNI - I had to look it up. As a counter - not that it applies in this case - can I propose the term YAGNIBID for the lexicon with a "... but I do" suffix? 🤣
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the record - when using Qt Linguist - as we will need to for the mudlet_en_US.ts
/mudlet_en_US.qm
case I think the column headings work out to mean:
lang
- guess what, the language codetrnsl
- the number of completed translations in the file - which is currently11
for the en_US caseuntrnsl
- the number of translations that do not have any texts as translations at all (and will be marked with a green query mark in Linguist)finish
- the number of translations that have been marked as done in linguist (and have either a green{approved/done} or yellow {approved/done but has a warning} tick)unfin
- the number of translations that have some text but are not marked as done in linguist (and thus have a yellow query{has entry but not marked as approved/done} mark or red exclamation {has entry but triggers a warning and not marked as approved/done} mark)total
- the sum oftrnsl
anduntrnsl
Whilst we will only see all or zero figures for the two additional columns for the other locales handled by CrowIn it is possible that other numbers will show for the American case if there are any changes to the wording in the numerous source texts to be translated...
total = translated + untranslated, | ||
translatedpc = math.floor((100/(translated + untranslated)) * translated) | ||
} | ||
end | ||
end | ||
|
||
print("lang", "trnsl", "utrnsl", "total", "percentage") | ||
print("lang", "trnsl", "utrnsl", "finish", "unfin", "total", "percentage") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 YAGNI
Leave a comment if you fear forgetting the stat exists, but if it's not needed, then don't include it in code.
Thanks for your work on this. |
Fix a simple typo in a comment. Co-Authored-By: SlySven <slysven@virginmedia.com>
This commit allows the
generate-translation-stat.lua
file to run if there is NOT a line about "Ignored 999 untranslated source text(s)" which will not be present should the translation be 100% complete.It also hides the
mudlet_en_US.ts
translation file from theqmake
TRANSLATIONS
variable because otherwise it will automatically be processed without a-pluralsonly
option tolupdate
and that will populate it with hundreds of texts that are not plurals and do not need "translation". This does mean that that language will have to be handled manually (a Mudlet Maker like myself can run it through Qt Linguist to provide the single/plural texts as needed - which currently is 11 cases and which I have done in this commit).We do need to remove the current "English, American" translation from CrowdIn - it was one I added a few months back, before I found out that they cannot handle the Qt plurals-only translation case when the strings in the source text is in the same language as the target locale. As such it has not been touched and it will interfere/overwrite the much smallerUpdate: done by Vadim.mudlet_en_US.ts
included here which is currently complete.Signed-off-by: Stephen Lyons slysven@virginmedia.com