{"action":"created","issue":{"url":"https://api.github.com/repos/TabbycatDebate/tabbycat/issues/387","repository_url":"https://api.github.com/repos/TabbycatDebate/tabbycat","labels_url":"https://api.github.com/repos/TabbycatDebate/tabbycat/issues/387/labels{/name}","comments_url":"https://api.github.com/repos/TabbycatDebate/tabbycat/issues/387/comments","events_url":"https://api.github.com/repos/TabbycatDebate/tabbycat/issues/387/events","html_url":"https://github.com/TabbycatDebate/tabbycat/issues/387","id":177352310,"number":387,"title":"Translation support","user":{"login":"czlee","id":1725499,"avatar_url":"https://avatars2.githubusercontent.com/u/1725499?v=4","gravatar_id":"","url":"https://api.github.com/users/czlee","html_url":"https://github.com/czlee","followers_url":"https://api.github.com/users/czlee/followers","following_url":"https://api.github.com/users/czlee/following{/other_user}","gists_url":"https://api.github.com/users/czlee/gists{/gist_id}","starred_url":"https://api.github.com/users/czlee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/czlee/subscriptions","organizations_url":"https://api.github.com/users/czlee/orgs","repos_url":"https://api.github.com/users/czlee/repos","events_url":"https://api.github.com/users/czlee/events{/privacy}","received_events_url":"https://api.github.com/users/czlee/received_events","type":"User","site_admin":false},"labels":[{"id":86504982,"url":"https://api.github.com/repos/TabbycatDebate/tabbycat/labels/feature","name":"feature","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/TabbycatDebate/tabbycat/milestones/30","html_url":"https://github.com/TabbycatDebate/tabbycat/milestone/30","labels_url":"https://api.github.com/repos/TabbycatDebate/tabbycat/milestones/30/labels","id":2754493,"number":30,"title":"Japanese Bobtail","description":"Rounding out BP support by improving feature parity along with minor additional quality of life features. Aim for Feb/March release.","creator":{"login":"philipbelesky","id":495961,"avatar_url":"https://avatars0.githubusercontent.com/u/495961?v=4","gravatar_id":"","url":"https://api.github.com/users/philipbelesky","html_url":"https://github.com/philipbelesky","followers_url":"https://api.github.com/users/philipbelesky/followers","following_url":"https://api.github.com/users/philipbelesky/following{/other_user}","gists_url":"https://api.github.com/users/philipbelesky/gists{/gist_id}","starred_url":"https://api.github.com/users/philipbelesky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philipbelesky/subscriptions","organizations_url":"https://api.github.com/users/philipbelesky/orgs","repos_url":"https://api.github.com/users/philipbelesky/repos","events_url":"https://api.github.com/users/philipbelesky/events{/privacy}","received_events_url":"https://api.github.com/users/philipbelesky/received_events","type":"User","site_admin":false},"open_issues":20,"closed_issues":7,"state":"open","created_at":"2017-09-09T12:02:11Z","updated_at":"2018-01-30T23:55:05Z","due_on":null,"closed_at":null},"comments":8,"created_at":"2016-09-16T06:13:49Z","updated_at":"2018-02-05T22:38:58Z","closed_at":null,"author_association":"OWNER","body":"First effort is in 65714e60a20b31f0b85844b333d21fc7fb0ec613. Here are my thoughts:\n\nIt's not quite as bad as I thought it would be, but doing this for the whole project (making it translatable, not doing the actual translation) would still be a concerted effort, especially bearing in mind that I did one of the easier apps. There are a number of features that I would've thought close to essential abstractions for translation that Django doesn't seem to support very well. So simple cases are simple, but more complex cases take effort.\n\nIt would also require us to have a bit more discipline in how we lay out templates and construct strings in Python—for example, we'd want to keep `<p>` on a separate line to the text in the paragraph so that `{% blocktrans %}` has a nice place to live, and we'd have to get into the habit of using `\"Hello %(name)s\" % {'name': name}\"` to construct string rather than `\"Hello %s!\"` or `\"Hello \" + name + \"!\"`. But that's probably a good thing.\n\nPython:\n- The majority of this is just wrapping strings in `_(...)`.\n- _All_ models, fields and apps need to have verbose names _explicitly_ added, and wrapped in `_(...)`. Translation won't pick up on default verbose names. This might be a little annoying, but seems to be standard practice in third-party and `django.contrib` apps.\n- As mentioned above, we'll need to convert some strings to be constructed with `%(...)s` rather than `%s` or the concatenation operator (+)\n- New-style `{varname}` formatting is allowed, but doesn't seem to be favoured by Django. Maybe we should convert all existing strings out of it.\n\nTemplates:\n- In many circumstances, the `{% trans %}` and `{% blocktrans %}` tags work fine. I thought they would be annoying, but most of the time the amount of actual text in a template is much less than I realised.\n- It gets messy where there's [a link in the middle of a sentence](https://github.com/czlee/tabbycat/blob/65714e60a20b31f0b85844b333d21fc7fb0ec613/tabbycat/tournaments/templates/tournament_index.html#L19-L24), and the internet doesn't seem to have a satisfying way of dealing with it.\n  - It's probably easiest to use `{% url 'thing' as name %}`, and just to put HTML tags inside translation strings. In some circles this is frowned upon, because translators aren't meant to have to worry about HTML syntax and the like, but I think all the alternatives would be worse.\n  - The `{% tournament_url %}` and `{% round_url %}` template tags don't support the \"as\" option of the standard `{% url %}` tag, and need to be modified to do so.\n- For an example of where we need to rethink how we construct strings: [the first sentence in the footer](https://github.com/czlee/tabbycat/blob/65714e60a20b31f0b85844b333d21fc7fb0ec613/tabbycat/templates/footer.html#L26-L31) is a nightmare to put through a translator effectively. In fact, it's not even obvious how to do it \"properly\", since it includes complex internal fields, like the part rendering \"Tabbycat 1.1.3 (Egyptian Mau)\", which to a translator can be abstractor as one string but which takes some amount of template logic to construct. Ideally templates would provide a way to store this in a local variable, but they don't. One way around this is to construct it in Python, but I'm not sure that works so well for the footer.\n\nThere's also JavaScript, which I didn't look at.\n\nOne last thing: Partly because I think the most difficult strings to translate are the logging strings, I'm of the view that we just shouldn't translate anything printed to logs—only strings that render on web pages should be translatable. For example, I was concerned about how [pluralization](https://docs.djangoproject.com/en/1.10/topics/i18n/translation/#pluralization) does (or does not!) work with translation, but then I realized that the circumstances where you want to pluralize a general word in a sentence (as opposed to an entire sentence whose pluralized noun is known in advance) basically only occur in logging output.\n"},"comment":{"url":"https://api.github.com/repos/TabbycatDebate/tabbycat/issues/comments/363245707","html_url":"https://github.com/TabbycatDebate/tabbycat/issues/387#issuecomment-363245707","issue_url":"https://api.github.com/repos/TabbycatDebate/tabbycat/issues/387","id":363245707,"user":{"login":"philipbelesky","id":495961,"avatar_url":"https://avatars0.githubusercontent.com/u/495961?v=4","gravatar_id":"","url":"https://api.github.com/users/philipbelesky","html_url":"https://github.com/philipbelesky","followers_url":"https://api.github.com/users/philipbelesky/followers","following_url":"https://api.github.com/users/philipbelesky/following{/other_user}","gists_url":"https://api.github.com/users/philipbelesky/gists{/gist_id}","starred_url":"https://api.github.com/users/philipbelesky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philipbelesky/subscriptions","organizations_url":"https://api.github.com/users/philipbelesky/orgs","repos_url":"https://api.github.com/users/philipbelesky/repos","events_url":"https://api.github.com/users/philipbelesky/events{/privacy}","received_events_url":"https://api.github.com/users/philipbelesky/received_events","type":"User","site_admin":false},"created_at":"2018-02-05T22:38:58Z","updated_at":"2018-02-05T22:38:58Z","author_association":"COLLABORATOR","body":"No, as per above it doesn't recognise marked strings in vue files:\r\n\r\n    $ django-admin makemessages -d djangojs -e vue -l fr\r\n\r\n...will fail at parsing/identifying strings using the provided js equivalents of `gettext` etc"}}
{"actor":{"display_login":"philipbelesky"}}