Add consistent pseudolocalization#1061
Merged
Merged
Conversation
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
| String result = ps.convertAsciiToDiacritics("qQV", SubstituteType.CONSISTENT); | ||
| assertEquals( | ||
| "Unmapped chars should remain unchanged with consistent substitution", "qQV", result); | ||
| } |
Contributor
There was a problem hiding this comment.
Now we need a few tests with SubstitutionType.RANDOM to verify its functionality still works as before.
ehoogerbeets
previously approved these changes
May 22, 2026
Contributor
ehoogerbeets
left a comment
There was a problem hiding this comment.
Approving so that after you add the requested unit tests, everything else is already good to go.
Contributor
|
The new tests look fine, but now there are seemingly unrelated unit test errors? Any ideas as to what is going on there? |
ehoogerbeets
approved these changes
May 26, 2026
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.
This PR adds ability to produce pseudolocalized strings consistently instead of picking replacement characters at random.
In some cases, it's not desirable to get a completely different pseudolocalized string after each run of the
pseudocommand. To avoid it, this PR adds a CLI option--substitutewhich allows to select whether replacement characters are picked at random (--substitute=RANDOM), or consistently (--substitute=CONSISTENT).Consistent pseudo means that for a given input string, pseudolocalized output will be invariant. Note that generally there will still be different diacritic characters inserted across the whole content (e.g. a
Gcan still be one ofĜĞĠĢ) - the choice in consistent mode is based on the amount of previous occurrences of that character inside a given input string.To preserve original behaviour, default value for this option is
RANDOM.