{"action":"opened","issue":{"url":"https://api.github.com/repos/tsvetomir/xlf-translate/issues/9","repository_url":"https://api.github.com/repos/tsvetomir/xlf-translate","labels_url":"https://api.github.com/repos/tsvetomir/xlf-translate/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/tsvetomir/xlf-translate/issues/9/comments","events_url":"https://api.github.com/repos/tsvetomir/xlf-translate/issues/9/events","html_url":"https://github.com/tsvetomir/xlf-translate/issues/9","id":386191737,"node_id":"MDU6SXNzdWUzODYxOTE3Mzc=","number":9,"title":"Incompatible with ng-bootstrap i18n enties","user":{"login":"leye0","id":3464994,"node_id":"MDQ6VXNlcjM0NjQ5OTQ=","avatar_url":"https://avatars3.githubusercontent.com/u/3464994?v=4","gravatar_id":"","url":"https://api.github.com/users/leye0","html_url":"https://github.com/leye0","followers_url":"https://api.github.com/users/leye0/followers","following_url":"https://api.github.com/users/leye0/following{/other_user}","gists_url":"https://api.github.com/users/leye0/gists{/gist_id}","starred_url":"https://api.github.com/users/leye0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leye0/subscriptions","organizations_url":"https://api.github.com/users/leye0/orgs","repos_url":"https://api.github.com/users/leye0/repos","events_url":"https://api.github.com/users/leye0/events{/privacy}","received_events_url":"https://api.github.com/users/leye0/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-30T13:39:51Z","updated_at":"2018-11-30T13:39:51Z","closed_at":null,"author_association":"NONE","body":"This issue is the continuity of https://github.com/tsvetomir/xlf-extract/issues/5.\r\n\r\nTo summarize, `ng-bootstrap` trans-units produced by the Angular CLI - `ng x18n` - don't contain `note` tags, where these tools read the `meaning` property to produce an id for the enties.\r\n\r\nTo make it work with the way `ng-bootstrap` entry ids are noted, I had to patch the line where the id it fetched so that it fallbacks to the trans-unit `id` attribute (and comment out the note filter):\r\n\r\n```js\r\n    units\r\n        // .filter(unit => unit.find('note').length > 0) // Fix for ng-bootstrap i18n entries;\r\n        .map(unit => {\r\n            const source = doc(unit).find('source');\r\n            let target = doc(unit).find('target');\r\n            if (target.length === 0 && source.length === 1) {\r\n                target = doc('<target />');\r\n                source.after(indent(source), target);\r\n            }\r\n\r\n            return {\r\n                target: target,\r\n                id: doc(unit).find('note[from=meaning]').text() || (unit.attribs ? unit.attribs['id'] : null) // Fix for ng-bootstrap;\r\n            };\r\n        }) \r\n```\r\n\r\nHere's an `ng-bootstrap` i18n entry:\r\n```xml\r\n      <trans-unit id=\"ngb.timepicker.increment-hours\" datatype=\"html\">\r\n        <source>Increment hours</source>\r\n        <context-group purpose=\"location\">\r\n          <context context-type=\"sourcefile\">../node_modules/@ng-bootstrap/ng-bootstrap/timepicker/timepicker.d.ts</context>\r\n          <context context-type=\"linenumber\">9</context>\r\n        </context-group>\r\n      </trans-unit>\r\n```\r\n\r\nAny better way to make it work?"}}
{"actor":{"display_login":"leye0"}}