{"action":"created","issue":{"url":"https://api.github.com/repos/elixir-lang/gettext/issues/66","labels_url":"https://api.github.com/repos/elixir-lang/gettext/issues/66/labels{/name}","comments_url":"https://api.github.com/repos/elixir-lang/gettext/issues/66/comments","events_url":"https://api.github.com/repos/elixir-lang/gettext/issues/66/events","html_url":"https://github.com/elixir-lang/gettext/pull/66","id":121694378,"number":66,"title":"[WIP] Add informative comments to new POT files","user":{"login":"whatyouhide","id":3890250,"avatar_url":"https://avatars.githubusercontent.com/u/3890250?v=3","gravatar_id":"","url":"https://api.github.com/users/whatyouhide","html_url":"https://github.com/whatyouhide","followers_url":"https://api.github.com/users/whatyouhide/followers","following_url":"https://api.github.com/users/whatyouhide/following{/other_user}","gists_url":"https://api.github.com/users/whatyouhide/gists{/gist_id}","starred_url":"https://api.github.com/users/whatyouhide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whatyouhide/subscriptions","organizations_url":"https://api.github.com/users/whatyouhide/orgs","repos_url":"https://api.github.com/users/whatyouhide/repos","events_url":"https://api.github.com/users/whatyouhide/events{/privacy}","received_events_url":"https://api.github.com/users/whatyouhide/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-11T11:51:32Z","updated_at":"2015-12-13T19:32:57Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/elixir-lang/gettext/pulls/66","html_url":"https://github.com/elixir-lang/gettext/pull/66","diff_url":"https://github.com/elixir-lang/gettext/pull/66.diff","patch_url":"https://github.com/elixir-lang/gettext/pull/66.patch"},"body":"@josevalim @chrismccord this is a WIP but I'd love some early feedback on the direction this is taking. For now, I only implemented the informative comment for newly generated POT files. There are quite a lot of changes for a simple feature, but we weren't distinguishing new/merged/only old POT files in the extractor, so I had to work on that.\r\n\r\nBtw, I also thought about just checking the list of `{path, pot_contents}` tuples before writing them and adding the comment if it wasn't there, but then people wouldn't have been able to remove the comment. This way, the comment is only added to newly generated POT files (if it's removed and `gettext.extract` is run again, it's not readded).\r\n\r\nRelated to #64."},"comment":{"url":"https://api.github.com/repos/elixir-lang/gettext/issues/comments/164289943","html_url":"https://github.com/elixir-lang/gettext/pull/66#issuecomment-164289943","issue_url":"https://api.github.com/repos/elixir-lang/gettext/issues/66","id":164289943,"user":{"login":"whatyouhide","id":3890250,"avatar_url":"https://avatars.githubusercontent.com/u/3890250?v=3","gravatar_id":"","url":"https://api.github.com/users/whatyouhide","html_url":"https://github.com/whatyouhide","followers_url":"https://api.github.com/users/whatyouhide/followers","following_url":"https://api.github.com/users/whatyouhide/following{/other_user}","gists_url":"https://api.github.com/users/whatyouhide/gists{/gist_id}","starred_url":"https://api.github.com/users/whatyouhide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whatyouhide/subscriptions","organizations_url":"https://api.github.com/users/whatyouhide/orgs","repos_url":"https://api.github.com/users/whatyouhide/repos","events_url":"https://api.github.com/users/whatyouhide/events{/privacy}","received_events_url":"https://api.github.com/users/whatyouhide/received_events","type":"User","site_admin":false},"created_at":"2015-12-13T19:32:57Z","updated_at":"2015-12-13T19:32:57Z","body":"Pushed a new commit that writes informative comments when generating **new** PO files. I had to change quite a lot of things because right now, we're parsing headers as a `PO.Translation` first, then ditching all the comments and metadata and only keeping the raw list of headers. This caused top-of-the-file comments (above the headers) to be discarded, which we don't want as a general rule (regardless of those comments being generated by us or handwritten by translators).\r\n\r\nSo, I couldn't come up with a better way than adding a `:top_of_the_file_comments` (ugh, bad name) field to the `%PO{}` struct; this is filled out in `PO.parse_string/1` because the parser now returns `{:ok, top_comments, headers, translations}` instead of `{:ok, headers, translations}`.\r\n\r\nAs of the last commit, when new PO files are generated the informative comment is inserted but whenever they're re-written (because of merging or by the user), it's not added again (so if the user removes it, it stays removed).\r\n\r\nWdyt? /cc @josevalim @lexmag "}}