{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/fbctf/issues/114","repository_url":"https://api.github.com/repos/facebook/fbctf","labels_url":"https://api.github.com/repos/facebook/fbctf/issues/114/labels{/name}","comments_url":"https://api.github.com/repos/facebook/fbctf/issues/114/comments","events_url":"https://api.github.com/repos/facebook/fbctf/issues/114/events","html_url":"https://github.com/facebook/fbctf/pull/114","id":157533560,"number":114,"title":"Internationalization added","user":{"login":"markszabo","id":12611720,"avatar_url":"https://avatars.githubusercontent.com/u/12611720?v=3","gravatar_id":"","url":"https://api.github.com/users/markszabo","html_url":"https://github.com/markszabo","followers_url":"https://api.github.com/users/markszabo/followers","following_url":"https://api.github.com/users/markszabo/following{/other_user}","gists_url":"https://api.github.com/users/markszabo/gists{/gist_id}","starred_url":"https://api.github.com/users/markszabo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markszabo/subscriptions","organizations_url":"https://api.github.com/users/markszabo/orgs","repos_url":"https://api.github.com/users/markszabo/repos","events_url":"https://api.github.com/users/markszabo/events{/privacy}","received_events_url":"https://api.github.com/users/markszabo/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/fbctf/labels/CLA%20Signed","name":"CLA Signed","color":"009900"},{"url":"https://api.github.com/repos/facebook/fbctf/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/facebook/fbctf/labels/platform","name":"platform","color":"b60205"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-05-30T16:53:42Z","updated_at":"2016-06-07T16:03:42Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/facebook/fbctf/pulls/114","html_url":"https://github.com/facebook/fbctf/pull/114","diff_url":"https://github.com/facebook/fbctf/pull/114.diff","patch_url":"https://github.com/facebook/fbctf/pull/114.patch"},"body":"As requested in #7 I implemented the internationalization of the system. \r\n![internat](https://cloud.githubusercontent.com/assets/12611720/15654662/5a42aeba-2696-11e6-8fc6-22dd096c0915.jpg)\r\nI was considering multiple options, and I liked [gettext](http://stackoverflow.com/a/31176371) most, but it looked a little bit too complicated (needs a php library installed and an other tool to edit translations). So I implemented something similar but simpler.\r\n\r\nI replaced the strings with a function call (for example: `'Facebook CTF'` => `tr('Facebook CTF')`. `tr` stands for translate, but you can change if you have a better idea). The function is defined in `src/language/language.php`, and it uses the selected language file (eg `lang_en.php`). The language file is an array, and to add a new language it's enough to create a new file with a similar name (for example `lang_de.php` for German or `lang_fr.php` for French) and put the translation there.\r\n\r\nI also added the possibility to change the language from the admin panel. It looks for files in `lang_*.php` format under `src/language` and displays the name of the languages. The name is displayed in the current language and in the given language:\r\n![language_config](https://cloud.githubusercontent.com/assets/12611720/15654445/916ce4e8-2694-11e6-9bdf-6487279873c2.jpg) The configuration will be saved in the database, and read it from there by `src/language/language.php`.\r\n\r\nTo display the name of the countries in the selected language I used the php function [locale_get_display_region()](http://php.net/manual/en/locale.getdisplayregion.php). Since this function works using the iso code I rewrote some of the function regarding the countries and deleted the name of the countries from the database.\r\n\r\nAs a sample I also created the translation for Hungarian.\r\n\r\nStill missing:\r\n- there are some text displayed by JavaScript (eg 'Nope :(' when you submit a wrong flag) or by CSS (HR MIN SEC M.SEC on the Game Clock), and those are not translated yet. I'm not really sure how to do that properly.\r\n- one of the font is missing the Hungarians characters ő and ű, this might be a problem with other languages too\r\n- I got a couple of errors when running hh_client, but I couldn't resolve them (see [here](https://github.com/facebook/fbctf/files/289896/hh_client.txt)). Every help would be really appreciated."},"comment":{"url":"https://api.github.com/repos/facebook/fbctf/issues/comments/224328756","html_url":"https://github.com/facebook/fbctf/pull/114#issuecomment-224328756","issue_url":"https://api.github.com/repos/facebook/fbctf/issues/114","id":224328756,"user":{"login":"javuto","id":1271349,"avatar_url":"https://avatars.githubusercontent.com/u/1271349?v=3","gravatar_id":"","url":"https://api.github.com/users/javuto","html_url":"https://github.com/javuto","followers_url":"https://api.github.com/users/javuto/followers","following_url":"https://api.github.com/users/javuto/following{/other_user}","gists_url":"https://api.github.com/users/javuto/gists{/gist_id}","starred_url":"https://api.github.com/users/javuto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javuto/subscriptions","organizations_url":"https://api.github.com/users/javuto/orgs","repos_url":"https://api.github.com/users/javuto/repos","events_url":"https://api.github.com/users/javuto/events{/privacy}","received_events_url":"https://api.github.com/users/javuto/received_events","type":"User","site_admin":false},"created_at":"2016-06-07T16:03:42Z","updated_at":"2016-06-07T16:03:42Z","body":"Great work @markszabo, I am ready to merge this if @gsingh93 is cool with it!  👍 or 👎 ?"}}
{"actor":{"display_login":"javuto"}}