{"action":"created","issue":{"url":"https://api.github.com/repos/yahoo/intl-messageformat/issues/113","labels_url":"https://api.github.com/repos/yahoo/intl-messageformat/issues/113/labels{/name}","comments_url":"https://api.github.com/repos/yahoo/intl-messageformat/issues/113/comments","events_url":"https://api.github.com/repos/yahoo/intl-messageformat/issues/113/events","html_url":"https://github.com/yahoo/intl-messageformat/issues/113","id":106173005,"number":113,"title":"support for nested/hierarchal properties in replacement variables","user":{"login":"redbugz","id":63466,"avatar_url":"https://avatars.githubusercontent.com/u/63466?v=3","gravatar_id":"","url":"https://api.github.com/users/redbugz","html_url":"https://github.com/redbugz","followers_url":"https://api.github.com/users/redbugz/followers","following_url":"https://api.github.com/users/redbugz/following{/other_user}","gists_url":"https://api.github.com/users/redbugz/gists{/gist_id}","starred_url":"https://api.github.com/users/redbugz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redbugz/subscriptions","organizations_url":"https://api.github.com/users/redbugz/orgs","repos_url":"https://api.github.com/users/redbugz/repos","events_url":"https://api.github.com/users/redbugz/events{/privacy}","received_events_url":"https://api.github.com/users/redbugz/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-09-12T17:14:03Z","updated_at":"2015-12-07T21:49:09Z","closed_at":"2015-09-15T19:56:05Z","body":"There are times would it be handy to resolve a nested/hierarchal property or key path.\r\n```\r\nnew IntlMessageFormat('{a.key.path}').format({a:{key:{path:'value'}}});\r\n```\r\nBut we get an error that periods are not allowed. However, dashes are allowed\r\n```\r\n> new IntlMessageFormat('{parent-child}').format({\"parent-child\":'child'});\r\n'child'\r\n```\r\nI recognize this would lead to potential ambiguities, but they could be handled via policy or configuration if this is generally desirable feature.\r\nWe are looking at replacing some our existing i18n functions that do support this, but this would require us to do some special pre-processing to flatten our data structures for replacement.\r\n\r\nI'm just curious if this is feasible to allow this. I can probably do the PR to allow it, if it's decided it's a good idea and the rules for resolving the paths are clear. Obviously there are potential issues.\r\n```\r\nvar data = {\r\n  \"parent\": {\r\n    \"child\": \"I am a parent.child value\"\r\n  },\r\n  \"parent.child\": \"I am also a parent.child value, depending on implementation\",\r\n  \"parent-child\": \"This is allowed today, as dashes are supported, but periods are not\"\r\n}\r\n```\r\nJust curious what the thoughts are about this."},"comment":{"url":"https://api.github.com/repos/yahoo/intl-messageformat/issues/comments/162675406","html_url":"https://github.com/yahoo/intl-messageformat/issues/113#issuecomment-162675406","issue_url":"https://api.github.com/repos/yahoo/intl-messageformat/issues/113","id":162675406,"user":{"login":"amccloud","id":38463,"avatar_url":"https://avatars.githubusercontent.com/u/38463?v=3","gravatar_id":"","url":"https://api.github.com/users/amccloud","html_url":"https://github.com/amccloud","followers_url":"https://api.github.com/users/amccloud/followers","following_url":"https://api.github.com/users/amccloud/following{/other_user}","gists_url":"https://api.github.com/users/amccloud/gists{/gist_id}","starred_url":"https://api.github.com/users/amccloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amccloud/subscriptions","organizations_url":"https://api.github.com/users/amccloud/orgs","repos_url":"https://api.github.com/users/amccloud/repos","events_url":"https://api.github.com/users/amccloud/events{/privacy}","received_events_url":"https://api.github.com/users/amccloud/received_events","type":"User","site_admin":false},"created_at":"2015-12-07T21:49:09Z","updated_at":"2015-12-07T21:49:09Z","body":"@redbugz\r\n\r\n**This works:**\r\n```js\r\nlet data = {\r\n  world: {city: 'Las Vegas'},\r\n  // ... and much more data\r\n};\r\n\r\nlet formatter = new IntlMessageFormat('Hello {world/city}', 'en');\r\nformatter.format(flatten(data, {delimiter: '/'})); // => \"Hello Las Vegas\"\r\n```\r\n\r\n**This doesn't work:**\r\n\r\n```js\r\nlet data = {\r\n  world: {city: 'Las Vegas'},\r\n  // ... and much more data\r\n};\r\n\r\nlet formatter = new IntlMessageFormat('Hello {world.city}', 'en');\r\nformatter.format(flatten(data, {delimiter: '.'})); // => \"Hello Las Vegas\"\r\n```\r\n\r\n@caridy @SlexAxton Is there a reason why `.` is not treated just like `/` or `-`?"}}