Skip to content
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

Merged
merged 3 commits into from
Sep 28, 2021

Conversation

D3fau4
Copy link
Contributor

@D3fau4 D3fau4 commented Sep 20, 2021

No description provided.

Copy link
Collaborator

@pleonex pleonex left a 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):
Copy link
Collaborator

@pleonex pleonex Sep 21, 2021

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:

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

@pleonex pleonex added the enhancement New feature or request label Sep 21, 2021
@pleonex pleonex changed the title Create delta.py Create highlight and validation for Deltarune Sep 21, 2021
@D3fau4
Copy link
Contributor Author

D3fau4 commented Sep 21, 2021

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

@pleonex
Copy link
Collaborator

pleonex commented Sep 23, 2021

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.
Also can you check why the CI failed?

@pleonex
Copy link
Collaborator

pleonex commented Sep 24, 2021

Nevermind about the CI. It's a problem of the pipeline itself.

@D3fau4
Copy link
Contributor Author

D3fau4 commented Sep 25, 2021

Done

@Darkmet98 Darkmet98 merged commit 1864ef7 into TraduSquare:develop Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants