-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add png status badge #6221
Comments
This issue has been put aside. It is currently unclear if it will ever be implemented as it seems to cover too narrow of a use case or doesn't seem to fit into Weblate. Please try to clarify the use case or consider proposing something more generic to make it useful to more users. |
If you're not certain if you'd like to include this, I can make a PR to badges/shields instead? (shields.io) I'm already looking at the API endpoints, and can make a couple of badges for total users, total projects, translation status, etc. That would also resolve the problem this request was looking to solve, as shields.io allows both SVG and PNG badges. Plus I can just use the SVG badge anyway as shields.io is one of the trusted sources for the Visual Studio Code Marketplace. If this suits you more, you're welcome to close this. I can also drop a comment when the badges are added to shields.io. Edit: Created a PR in shields.io. |
It is SVG rendered into PNG using rsvg, which is already pulled as a dependency for Pango/Cairo stack. Fixes WeblateOrg#6221
It is SVG rendered into PNG using rsvg, which is already pulled as a dependency for Pango/Cairo stack. Fixes WeblateOrg#6221
It is SVG rendered into PNG using rsvg, which is already pulled as a dependency for Pango/Cairo stack. Fixes WeblateOrg#6221
It is SVG rendered into PNG using rsvg, which is already pulled as a dependency for Pango/Cairo stack. Fixes #6221
Is your feature request related to a problem? If so, please describe.
On certain sites, we aren't allowed to use SVG files unless they're from trusted sources.
For my particular case, it's the Visual Studio Code Marketplace, which disallows SVGs for security reasons. (More Info)
Describe the solution you'd like
Could we have a separate URL that generates a PNG version of
SVGBadgeWidget
?Then there could be 2 versions:
/widgets/{project-name}/-/status-badge.svg
//widgets/{project-name}/-/svg-badge.svg
/widgets/{project-name}/-/status-badge.png
Additional context
I think a nice way might be to add a utility in the
weblate.utils
module to convert an SVG to PNG in memory?This way it's really efficient to build the image because it's just inserting variables into XML, and can be converted into the PNG as a final step.
Otherwise, it could be fine to just build the image like any of the other raster/bitmap widgets?
The rest is only relevant if there is a way to convert an SVG with CSS/JavaScript to a PNG. I was just playing with SVGs, but had issues rasterizing them. Just noting the thoughts here.
I've tried looking a bit, but it seems most aren't able to handle things like
<style>
or<foreignObject>
.If there is a way to achieve this, then this approach could be used to resolve other issues in the repository as well.
#4198 (comment) - If this used an SVG base, then one can just use getComputedTextWidth to size the button according to the text.
#6219 - If this used an SVG base, then one can just use CSS to truncate and use an ellipsis.
The text was updated successfully, but these errors were encountered: