Add translation filter#667
Conversation
|
Visit the preview URL for this PR (updated for commit f538fb4): https://beeware-org--pr667-translation-filter-7777u20d.web.app (expires Mon, 23 Jun 2025 06:50:50 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: b0da44bc067e7d9a4255c77cb2c5fce572218cec |
freakboy3742
left a comment
There was a problem hiding this comment.
This is an amazing cleanup - and at gives us a non-trivial reason for keeping the beeware plugin around. Nice work!
|
|
||
|
|
||
| @pass_context | ||
| def translate(context, string, bag_name="translate"): |
johnzhou721
left a comment
There was a problem hiding this comment.
Some notes mostly about Chinese.
| home = 首页 | ||
| edit_on_github = 在GitHub上编辑 | ||
| edit_translation = 在 Weblate 上翻译 | ||
| edit_translation = 在Weblate上翻译 |
There was a problem hiding this comment.
FYI this is to stay consistent with GitHub message but wouldn’t hurt if we added white spaces (and may look better but a little too long…)
There was a problem hiding this comment.
I imagine we'll all defer to your judgment on that, either way!
There was a problem hiding this comment.
I honestly have no idea… in regular text it’s probably better to have spaces but will it appear too loose on the top?
There was a problem hiding this comment.
No space is better when rendered.
| <p>{{ "event_more_info"|trans }} <a href="{{ this.url }}">{{ this.title }} {{ "website"|trans }}</a>.</p> | ||
| <h3>{{ "what_is_a_sprint"|trans }}</h3> | ||
| {%- set post = "post_sprint_pycon_video"|trans %} | ||
| <p>{{ "sprint_description"|trans }} <a href="https://www.youtube.com/watch?v=hOtKgFaFcz0">{{ "sprint_pycon_video"|trans }}</a>{% if post %} {% endif %}{{ post }}.</p> |
There was a problem hiding this comment.
Chinese etc probably needs a full width period — might be worth adding a punctuation filter in plugin.
There was a problem hiding this comment.
I hadn't thought about that. If we ever add Japanese, I know it has its own period, and some languages don't use them at all. We should probably move the period into the translated string (here and elsewhere).
There was a problem hiding this comment.
Really, it would be ideal if the template could define any necessary links, and the translations could freely place them as needed within one larger string... 🤔
There was a problem hiding this comment.
Weblate can't see changes made via PR to translation .lr files, can it? It would be really useful for batch updates...
There was a problem hiding this comment.
@HalfWhitt yes it can with some delay it’d be safe to lock it for a few hours to eliminate conflicts
There was a problem hiding this comment.
Sorry I read it wrong, thought you meant translation .po files, .lr files Weblate probably doesn't even support
Updates translate.ini to finish up #663, and adds a translation filter to cut down on boilerplate.
For the most part, the only changes to the actual generated HTML are in the whitespace, but I also fixed a few small things like a missing period after the sprint video link, links to podcast episodes, and subject-verb agreement in the incomplete page notice.
PR Checklist: