{"action":"created","issue":{"url":"https://api.github.com/repos/magarena/magarena/issues/387","labels_url":"https://api.github.com/repos/magarena/magarena/issues/387/labels{/name}","comments_url":"https://api.github.com/repos/magarena/magarena/issues/387/comments","events_url":"https://api.github.com/repos/magarena/magarena/issues/387/events","html_url":"https://github.com/magarena/magarena/issues/387","id":92438379,"number":387,"title":"Translatable UI","user":{"login":"lodici","id":2443519,"avatar_url":"https://avatars.githubusercontent.com/u/2443519?v=3","gravatar_id":"","url":"https://api.github.com/users/lodici","html_url":"https://github.com/lodici","followers_url":"https://api.github.com/users/lodici/followers","following_url":"https://api.github.com/users/lodici/following{/other_user}","gists_url":"https://api.github.com/users/lodici/gists{/gist_id}","starred_url":"https://api.github.com/users/lodici/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lodici/subscriptions","organizations_url":"https://api.github.com/users/lodici/orgs","repos_url":"https://api.github.com/users/lodici/repos","events_url":"https://api.github.com/users/lodici/events{/privacy}","received_events_url":"https://api.github.com/users/lodici/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/magarena/magarena/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/magarena/magarena/labels/UI","name":"UI","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":23,"created_at":"2015-07-01T17:15:11Z","updated_at":"2015-07-03T03:22:19Z","closed_at":null,"body":"56d8f7b1ebd9ee0e7fcca1ff1c1de933ceb13f1d is a first stab at a translation mechanism for Magarena aimed at the display of UI text and messages (card data is a whole other kettle of fish). It should work with both static strings and strings containing place holders (ie. ``String.format(...)``). It is designed to be simple to use for translators with minimal overhead for developers in terms of workload.\r\n\r\nFor this initial commit I have implemented translatable strings for the Main Menu (6f852adecabdc53ec3007bcdb8c4e9f6385f3b43), Settings Menu (efda37c8d7e2c5dbb4f9c2a8cba064ef73976681) and the Preferences dialog (e33fd2c4338c0fd810ea30569a819c33940f5caa) which has alot of text. I hope we can have close to 100% coverage by release of 1.64.\r\n\r\nI am currently working on a wiki page which will explain how it all works and I will post the link here when I have published the first draft. But to summarize...\r\n\r\nThis adds a new option to the preferences dialog which basically uses reflection and a simple convention to automatically extract (English) strings to a text file in ``Magarena/translations`` which can then be replaced with appropriate translations.\r\n\r\nFrom a developer POV, to make a string translatable it should be defined as a constant (``public static final``) with a name starting with ``_S``. The three commits above demonstrate how I did this. Finally, replace the inline string with ``UiString.get(???)`` or ``UiString.get(???, <args>..)``, where ??? is the equivalent ``_S*`` reference. That's it really.\r\n\r\nThis also introduces code to restart Magarena. Might be hit and miss how well this works, but seems to work ok on Windows and Linux (with one exception).\r\n"},"comment":{"url":"https://api.github.com/repos/magarena/magarena/issues/comments/118221498","html_url":"https://github.com/magarena/magarena/issues/387#issuecomment-118221498","issue_url":"https://api.github.com/repos/magarena/magarena/issues/387","id":118221498,"user":{"login":"PalladiaMors","id":9581122,"avatar_url":"https://avatars.githubusercontent.com/u/9581122?v=3","gravatar_id":"","url":"https://api.github.com/users/PalladiaMors","html_url":"https://github.com/PalladiaMors","followers_url":"https://api.github.com/users/PalladiaMors/followers","following_url":"https://api.github.com/users/PalladiaMors/following{/other_user}","gists_url":"https://api.github.com/users/PalladiaMors/gists{/gist_id}","starred_url":"https://api.github.com/users/PalladiaMors/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PalladiaMors/subscriptions","organizations_url":"https://api.github.com/users/PalladiaMors/orgs","repos_url":"https://api.github.com/users/PalladiaMors/repos","events_url":"https://api.github.com/users/PalladiaMors/events{/privacy}","received_events_url":"https://api.github.com/users/PalladiaMors/received_events","type":"User","site_admin":false},"created_at":"2015-07-03T03:22:19Z","updated_at":"2015-07-03T03:22:19Z","body":"Just sent you the file through e-mail. Maybe I'm wrong but if I understand correctly these errors are related to symbols that are specific to certain languages. I believe Portuguese contains exactly two symbols which aren't used in any other language, \"ç\" and \"ã\".\r\n\r\nBy the way, I've already noticed a couple things in the file I sent you that I'd like to change, so that's definitely not the final version."}}