{"action":"created","issue":{"url":"https://api.github.com/repos/synacor/preact-i18n/issues/13","repository_url":"https://api.github.com/repos/synacor/preact-i18n","labels_url":"https://api.github.com/repos/synacor/preact-i18n/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/synacor/preact-i18n/issues/13/comments","events_url":"https://api.github.com/repos/synacor/preact-i18n/issues/13/events","html_url":"https://github.com/synacor/preact-i18n/issues/13","id":260996912,"number":13,"title":"Ability to have markup in strings","user":{"login":"billneff79","id":16687204,"avatar_url":"https://avatars3.githubusercontent.com/u/16687204?v=4","gravatar_id":"","url":"https://api.github.com/users/billneff79","html_url":"https://github.com/billneff79","followers_url":"https://api.github.com/users/billneff79/followers","following_url":"https://api.github.com/users/billneff79/following{/other_user}","gists_url":"https://api.github.com/users/billneff79/gists{/gist_id}","starred_url":"https://api.github.com/users/billneff79/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/billneff79/subscriptions","organizations_url":"https://api.github.com/users/billneff79/orgs","repos_url":"https://api.github.com/users/billneff79/repos","events_url":"https://api.github.com/users/billneff79/events{/privacy}","received_events_url":"https://api.github.com/users/billneff79/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-09-27T14:31:19Z","updated_at":"2017-09-27T19:37:32Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"We have use cases where we would like to insert markup inside of a phrase that should be translated as a whole unit, e.g.\r\n`<a href=\"http://example.com>Please click here</a> to open the page`\r\n\r\nAs the system currently works, we would need to construct it as, `<Text id='link.pre'/><a href=\"http://example.com><Text id='link.text'/></a><Text id='link.post'/>` because different languages might translate this sentence akin to `Please, to open the page <a href=\"http://example.com>click here</a>` or other variations of ordering, which forces a before, during, and after markup set of text.  This gets out of control if you have more than one piece of markup in your text.  It also means that a translation service has to try to translate this set of strings:\r\n```\r\nlink.pre=''\r\nlink.text='Please click here'\r\nlink.post='to open the page'\r\n```\r\n\r\nI image that is difficult for a translation service.\r\n\r\nI wonder if this could be solved by simply allowing for markup in the string, and having a boolean flag for something like `<Text id=\"openPage\" dangerouslySetInnerHTML />`"},"comment":{"url":"https://api.github.com/repos/synacor/preact-i18n/issues/comments/332632500","html_url":"https://github.com/synacor/preact-i18n/issues/13#issuecomment-332632500","issue_url":"https://api.github.com/repos/synacor/preact-i18n/issues/13","id":332632500,"user":{"login":"pl12133","id":12724311,"avatar_url":"https://avatars3.githubusercontent.com/u/12724311?v=4","gravatar_id":"","url":"https://api.github.com/users/pl12133","html_url":"https://github.com/pl12133","followers_url":"https://api.github.com/users/pl12133/followers","following_url":"https://api.github.com/users/pl12133/following{/other_user}","gists_url":"https://api.github.com/users/pl12133/gists{/gist_id}","starred_url":"https://api.github.com/users/pl12133/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pl12133/subscriptions","organizations_url":"https://api.github.com/users/pl12133/orgs","repos_url":"https://api.github.com/users/pl12133/repos","events_url":"https://api.github.com/users/pl12133/events{/privacy}","received_events_url":"https://api.github.com/users/pl12133/received_events","type":"User","site_admin":false},"created_at":"2017-09-27T19:37:31Z","updated_at":"2017-09-27T19:37:31Z","author_association":"NONE","body":"This appears to work with the suggestion of `preact-markup`, but with the assistance of `withText` to get a plain string to use as the `markup` attribute:\r\n\r\n```javascript\r\n@withText(({ id }) => ({ markup: <Text id={id} /> })\r\nclass Notify extends Component {\r\n  render({ markup }) {\r\n    assert(markup === 'I am a message <b>with markup!</b>.');\r\n    return (\r\n      <span>\r\n        <Markup markup={markup} type=\"html\" />\r\n      <span>\r\n    );\r\n  }\r\n}\r\n```\r\n\r\nNow I wonder: Should we create a helper component to do this for the user (e.g. `<MarkupText>`) which does this automatically, or should we document this as a recommended solution?"}}
{"actor":{"display_login":"pl12133"}}