Skip to content
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

Merged

Conversation

SlySven
Copy link
Member

@SlySven SlySven commented Feb 8, 2019

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).

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 smaller mudlet_en_US.ts included here which is currently complete. Update: done by Vadim.

Signed-off-by: Stephen Lyons slysven@virginmedia.com

…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>
@SlySven SlySven added bugfix enhancement 1 - Ready for review i18n & l10n internationalization and localization labels Feb 8, 2019
@SlySven SlySven added this to the 3.18.0 milestone Feb 8, 2019
@SlySven SlySven requested review from a team February 8, 2019 01:07
@add-deployment-links
Copy link

add-deployment-links bot commented Feb 8, 2019

Hey there! Thanks for helping Mudlet improve. 🌟

You can directly test the changes here:

No need to install anything - just unzip and run.
Let us know if it works well, and if it doesn't, please give details.

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")
Copy link
Member

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?

Copy link
Member Author

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?

Copy link
Member

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 🤷‍♂️

Copy link
Contributor

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.

Copy link
Member Author

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, integer, 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.

Copy link
Member Author

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? 🤣

Copy link
Member Author

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 code
  • trnsl - the number of completed translations in the file - which is currently 11 for the en_US case
  • untrnsl - 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 of trnsl and untrnsl

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")
Copy link
Contributor

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.

translations/translated/updateqm.pri Show resolved Hide resolved
@vadi2 vadi2 assigned SlySven and unassigned vadi2 Feb 14, 2019
@SlySven SlySven assigned vadi2 and Kebap and unassigned SlySven Feb 24, 2019
translations/translated/updateqm.pri Outdated Show resolved Hide resolved
@vadi2
Copy link
Member

vadi2 commented Feb 24, 2019

Thanks for your work on this.

Fix a simple typo in a comment.

Co-Authored-By: SlySven <slysven@virginmedia.com>
@SlySven SlySven merged commit c147889 into Mudlet:development Feb 27, 2019
@SlySven SlySven deleted the BugFix_100%TranslationsAndPluralsOnly_en_US branch February 27, 2019 20:57
@SlySven SlySven restored the BugFix_100%TranslationsAndPluralsOnly_en_US branch June 22, 2020 18:00
@SlySven SlySven deleted the BugFix_100%TranslationsAndPluralsOnly_en_US branch June 22, 2020 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix enhancement i18n & l10n internationalization and localization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants