{"action":"created","issue":{"url":"https://api.github.com/repos/mate-desktop/mate-desktop/issues/325","repository_url":"https://api.github.com/repos/mate-desktop/mate-desktop","labels_url":"https://api.github.com/repos/mate-desktop/mate-desktop/issues/325/labels{/name}","comments_url":"https://api.github.com/repos/mate-desktop/mate-desktop/issues/325/comments","events_url":"https://api.github.com/repos/mate-desktop/mate-desktop/issues/325/events","html_url":"https://github.com/mate-desktop/mate-desktop/pull/325","id":332992548,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk1MzM1NTcw","number":325,"title":"add mate-language apis","user":{"login":"yetist","id":665058,"node_id":"MDQ6VXNlcjY2NTA1OA==","avatar_url":"https://avatars0.githubusercontent.com/u/665058?v=4","gravatar_id":"","url":"https://api.github.com/users/yetist","html_url":"https://github.com/yetist","followers_url":"https://api.github.com/users/yetist/followers","following_url":"https://api.github.com/users/yetist/following{/other_user}","gists_url":"https://api.github.com/users/yetist/gists{/gist_id}","starred_url":"https://api.github.com/users/yetist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yetist/subscriptions","organizations_url":"https://api.github.com/users/yetist/orgs","repos_url":"https://api.github.com/users/yetist/repos","events_url":"https://api.github.com/users/yetist/events{/privacy}","received_events_url":"https://api.github.com/users/yetist/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-16T14:57:41Z","updated_at":"2018-06-16T15:03:02Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/mate-desktop/mate-desktop/pulls/325","html_url":"https://github.com/mate-desktop/mate-desktop/pull/325","diff_url":"https://github.com/mate-desktop/mate-desktop/pull/325.diff","patch_url":"https://github.com/mate-desktop/mate-desktop/pull/325.patch"},"body":"Add mate language/locale api from gnome-desktop, see #319.\r\nPlease review, thank you."},"comment":{"url":"https://api.github.com/repos/mate-desktop/mate-desktop/issues/comments/397818171","html_url":"https://github.com/mate-desktop/mate-desktop/pull/325#issuecomment-397818171","issue_url":"https://api.github.com/repos/mate-desktop/mate-desktop/issues/325","id":397818171,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NzgxODE3MQ==","user":{"login":"yetist","id":665058,"node_id":"MDQ6VXNlcjY2NTA1OA==","avatar_url":"https://avatars0.githubusercontent.com/u/665058?v=4","gravatar_id":"","url":"https://api.github.com/users/yetist","html_url":"https://github.com/yetist","followers_url":"https://api.github.com/users/yetist/followers","following_url":"https://api.github.com/users/yetist/following{/other_user}","gists_url":"https://api.github.com/users/yetist/gists{/gist_id}","starred_url":"https://api.github.com/users/yetist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yetist/subscriptions","organizations_url":"https://api.github.com/users/yetist/orgs","repos_url":"https://api.github.com/users/yetist/repos","events_url":"https://api.github.com/users/yetist/events{/privacy}","received_events_url":"https://api.github.com/users/yetist/received_events","type":"User","site_admin":false},"created_at":"2018-06-16T15:03:02Z","updated_at":"2018-06-16T15:03:02Z","author_association":"NONE","body":"Here is a simple test code for these new apis:\r\n```\r\n$ cat test.c \r\n/* gcc test.c `pkg-config --cflags --libs mate-desktop-2.0` */\r\n#include <stdio.h>\r\n#include <glib.h>\r\n#define MATE_DESKTOP_USE_UNSTABLE_API\r\n#include <libmate-desktop/mate-languages.h>\r\n\r\nvoid test_one_locale(const gchar *locale)\r\n{\r\n\tchar *lang, *country, *norm_locale;\r\n\tchar *language_codep, *country_codep, *codesetp, *modifierp;\r\n\r\n\tlang = mate_get_language_from_locale (locale, NULL);\r\n\tcountry = mate_get_country_from_locale (locale, NULL);\r\n\tnorm_locale = mate_normalize_locale (locale);\r\n\r\n\tg_print(\"%s:\\nlang=%s, country=%s, locale=%s\\n\", locale, lang, country, norm_locale);\r\n\r\n\r\n\tif (mate_parse_locale (locale, &language_codep, &country_codep, &codesetp, &modifierp)) {\r\n\t\tg_print(\"lang_codep=%s, country_code=%s, code=%s, modifier=%s\\n\",\r\n\t\t\t\tlanguage_codep,\r\n\t\t\t\tcountry_codep,\r\n\t\t\t\tcodesetp,\r\n\t\t\t\tmodifierp);\r\n\t\tif (mate_language_has_translations(language_codep)) {\r\n\t\t\tg_print(\"Has translation\\n\");\r\n\t\t} else {\r\n\t\t\tg_print(\"No translation\\n\");\r\n\t\t}\r\n\t}\r\n\tputchar('\\n');\r\n\r\n\tg_free(lang);\r\n\tg_free(country);\r\n\tg_free(norm_locale);\r\n\r\n\tg_free(language_codep);\r\n\tg_free(country_codep);\r\n\tg_free(codesetp);\r\n\tg_free(modifierp);\r\n}\r\n\r\nvoid test_locales(void)\r\n{\r\n\tchar **all;\r\n\tguint i, len;\r\n\r\n\tall= mate_get_all_locales ();\r\n\tlen = g_strv_length (all);\r\n\r\n\tfor (i =0; i < len; i++) {\r\n\t\ttest_one_locale(all[i]);\r\n\t}\r\n\tg_strfreev(all);\r\n}\r\n\r\nint main(int argc, char **argv)\r\n{\r\n\tif (argc == 2) {\r\n\t\ttest_one_locale(argv[1]);\r\n\t} else {\r\n\t\ttest_locales();\r\n\t}\r\n\treturn 0;\r\n}\r\n\r\n```"}}
{"actor":{"display_login":"yetist"}}