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

Loosen HTML check in community guideline #9497

Closed
nijel opened this issue Jul 3, 2023 · 6 comments
Closed

Loosen HTML check in community guideline #9497

nijel opened this issue Jul 3, 2023 · 6 comments
Assignees
Labels
enhancement Adding or requesting a new feature. good first issue Opportunity for newcoming contributors. hacktoberfest This is suitable for Hacktoberfest. Don’t try to spam. help wanted Extra attention is needed.
Milestone

Comments

@nijel
Copy link
Member

nijel commented Jul 3, 2023

We just encountered this problem translating sources for gettext po files. safe-html is flagged on the community localization checklist with a big orange warning symbol. The documentation doesn't say anything about it gratuitously inserting HTML entities into strings that aren't HTML and where they don't belong.

The warning should be removed from the community localization checklist and the documentation for the tag should have a warning that it should be used only for projects in which all translatable strings are HTML or XML.

Originally posted by @jralls in #6490 (comment)

@nijel nijel added enhancement Adding or requesting a new feature. hacktoberfest This is suitable for Hacktoberfest. Don’t try to spam. help wanted Extra attention is needed. good first issue Opportunity for newcoming contributors. labels Jul 3, 2023
@github-actions
Copy link

github-actions bot commented Jul 3, 2023

This issue seems to be a good fit for newbie contributors. You are welcome to contribute to Weblate! Don't hesitate to ask any questions you would have while implementing this.

You can learn about how to get started in our contributors documentation.

@kunjshukla
Copy link

hey, I would like to contribute to this issue. Please assign this to me.

@nijel
Copy link
Member Author

nijel commented Jul 5, 2023

@kunjshukla I've just assigned this to you.

This is the current implementation:

@register
class SafeHTMLGuideline(Guideline):
description = gettext_lazy(
"Add safe-html flag to avoid dangerous HTML from translators."
)
url = "settings"
anchor = "translation"
def is_relevant(self):
cache_key = f"guide:safe-html:{self.component.id}"
result = cache.get(cache_key)
if result is not None:
return result
result = self.component.source_translation.unit_set.filter(
source__contains="<a "
).exists()
cache.set(cache_key, result, 86400)
return result
def is_passing(self):
return (
"safe-html" in self.component.check_flags
or self.component.source_translation.unit_set.filter(
extra_flags__contains="safe-html"
).exists()
)
def get_doc_url(self, user=None):
return get_doc_url("user/checks", "check-safe-html", user=user)

@juhjuhjuhgian
Copy link

Hey @nijel I'm new to open source so I have to ask: if this (or any other issue) has been assigned, does this mean it's off limits to work on by other devs? Having trouble finding one to work on as they're all "spoken for."

Thanks!

@nijel
Copy link
Member Author

nijel commented Jul 12, 2023

@juhjuhjuhgian It is usually a good idea to not waste effort and pick another issue. I think there is enough of unassigned issues in good first issue Opportunity for newcoming contributors.

@nijel nijel self-assigned this Dec 18, 2023
@nijel nijel added this to the 5.4 milestone Dec 18, 2023
@nijel nijel closed this as completed in e54c49a Dec 18, 2023
Copy link

Thank you for your report; the issue you have reported has just been fixed.

  • In case you see a problem with the fix, please comment on this issue.
  • In case you see a similar problem, please open a separate issue.
  • If you are happy with the outcome, don’t hesitate to support Weblate by making a donation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adding or requesting a new feature. good first issue Opportunity for newcoming contributors. hacktoberfest This is suitable for Hacktoberfest. Don’t try to spam. help wanted Extra attention is needed.
Projects
None yet
Development

No branches or pull requests

3 participants