Base completion on number of words in msgids #20

Merged
mdk merged 11 commits from maciek/potodo:word-counts into main 2025-10-16 16:06:25 +02:00
Contributor

Closes #13.

Closes #13.
@ -72,8 +82,12 @@ class PoFileStats:
),
"percent_translated": pofile.percent_translated(),
"entries": len([e for e in pofile if not e.obsolete]),
"words": sum([len(e.msgid.split()) for e in pofile if not e.obsolete]),
Contributor

nit: consider leaving a TODO comment mentioning that it can later be modified as e.total_words() and e.translated_words() after polib supports these methods.

nit: consider leaving a TODO comment mentioning that it can later be modified as e.total_words() and e.translated_words() after polib supports these methods.
maciek marked this conversation as resolved
@ -75,2 +86,4 @@
"untranslated": len(pofile.untranslated_entries()),
"translated": len(pofile.translated_entries()),
"translated_words": sum(
[len(e.msgid.split()) for e in pofile.translated_entries()]
Contributor
related issue: https://github.com/izimobil/polib/pull/166#discussion_r2209880615
Contributor

not an issue after clarification

not an issue after clarification
maciek marked this conversation as resolved
mattwang44 approved these changes 2025-07-16 14:49:03 +02:00
mattwang44 left a comment

LGTM

LGTM
Author
Contributor

I've added word completion to project class (missed earlier), and added a new test assert for TOTAL. Also added TODOs according to the comment.

I've added word completion to project class (missed earlier), and added a new test assert for `TOTAL`. Also added TODOs according to the comment.
@ -133,2 +157,4 @@
return sum(po_file.words for po_file in self.files_stats)
@property
def completion(self) -> float:
First-time contributor

Changing this will may cause large changes in the returned result, I think this should be an option as so to not surprise people.

Changing this will may cause large changes in the returned result, I think this should be an option as so to not surprise people.
Author
Contributor

I think those are good defaults, I'd be for including this change in a changelog and maybe bumping library version to 1.0.0? @seluj78 @mdk what do you think?

I think those are good defaults, I'd be for including this change in a changelog and maybe bumping library version to 1.0.0? @seluj78 @mdk what do you think?
@ -201,2 +240,4 @@
)
@property
def completion(self) -> float:
First-time contributor

Ditto.

Ditto.
mdk merged commit b4f5a2978e into main 2025-10-10 14:37:29 +02:00
mdk deleted branch word-counts 2025-10-10 14:37:29 +02:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
AFPy/potodo!20
No description provided.