Remove the leftover format placeholder from intword units - #382
Open
VenishPaneliya wants to merge 1 commit into
Open
Remove the leftover format placeholder from intword units#382VenishPaneliya wants to merge 1 commit into
VenishPaneliya wants to merge 1 commit into
Conversation
`intword` inserts the unit without any `%` substitution:
return f"{negative_prefix}{number} {unit}"
so a placeholder left in a translated unit is printed literally. The
Bengali, Korean and Vietnamese catalogues still carry `%d` or
`%(value)s` on the `thousand`..`googol` units, presumably from an older
API:
activate("bn_BD"); intword(1_500_000_000) -> '1.5 %d বিলিয়ন'
activate("vi_VN"); intword(1_200_000) -> '1.2 %(value)s triệu'
Strip the placeholder and the separator after it, leaving the translated
words untouched. Only the `intword` power units are changed; placeholders
in other messages are substituted normally and are left alone.
After this, none of the 36 catalogues emits a placeholder for any of the
12 powers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
intwordinserts the unit without any%substitution:so a printf placeholder left in a translated unit is printed literally. The Bengali, Korean and Vietnamese catalogues still carry
%dor%(value)son thethousand…googolunits:On
main:With this PR:
This strips the placeholder and the separator that follows it (a plain space or U+00A0) and leaves the translated words untouched.
Scope is deliberately narrow: only the twelve
intwordpower msgids are changed. Placeholders elsewhere in these catalogues are substituted normally and are left alone —naturaldelta's"%d day"and friends still need theirs. After the change, none of the 36 catalogues emits a placeholder for any of the twelve powers.Added a parametrised regression test over the three locales, checking that
intwordnever returns a%at any power. It fails 3/3 onmainand passes here.Two notes I did not act on, since both need a native speaker rather than a scripted edit:
ko_KRrenders several powers as the English words (million,billion), and itstrillionentry readsbillion.ko_KRandvi_VNalso contain a couple of French leftovers (décillion,gogol).Happy to split those out separately if you would like them addressed.