Fix: Handle whitespace-only translations properly#2375
Closed
khushal-winner wants to merge 1 commit intoOWASP:masterfrom
Closed
Fix: Handle whitespace-only translations properly#2375khushal-winner wants to merge 1 commit intoOWASP:masterfrom
khushal-winner wants to merge 1 commit intoOWASP:masterfrom
Conversation
52dbb2e to
9fb2998
Compare
Collaborator
|
@khushal-winner please make sure your commits are signed with a verified signature. |
Collaborator
|
@khushal-winner Make sure your commits have a verified signature |
Contributor
Author
|
@sydseter now i have verified my commits, thanks :) |
Collaborator
|
all the commits must have a verified signature. |
33742c7 to
cfa700b
Compare
Contributor
Author
@sydseter done |
cfa700b to
3bdc2a6
Compare
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.
Fix: Handle whitespace-only translations properly
Description
Fixes the translation checker to properly detect whitespace-only strings as empty translations.
Fixes #2374
Problem
The
_check_translation_tags()method inscripts/check_translations.pywas not detecting whitespace-only translations (e.g.," ","\t \n") as empty because the checknot " "evaluates toFalsein Python.Current Behavior
Root Cause
Solution
Changes Made
1.
scripts/check_translations.pyAdded
.strip()check to properly detect whitespace-only strings:Before:
After:
2.
scripts/check_translations_utest.pyAdded
TestWhitespaceHandlingclass with 4 comprehensive unit tests:test_whitespace_only_detected_as_empty- Detects" "as emptytest_tabs_and_newlines_detected_as_empty- Detects"\t \n"as emptytest_extra_spaces_detected_as_untranslated- Detects" Login "as untranslatedtest_properly_translated_no_issues- Ensures valid translations still workTesting
New Test Suite
Results:
All Existing Tests Pass
All existing tests continue to pass without any modifications ✅
Test Coverage
The new tests cover:
"")" ")"\t \n ")" Login ")