DenverCoder1 / github-readme-youtube-cards

Workflow for displaying recent YouTube videos as SVG cards in your readme
https://ytcards.demolab.com
MIT License
197 stars 46 forks source link

feat: Support RTL language titles #144

Closed Vyvy-vi closed 1 year ago

Vyvy-vi commented 1 year ago

Summary

resolves #131

This PR adds support for RTL languages in the youtube card title text.

Type of change

How Has This Been Tested?

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ytcards ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 29, 2023 2:30am
DenverCoder1 commented 1 year ago

In the latest commit the ltr alignment looks perfect, the rtl alignment seems a bit too close to the edge still. I think it should be moved to the left about 10 more pixels.

I think changing line 27 instead of line 31 would make the math more straightforward, but if you do keep the change on line 31 instead, maybe it could be width - 22 or something similar instead of width - 12?

Vyvy-vi commented 1 year ago

Does this look better?

Screenshot 2023-10-27 at 3 56 54 PM
    <g transform="translate({{ width - 12 if rtl_title else 10 }}, {{ height - title_height - 50 }})">
        <text fill="{{ title_color }}" font-family="Roboto, Segoe UI, Ubuntu, Arial, sans-serif"
            font-weight="600" font-size="15px" direction="{{ 'rtl' if rtl_title else 'ltr' }}">
            {% for line in title_lines %}
            <tspan x="0" dy="{{ title_line_height }}px">{{ line }}</tspan>
            {% endfor %}
        </text>
    </g>
DenverCoder1 commented 1 year ago

Thanks for contributing! :tada: