{"action":"created","issue":{"url":"https://api.github.com/repos/reactjs/React.NET/issues/62","repository_url":"https://api.github.com/repos/reactjs/React.NET","labels_url":"https://api.github.com/repos/reactjs/React.NET/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/reactjs/React.NET/issues/62/comments","events_url":"https://api.github.com/repos/reactjs/React.NET/issues/62/events","html_url":"https://github.com/reactjs/React.NET/issues/62","id":53131984,"number":62,"title":"Insert localization string on the fly","user":{"login":"slav","id":350987,"avatar_url":"https://avatars.githubusercontent.com/u/350987?v=3","gravatar_id":"","url":"https://api.github.com/users/slav","html_url":"https://github.com/slav","followers_url":"https://api.github.com/users/slav/followers","following_url":"https://api.github.com/users/slav/following{/other_user}","gists_url":"https://api.github.com/users/slav/gists{/gist_id}","starred_url":"https://api.github.com/users/slav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slav/subscriptions","organizations_url":"https://api.github.com/users/slav/orgs","repos_url":"https://api.github.com/users/slav/repos","events_url":"https://api.github.com/users/slav/events{/privacy}","received_events_url":"https://api.github.com/users/slav/received_events","type":"User","site_admin":false},"labels":[{"id":106366196,"url":"https://api.github.com/repos/reactjs/React.NET/labels/Needs%20Info","name":"Needs Info","color":"5319e7","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2014-12-30T17:33:35Z","updated_at":"2016-11-04T11:56:27Z","closed_at":"2015-04-12T04:33:45Z","body":".NET has quite powerful support for string localization via resources and automatic string insertion depending on the currently selected localization resource.\n\nI'm wondering if it's possible to take advantage of this mechanism in reactjs.net to make text in components localizable and easy to translate? \n"},"comment":{"url":"https://api.github.com/repos/reactjs/React.NET/issues/comments/258413123","html_url":"https://github.com/reactjs/React.NET/issues/62#issuecomment-258413123","issue_url":"https://api.github.com/repos/reactjs/React.NET/issues/62","id":258413123,"user":{"login":"Hekku2","id":2670916,"avatar_url":"https://avatars.githubusercontent.com/u/2670916?v=3","gravatar_id":"","url":"https://api.github.com/users/Hekku2","html_url":"https://github.com/Hekku2","followers_url":"https://api.github.com/users/Hekku2/followers","following_url":"https://api.github.com/users/Hekku2/following{/other_user}","gists_url":"https://api.github.com/users/Hekku2/gists{/gist_id}","starred_url":"https://api.github.com/users/Hekku2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hekku2/subscriptions","organizations_url":"https://api.github.com/users/Hekku2/orgs","repos_url":"https://api.github.com/users/Hekku2/repos","events_url":"https://api.github.com/users/Hekku2/events{/privacy}","received_events_url":"https://api.github.com/users/Hekku2/received_events","type":"User","site_admin":false},"created_at":"2016-11-04T11:56:27Z","updated_at":"2016-11-04T11:56:27Z","body":"I also ran into this issue while investigating if I can use this with current project.\r\n\r\nCurrently one way to use localizations strings is to render partial .cshtml-file which has script section where translations are used.\r\n\r\nI think this way is ugly and it would be very laborious to use for every text element in page. And if someone knows better way, please tell me.\r\n\r\nThis example is from knockout validation localizations \r\n```\r\n<script type=\"text/javascript\">\r\n    if (ko && ko.validation) {\r\n            ko.validation.rules.required.message = \"@Html.Raw(Translations.Validation_Required)\";\r\n            ko.validation.rules.maxLength.message = \"@Html.Raw(Translations.Validation_MaxLength)\";\r\n            ko.validation.rules.digit.message = \"@Html.Raw(Translations.Validation_Digit)\";\r\n    }\r\n</script>\r\n```\r\n\r\nBest way I can come up with is to use translations straight from the jsx-file, which would be ran trough Razor(?) or some kind of \"replace X from resource file\" before compiling/bundling the jsx-file to js-file.\r\n\r\n```\r\nvar WarningComponent= React.createClass({\r\n    render: function() {\r\n        return (\r\n          <div className=\"alert alert-warning\">\r\n            @Translations.Warnings_MissingInformation\r\n          </div>\r\n      );\r\n    }\r\n});\r\n```"}}
{"actor":{"display_login":"Hekku2"}}