{"action":"created","issue":{"url":"https://api.github.com/repos/eggpi/citationhunt/issues/91","repository_url":"https://api.github.com/repos/eggpi/citationhunt","labels_url":"https://api.github.com/repos/eggpi/citationhunt/issues/91/labels{/name}","comments_url":"https://api.github.com/repos/eggpi/citationhunt/issues/91/comments","events_url":"https://api.github.com/repos/eggpi/citationhunt/issues/91/events","html_url":"https://github.com/eggpi/citationhunt/issues/91","id":213427923,"number":91,"title":"Choose strings for the UI using the Accept-Language header.","user":{"login":"eggpi","id":489134,"avatar_url":"https://avatars3.githubusercontent.com/u/489134?v=3","gravatar_id":"","url":"https://api.github.com/users/eggpi","html_url":"https://github.com/eggpi","followers_url":"https://api.github.com/users/eggpi/followers","following_url":"https://api.github.com/users/eggpi/following{/other_user}","gists_url":"https://api.github.com/users/eggpi/gists{/gist_id}","starred_url":"https://api.github.com/users/eggpi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eggpi/subscriptions","organizations_url":"https://api.github.com/users/eggpi/orgs","repos_url":"https://api.github.com/users/eggpi/repos","events_url":"https://api.github.com/users/eggpi/events{/privacy}","received_events_url":"https://api.github.com/users/eggpi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-03-10T19:18:20Z","updated_at":"2017-03-13T21:23:00Z","closed_at":null,"body":"Right now we [couple](https://github.com/eggpi/citationhunt/blob/4c3d3486c4094837de9029bdf22d1820701b73ef/config.py#L613-L615) the language config with the strings that will be used in the UI.\r\n\r\nThis doesn't make a lot of sense for Wikipedias where a single config applies to more than one language (e.g., zhwiki, for which we have zh-hant and zh-hans translations, or ptwiki, which we can serve using pt or pt-br).\r\n\r\nWe should undo that decoupling and allow `app.py` to request the strings dynamically based on the `Accept-Language` header. Flask-Babel has nice support for that, though it would be nice to look at alternatives if there are any."},"comment":{"url":"https://api.github.com/repos/eggpi/citationhunt/issues/comments/286248131","html_url":"https://github.com/eggpi/citationhunt/issues/91#issuecomment-286248131","issue_url":"https://api.github.com/repos/eggpi/citationhunt/issues/91","id":286248131,"user":{"login":"eggpi","id":489134,"avatar_url":"https://avatars3.githubusercontent.com/u/489134?v=3","gravatar_id":"","url":"https://api.github.com/users/eggpi","html_url":"https://github.com/eggpi","followers_url":"https://api.github.com/users/eggpi/followers","following_url":"https://api.github.com/users/eggpi/following{/other_user}","gists_url":"https://api.github.com/users/eggpi/gists{/gist_id}","starred_url":"https://api.github.com/users/eggpi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eggpi/subscriptions","organizations_url":"https://api.github.com/users/eggpi/orgs","repos_url":"https://api.github.com/users/eggpi/repos","events_url":"https://api.github.com/users/eggpi/events{/privacy}","received_events_url":"https://api.github.com/users/eggpi/received_events","type":"User","site_admin":false},"created_at":"2017-03-13T21:23:00Z","updated_at":"2017-03-13T21:23:00Z","body":"Thanks for commenting!\r\n\r\n> When displayed, they will be mapped into the variant user specified.\r\n\r\nDo you know how this mapping happens on Wikipedia? Can we use the MediaWiki API to make that conversion?\r\n\r\n>  It would be just OK to request the rendered text based on the config.\r\n\r\nSorry, I'm a little confused with this suggestion.\r\n\r\nIn b811422fc4e83cff47b82c3d940df1a1bea6e76f, I am suggesting this behavior:\r\n\r\n- If you go to tools.wmflabs.org/citationhunt (without the **zh**), and you have `zh-*` in your `Accept-Language`, you will get redirected to tools.wmflabs.org/citationhunt/**zh**.\r\n- If you go to tools.wmflabs.org/citationhunt/**zh**:\r\n  - If you have `zh-hans` in your `Accept-Language`, the interface will use the strings in [zh-hans.json](https://github.com/eggpi/citationhunt/blob/master/chstrings/zh-hans.json). Same for zh-hant. We only have zh-hans and zh-hant translations for the interface right now.\r\n  - If you don't have any of those in your `Accept-Language`, we use `zh-hans.json`.\r\n\r\nBut that only changes the text in the interface (for example, the buttons). The Wikipedia text is the same in all cases and comes directly from the wikitext.\r\n\r\nDo you think that is a bad idea?\r\n\r\nI would still like to do something like that because of other locales (en/en-GB, pt/pt-br), but if it is a bad idea for zh, I will be happy to change it, of course."}}
{"actor":{"display_login":"eggpi"}}