{"action":"created","issue":{"url":"https://api.github.com/repos/htacg/tidy-html5/issues/328","labels_url":"https://api.github.com/repos/htacg/tidy-html5/issues/328/labels{/name}","comments_url":"https://api.github.com/repos/htacg/tidy-html5/issues/328/comments","events_url":"https://api.github.com/repos/htacg/tidy-html5/issues/328/events","html_url":"https://github.com/htacg/tidy-html5/pull/328","id":119336971,"number":328,"title":"Localized strings","user":{"login":"balthisar","id":3053246,"avatar_url":"https://avatars.githubusercontent.com/u/3053246?v=3","gravatar_id":"","url":"https://api.github.com/users/balthisar","html_url":"https://github.com/balthisar","followers_url":"https://api.github.com/users/balthisar/followers","following_url":"https://api.github.com/users/balthisar/following{/other_user}","gists_url":"https://api.github.com/users/balthisar/gists{/gist_id}","starred_url":"https://api.github.com/users/balthisar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/balthisar/subscriptions","organizations_url":"https://api.github.com/users/balthisar/orgs","repos_url":"https://api.github.com/users/balthisar/repos","events_url":"https://api.github.com/users/balthisar/events{/privacy}","received_events_url":"https://api.github.com/users/balthisar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-11-29T04:58:56Z","updated_at":"2015-12-01T13:33:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/htacg/tidy-html5/pulls/328","html_url":"https://github.com/htacg/tidy-html5/pull/328","diff_url":"https://github.com/htacg/tidy-html5/pull/328.diff","patch_url":"https://github.com/htacg/tidy-html5/pull/328.patch"},"body":"- Added a new means of retrieving Tidy strings with an eye toward localization.\r\n- Sample string is added to demonstrate functionality.\r\n- There may be some edge cases to adjust to later.\r\n\r\nDon't actually merge this, please!\r\n\r\nIn this \"preview\" I've written a substitute string retrieval system that can be used to localize Tidy. Currently the only output merged to the new system is the missing semicolon entity error, but I imagine all of the output can transitioned. I've also replaced a lot of the defines with an enum, and will probably do the same for some of the other sets, as well as add lookup keys for them (currently some of them are used as bit fields, so I can't use their values to look up strings).\r\n\r\nIn the long run localize.c probably becomes message.c (it looks like it may have been originally), and all strings are loaded from a common source.\r\n\r\nThe approach I took might seem a bit odd at first, and it sacrifices library size as languages are added for the simplicity of not having to curate separate language dylibs. String lookup speed should be nearly identical to current methods but could be optimized in the future (someone early this year added a lot of hashing functions to libtidy).\r\n\r\nAnyway, have a look.\r\n"},"comment":{"url":"https://api.github.com/repos/htacg/tidy-html5/issues/comments/160969930","html_url":"https://github.com/htacg/tidy-html5/pull/328#issuecomment-160969930","issue_url":"https://api.github.com/repos/htacg/tidy-html5/issues/328","id":160969930,"user":{"login":"balthisar","id":3053246,"avatar_url":"https://avatars.githubusercontent.com/u/3053246?v=3","gravatar_id":"","url":"https://api.github.com/users/balthisar","html_url":"https://github.com/balthisar","followers_url":"https://api.github.com/users/balthisar/followers","following_url":"https://api.github.com/users/balthisar/following{/other_user}","gists_url":"https://api.github.com/users/balthisar/gists{/gist_id}","starred_url":"https://api.github.com/users/balthisar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/balthisar/subscriptions","organizations_url":"https://api.github.com/users/balthisar/orgs","repos_url":"https://api.github.com/users/balthisar/repos","events_url":"https://api.github.com/users/balthisar/events{/privacy}","received_events_url":"https://api.github.com/users/balthisar/received_events","type":"User","site_admin":false},"created_at":"2015-12-01T13:33:24Z","updated_at":"2015-12-01T13:33:24Z","body":"So my original idea was to tie into setting the `language` option, but a more careful look at the source code makes me think (1) this is a stupid idea, and (2) we should delete the `language` option entirely.\r\n\r\nAddressing point (2) first, I can't think of a single use case for its existence. It's tied to `SUPPORT_ASIAN_ENCODINGS` but actually has no function, and for point (1) we obviously can't tie the output language to a compiler conditional. It also seems like a bad idea to specify a program's language as being an \"option.\"\r\n\r\nThis leaves us with a couple of options, but I'm not sure what expectations that `libtidy` users have over libtidy's behavior. On systems I develop on (Mac OS X) frameworks automatically support the user's locale if the framework includes that localization, regardless of the application using the framework (a framework is an abstraction for a set of libraries).\r\n\r\n• Should libtidy, then, try to determine its current locale and set the output language accordingly? Or,\r\n• Should libtidy use the default `en` and only switch output languages when told to by an implementing application?\r\n\r\nI kind of favor the second option is it gives the application developer a choice.\r\n\r\nThen what about the console application? I think it should automatically adapt to the locale, perhaps with an option to force the default English.\r\n\r\nPerhaps this whole thing is short sighted in that we don't actually _have_ any localizations available yet, but I'm hopeful we can attract international volunteers when it becomes essentially effortless to implement a localization (which the current state of this experimental branch manages quite effectively).\r\n\r\nAnyway, this is a pretty significant change to some of Tidy's architecture, so some feedback is welcome.\r\n"}}