{"action":"created","comment":{"url":"https://api.github.com/repos/OpenXRay/xray-16/pulls/comments/233877590","pull_request_review_id":175385146,"id":233877590,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMzg3NzU5MA==","diff_hunk":"@@ -30,8 +33,41 @@ void CStringTable::Init()\n \n     pData = new STRING_TABLE_DATA();\n \n+    if (gLanguagesToken.size() == 0)\n+    {\n+        u32 lineCount = pSettings->line_count(\"Languages\");\n+        if (lineCount == 0)\n+            R_ASSERT2(false, \"Section \\\"Languages\\\" is empty!\");\n+\n+        LPCSTR lineName, lineVal;\n+        for (u16 i = 0; i < lineCount; i++)\n+        {\n+            pSettings->r_line(\"Languages\", i, &lineName, &lineVal);\n+            gLanguagesToken.emplace_back(lineName, i);\n+        }\n+        gLanguagesToken.emplace_back(nullptr, -1);\n+    }\n+\n     //имя языка, если не задано (NULL), то первый <text> в <string> в XML\n-    pData->m_sLanguage = pSettings->r_string(\"string_table\", \"language\");\n+    if (gLanguage != (u32)-1)\n+        pData->m_sLanguage = gLanguagesToken.at(gLanguage).name;\n+    else\n+    {\n+        pData->m_sLanguage = pSettings->r_string(\"string_table\", \"language\");\n+        bool found = false;\n+        for (const auto& it : gLanguagesToken)\n+        {\n+            if (it.name && it.name == pData->m_sLanguage)\n+            {\n+                gLanguage = it.id;\n+                found = true;\n+                break;\n+            }\n+        }\n+\n+        if (!found)\n+            R_ASSERT2(false, \"Check localization.ltx\");\n+    }","path":"src/xrGame/string_table.cpp","position":49,"original_position":49,"commit_id":"19412b5700cfca980dc9e589c2b24c32659d432c","original_commit_id":"19412b5700cfca980dc9e589c2b24c32659d432c","user":{"login":"FreeZoneMods","id":23636664,"node_id":"MDQ6VXNlcjIzNjM2NjY0","avatar_url":"https://avatars0.githubusercontent.com/u/23636664?v=4","gravatar_id":"","url":"https://api.github.com/users/FreeZoneMods","html_url":"https://github.com/FreeZoneMods","followers_url":"https://api.github.com/users/FreeZoneMods/followers","following_url":"https://api.github.com/users/FreeZoneMods/following{/other_user}","gists_url":"https://api.github.com/users/FreeZoneMods/gists{/gist_id}","starred_url":"https://api.github.com/users/FreeZoneMods/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FreeZoneMods/subscriptions","organizations_url":"https://api.github.com/users/FreeZoneMods/orgs","repos_url":"https://api.github.com/users/FreeZoneMods/repos","events_url":"https://api.github.com/users/FreeZoneMods/events{/privacy}","received_events_url":"https://api.github.com/users/FreeZoneMods/received_events","type":"User","site_admin":false},"body":"I think that lines 36-70 are definitely look like a reason for creating a separate class for incapsulation the logic of managing locales.","created_at":"2018-11-15T15:03:14Z","updated_at":"2018-11-15T15:05:01Z","html_url":"https://github.com/OpenXRay/xray-16/pull/277#discussion_r233877590","pull_request_url":"https://api.github.com/repos/OpenXRay/xray-16/pulls/277","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/OpenXRay/xray-16/pulls/comments/233877590"},"html":{"href":"https://github.com/OpenXRay/xray-16/pull/277#discussion_r233877590"},"pull_request":{"href":"https://api.github.com/repos/OpenXRay/xray-16/pulls/277"}}},"pull_request":{"url":"https://api.github.com/repos/OpenXRay/xray-16/pulls/277","id":231171802,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMxMTcxODAy","html_url":"https://github.com/OpenXRay/xray-16/pull/277","diff_url":"https://github.com/OpenXRay/xray-16/pull/277.diff","patch_url":"https://github.com/OpenXRay/xray-16/pull/277.patch","issue_url":"https://api.github.com/repos/OpenXRay/xray-16/issues/277","number":277,"state":"open","locked":false,"title":"Ingame localization switch","user":{"login":"qweasdd136963","id":20545492,"node_id":"MDQ6VXNlcjIwNTQ1NDky","avatar_url":"https://avatars0.githubusercontent.com/u/20545492?v=4","gravatar_id":"","url":"https://api.github.com/users/qweasdd136963","html_url":"https://github.com/qweasdd136963","followers_url":"https://api.github.com/users/qweasdd136963/followers","following_url":"https://api.github.com/users/qweasdd136963/following{/other_user}","gists_url":"https://api.github.com/users/qweasdd136963/gists{/gist_id}","starred_url":"https://api.github.com/users/qweasdd136963/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qweasdd136963/subscriptions","organizations_url":"https://api.github.com/users/qweasdd136963/orgs","repos_url":"https://api.github.com/users/qweasdd136963/repos","events_url":"https://api.github.com/users/qweasdd136963/events{/privacy}","received_events_url":"https://api.github.com/users/qweasdd136963/received_events","type":"User","site_admin":false},"body":"Change language in the game.\r\nFixed two bugs.\r\nCleanup UIScriptWnd_script.","created_at":"2018-11-15T12:08:20Z","updated_at":"2018-11-15T15:05:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"993506378ada1462b7cb91cf0c1b59d016129aa1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":127046914,"node_id":"MDU6TGFiZWwxMjcwNDY5MTQ=","url":"https://api.github.com/repos/OpenXRay/xray-16/labels/Enhancement","name":"Enhancement","color":"84b6eb","default":false},{"id":283662510,"node_id":"MDU6TGFiZWwyODM2NjI1MTA=","url":"https://api.github.com/repos/OpenXRay/xray-16/labels/Gameplay","name":"Gameplay","color":"bfd4f2","default":false},{"id":283664752,"node_id":"MDU6TGFiZWwyODM2NjQ3NTI=","url":"https://api.github.com/repos/OpenXRay/xray-16/labels/UI","name":"UI","color":"fad8c7","default":false},{"id":1020962145,"node_id":"MDU6TGFiZWwxMDIwOTYyMTQ1","url":"https://api.github.com/repos/OpenXRay/xray-16/labels/User%20Experience","name":"User Experience","color":"fbca04","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/OpenXRay/xray-16/pulls/277/commits","review_comments_url":"https://api.github.com/repos/OpenXRay/xray-16/pulls/277/comments","review_comment_url":"https://api.github.com/repos/OpenXRay/xray-16/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OpenXRay/xray-16/issues/277/comments","statuses_url":"https://api.github.com/repos/OpenXRay/xray-16/statuses/19412b5700cfca980dc9e589c2b24c32659d432c","head":{"label":"qweasdd136963:lang_change","ref":"lang_change","sha":"19412b5700cfca980dc9e589c2b24c32659d432c","user":{"login":"qweasdd136963","id":20545492,"node_id":"MDQ6VXNlcjIwNTQ1NDky","avatar_url":"https://avatars0.githubusercontent.com/u/20545492?v=4","gravatar_id":"","url":"https://api.github.com/users/qweasdd136963","html_url":"https://github.com/qweasdd136963","followers_url":"https://api.github.com/users/qweasdd136963/followers","following_url":"https://api.github.com/users/qweasdd136963/following{/other_user}","gists_url":"https://api.github.com/users/qweasdd136963/gists{/gist_id}","starred_url":"https://api.github.com/users/qweasdd136963/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qweasdd136963/subscriptions","organizations_url":"https://api.github.com/users/qweasdd136963/orgs","repos_url":"https://api.github.com/users/qweasdd136963/repos","events_url":"https://api.github.com/users/qweasdd136963/events{/privacy}","received_events_url":"https://api.github.com/users/qweasdd136963/received_events","type":"User","site_admin":false},"repo":{"id":127540382,"node_id":"MDEwOlJlcG9zaXRvcnkxMjc1NDAzODI=","name":"OXR_CoC","full_name":"qweasdd136963/OXR_CoC","private":false,"owner":{"login":"qweasdd136963","id":20545492,"node_id":"MDQ6VXNlcjIwNTQ1NDky","avatar_url":"https://avatars0.githubusercontent.com/u/20545492?v=4","gravatar_id":"","url":"https://api.github.com/users/qweasdd136963","html_url":"https://github.com/qweasdd136963","followers_url":"https://api.github.com/users/qweasdd136963/followers","following_url":"https://api.github.com/users/qweasdd136963/following{/other_user}","gists_url":"https://api.github.com/users/qweasdd136963/gists{/gist_id}","starred_url":"https://api.github.com/users/qweasdd136963/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qweasdd136963/subscriptions","organizations_url":"https://api.github.com/users/qweasdd136963/orgs","repos_url":"https://api.github.com/users/qweasdd136963/repos","events_url":"https://api.github.com/users/qweasdd136963/events{/privacy}","received_events_url":"https://api.github.com/users/qweasdd136963/received_events","type":"User","site_admin":false},"html_url":"https://github.com/qweasdd136963/OXR_CoC","description":"X-Ray Engine 1.6 expansion. Join our IRC channel #openxray on freenode.org, or our Discord channel: https://discord.gg/sjRMQwv","fork":true,"url":"https://api.github.com/repos/qweasdd136963/OXR_CoC","forks_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/forks","keys_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/keys{/key_id}","collaborators_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/teams","hooks_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/hooks","issue_events_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/issues/events{/number}","events_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/events","assignees_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/assignees{/user}","branches_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/branches{/branch}","tags_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/tags","blobs_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/git/refs{/sha}","trees_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/git/trees{/sha}","statuses_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/statuses/{sha}","languages_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/languages","stargazers_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/stargazers","contributors_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/contributors","subscribers_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/subscribers","subscription_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/subscription","commits_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/commits{/sha}","git_commits_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/git/commits{/sha}","comments_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/comments{/number}","issue_comment_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/issues/comments{/number}","contents_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/contents/{+path}","compare_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/compare/{base}...{head}","merges_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/merges","archive_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/downloads","issues_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/issues{/number}","pulls_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/pulls{/number}","milestones_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/milestones{/number}","notifications_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/labels{/name}","releases_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/releases{/id}","deployments_url":"https://api.github.com/repos/qweasdd136963/OXR_CoC/deployments","created_at":"2018-03-31T14:41:09Z","updated_at":"2018-11-01T22:05:34Z","pushed_at":"2018-11-15T12:33:47Z","git_url":"git://github.com/qweasdd136963/OXR_CoC.git","ssh_url":"git@github.com:qweasdd136963/OXR_CoC.git","clone_url":"https://github.com/qweasdd136963/OXR_CoC.git","svn_url":"https://github.com/qweasdd136963/OXR_CoC","homepage":"","size":158264,"stargazers_count":10,"watchers_count":10,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":5,"open_issues":0,"watchers":10,"default_branch":"coc_15r6_stable"}},"base":{"label":"OpenXRay:xd_dev","ref":"xd_dev","sha":"65da5a72aba14dc2133ff10a0349246fbaa34dd6","user":{"login":"OpenXRay","id":8896523,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg4OTY1MjM=","avatar_url":"https://avatars2.githubusercontent.com/u/8896523?v=4","gravatar_id":"","url":"https://api.github.com/users/OpenXRay","html_url":"https://github.com/OpenXRay","followers_url":"https://api.github.com/users/OpenXRay/followers","following_url":"https://api.github.com/users/OpenXRay/following{/other_user}","gists_url":"https://api.github.com/users/OpenXRay/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenXRay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenXRay/subscriptions","organizations_url":"https://api.github.com/users/OpenXRay/orgs","repos_url":"https://api.github.com/users/OpenXRay/repos","events_url":"https://api.github.com/users/OpenXRay/events{/privacy}","received_events_url":"https://api.github.com/users/OpenXRay/received_events","type":"Organization","site_admin":false},"repo":{"id":23690226,"node_id":"MDEwOlJlcG9zaXRvcnkyMzY5MDIyNg==","name":"xray-16","full_name":"OpenXRay/xray-16","private":false,"owner":{"login":"OpenXRay","id":8896523,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg4OTY1MjM=","avatar_url":"https://avatars2.githubusercontent.com/u/8896523?v=4","gravatar_id":"","url":"https://api.github.com/users/OpenXRay","html_url":"https://github.com/OpenXRay","followers_url":"https://api.github.com/users/OpenXRay/followers","following_url":"https://api.github.com/users/OpenXRay/following{/other_user}","gists_url":"https://api.github.com/users/OpenXRay/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenXRay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenXRay/subscriptions","organizations_url":"https://api.github.com/users/OpenXRay/orgs","repos_url":"https://api.github.com/users/OpenXRay/repos","events_url":"https://api.github.com/users/OpenXRay/events{/privacy}","received_events_url":"https://api.github.com/users/OpenXRay/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/OpenXRay/xray-16","description":"X-Ray Engine 1.6 expansion. Join our IRC channel #openxray on freenode.org, or our Discord channel: https://discord.gg/sjRMQwv","fork":false,"url":"https://api.github.com/repos/OpenXRay/xray-16","forks_url":"https://api.github.com/repos/OpenXRay/xray-16/forks","keys_url":"https://api.github.com/repos/OpenXRay/xray-16/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenXRay/xray-16/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenXRay/xray-16/teams","hooks_url":"https://api.github.com/repos/OpenXRay/xray-16/hooks","issue_events_url":"https://api.github.com/repos/OpenXRay/xray-16/issues/events{/number}","events_url":"https://api.github.com/repos/OpenXRay/xray-16/events","assignees_url":"https://api.github.com/repos/OpenXRay/xray-16/assignees{/user}","branches_url":"https://api.github.com/repos/OpenXRay/xray-16/branches{/branch}","tags_url":"https://api.github.com/repos/OpenXRay/xray-16/tags","blobs_url":"https://api.github.com/repos/OpenXRay/xray-16/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenXRay/xray-16/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenXRay/xray-16/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenXRay/xray-16/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenXRay/xray-16/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenXRay/xray-16/languages","stargazers_url":"https://api.github.com/repos/OpenXRay/xray-16/stargazers","contributors_url":"https://api.github.com/repos/OpenXRay/xray-16/contributors","subscribers_url":"https://api.github.com/repos/OpenXRay/xray-16/subscribers","subscription_url":"https://api.github.com/repos/OpenXRay/xray-16/subscription","commits_url":"https://api.github.com/repos/OpenXRay/xray-16/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenXRay/xray-16/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenXRay/xray-16/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenXRay/xray-16/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenXRay/xray-16/contents/{+path}","compare_url":"https://api.github.com/repos/OpenXRay/xray-16/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenXRay/xray-16/merges","archive_url":"https://api.github.com/repos/OpenXRay/xray-16/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenXRay/xray-16/downloads","issues_url":"https://api.github.com/repos/OpenXRay/xray-16/issues{/number}","pulls_url":"https://api.github.com/repos/OpenXRay/xray-16/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenXRay/xray-16/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenXRay/xray-16/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenXRay/xray-16/labels{/name}","releases_url":"https://api.github.com/repos/OpenXRay/xray-16/releases{/id}","deployments_url":"https://api.github.com/repos/OpenXRay/xray-16/deployments","created_at":"2014-09-05T04:28:23Z","updated_at":"2018-11-15T10:40:17Z","pushed_at":"2018-11-15T12:33:48Z","git_url":"git://github.com/OpenXRay/xray-16.git","ssh_url":"git@github.com:OpenXRay/xray-16.git","clone_url":"https://github.com/OpenXRay/xray-16.git","svn_url":"https://github.com/OpenXRay/xray-16","homepage":"","size":109599,"stargazers_count":536,"watchers_count":536,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":181,"mirror_url":null,"archived":false,"open_issues_count":82,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":181,"open_issues":82,"watchers":536,"default_branch":"xd_dev"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenXRay/xray-16/pulls/277"},"html":{"href":"https://github.com/OpenXRay/xray-16/pull/277"},"issue":{"href":"https://api.github.com/repos/OpenXRay/xray-16/issues/277"},"comments":{"href":"https://api.github.com/repos/OpenXRay/xray-16/issues/277/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenXRay/xray-16/pulls/277/comments"},"review_comment":{"href":"https://api.github.com/repos/OpenXRay/xray-16/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OpenXRay/xray-16/pulls/277/commits"},"statuses":{"href":"https://api.github.com/repos/OpenXRay/xray-16/statuses/19412b5700cfca980dc9e589c2b24c32659d432c"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"FreeZoneMods"}}