-
Notifications
You must be signed in to change notification settings - Fork 2
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
Create highlight and validation for Deltarune #1
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a small adjustment.
# Real check code | ||
def check_single(self, source, target, unit): | ||
"""Validate that the text contains the end control code.""" | ||
if self.should_skip(unit): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There isn't else
clause so some times it will return none
that I don't think it is expected. If you don't want to add logic, just return False
always.
If you want, you could check if the tag is present in the translated string, so translators don't forget to add it (if it's mandatory always). To do that, you can check this one for that logic:
weblate-customization/tradusquare_customization/checks/braces.py
Lines 55 to 65 in ef3a722
def check_single(self, source, target, unit): | |
"""Validate that the same control codes are in the translated text.""" | |
src_match = BRACE_MATCH.findall(source) | |
if not src_match: | |
return False | |
tgt_match = BRACE_MATCH.findall(target) | |
if len(src_match) != len(tgt_match): | |
return True | |
return src_match != tgt_match |
i dont know if this is fine because idk how this works in weblate... Exactly i need check if the translation have the same number of tags as the original string. so it should be something like this? # Real check code
def check_single(self, source, target, unit):
"""Validate that the text contains the control code."""
src_match = JSON_MATCH.findall(source)
tar_match = JSON_MATCH.findall(target)
if (len(src_match) != len(tar_match)):
return False
return True |
It's the other way. Return true if the warning must be displayed (so if the number between source and targey is not the same). For the rest is good. |
Nevermind about the CI. It's a problem of the pipeline itself. |
Done |
No description provided.