{"id":20376251,"url":"https://github.com/mrglaster/amx-plugins-translator","last_synced_at":"2025-04-12T07:36:06.737Z","repository":{"id":65512868,"uuid":"593534165","full_name":"mrglaster/AMX-Plugins-Translator","owner":"mrglaster","description":"C# Utility generating Dictionary for the AMX Plugin and Replacing almost all hardcoded strings to Dictionary References","archived":false,"fork":false,"pushed_at":"2023-04-12T13:47:04.000Z","size":236,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T02:51:08.220Z","etag":null,"topics":["amxmodx","automatisation","c-sharp","cs","csharp","dictionary","goldsource","gtranslate","half-life","multilingual","pawn","plugin","plugin-translator","plugins","rider","translation","utility","valve"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrglaster.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2023-01-26T08:43:45.000Z","updated_at":"2024-05-13T18:07:12.000Z","dependencies_parsed_at":"2023-02-14T22:40:33.178Z","dependency_job_id":null,"html_url":"https://github.com/mrglaster/AMX-Plugins-Translator","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrglaster%2FAMX-Plugins-Translator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrglaster%2FAMX-Plugins-Translator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrglaster%2FAMX-Plugins-Translator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrglaster%2FAMX-Plugins-Translator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrglaster","download_url":"https://codeload.github.com/mrglaster/AMX-Plugins-Translator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248535420,"owners_count":21120555,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amxmodx","automatisation","c-sharp","cs","csharp","dictionary","goldsource","gtranslate","half-life","multilingual","pawn","plugin","plugin-translator","plugins","rider","translation","utility","valve"],"created_at":"2024-11-15T01:36:28.033Z","updated_at":"2025-04-12T07:36:06.708Z","avatar_url":"https://github.com/mrglaster.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"## AMX Plugins Translator\nC# Utility generating Dictionary for the AMX Plugin and Replacing almost all hardcoded strings to Dictionary References\n\n## What is this utility for?\n\nOften when developing AMX plugins it happens that before the release it becomes necessary to add multilingual support.\n\nThis is not a difficult task, but sometimes it takes a lot of time to implement it: \n1) convert hardcoded strings to a certain form\n2) create a dictionary\n3) translate the entire hardcode into other languages.\n\nThis utility automates the above mentioned tasks. You just need to specify the path to the plugin, the source language of the hardcode and the list of languages ​​you want to translate the plugin into.\nYou can leave last argument out, then the utility will translate the plugin into all supported languages\n\nUtility will modify lines containing following functions\n\n```\n            client_print\n            client_print_color\n            console_print\n            engclient_print\n            server_print\n            show_hudmessage\n            show_dhudmessage\n            log_message\n            log_amx\n            log_to_file\n            menu_create\n            menu_additem\n```\n\n## Requirements\n\n[.NET 6.0 Desktop Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/6.0)\n\n## Example of utility work\n\n### Source code of Plugin\n\n```\n#include \u003camxmodx\u003e\n\n#define PLUGIN \"Plugin for Translator Test\"\n#define VERSION \"1.0\"\n#define AUTHOR \"Glaster\"\npublic plugin_init() {\n    register_clcmd(\"say /menu\", \"NewMenu\");\n    register_plugin(PLUGIN, VERSION, AUTHOR);\n    register_clcmd(\"say /test_prints\", \"print_stuff\");\n}\n\npublic print_stuff(id) {\n    new name[32];\n\n    //client_print example\n    get_user_name(id, name, 32);\n    client_print(id, print_chat, \"Hello Player with Name: %s\", name);\n    client_print(id, print_center, \"Hello Dude!\");\n    client_print(id, print_console, \"Test Value\");\n\n    //Hud example. Is valid also for dhud\n    set_hudmessage(64, 0, 128, -1.0, 0.0, 0, 6.0, 6.0, 0.1, 0.2, -1)\n    show_hudmessage(0, \"Hello Player!\")\n\n}\n//Menu exaple\npublic NewMenu(id) {\n    new i_Menu = menu_create(\"\\wOur Server Menu\", \"NewMenu_handler\");\n    menu_additem(i_Menu, \"\\wItem 1\", \"1\", 0);\n    menu_additem(i_Menu, \"\\wItem 2\", \"2\", 0);\n    menu_additem(i_Menu, \"\\wItem 3\", \"3\", 0);\n    menu_setprop(i_Menu, MPROP_NEXTNAME, \"\\rNext!\");\n    menu_setprop(i_Menu, MPROP_BACKNAME, \"\\rBack\");\n    menu_setprop(i_Menu, MPROP_EXITNAME, \"\\rExit\");\n    menu_display(id, i_Menu, 0)\n}\npublic NewMenu_handler(id, menu, item) {\n    if (item \u003c 0) return PLUGIN_CONTINUE;\n    new cmd[3], access, callback;\n    menu_item_getinfo(menu, item, access, cmd, 2, _, _, callback);\n    return PLUGIN_HANDLED;\n}        \n```\n\n### Generated modified plugin\n\n```\n//Plugins was translated with AMX Plugin Translator: https://github.com/mrglaster/AMX-Plugin-Translator\n#include \u003camxmodx\u003e\n\n#define PLUGIN \"Plugin for Translator Test\"\n#define VERSION \"1.0\"\n#define AUTHOR \"Glaster\"\n\npublic plugin_init() {\n    register_dictionary(\"test_plugin.txt\");\n\n    register_clcmd(\"say /menu\", \"NewMenu\"); \n    register_plugin(PLUGIN, VERSION, AUTHOR);\n    register_clcmd(\"say /test_prints\", \"print_stuff\");\n}\n\npublic print_stuff(id) {\n    new name[32];\n\n    //client_print example\n    get_user_name(id, name, 32);\n    client_print(id, print_chat, \"%L\", LANG_PLAYER, \"HELLO_PLAYER_WITH_NAME\", name);\n    client_print(id, print_center, \"%L\", LANG_PLAYER, \"HELLO_DUDE\");\n    client_print(id, print_console, \"%L\", LANG_PLAYER, \"TEST_VALUE\");\n\n    //Hud example. Is valid also for dhud\n    set_hudmessage(64, 0, 128, -1.0, 0.0, 0, 6.0, 6.0, 0.1, 0.2, -1)\n    show_hudmessage(0, \"%L\", LANG_PLAYER, \"HELLO_PLAYER\")\n\n}\n\n//Menu exaple\npublic NewMenu(id) {\n    new szStringBuf[64]\n    formatex(szStringBuf, charsmax(szStringBuf), \"%L\", LANG_PLAYER, \"WOUR_SERVER_MENU\");\n    new i_Menu = menu_create(szStringBuf, \"NewMenu_handler\");\n    formatex(szStringBuf, charsmax(szStringBuf), \"%L\", LANG_PLAYER, \"WITEM_1\");\n    menu_additem(i_Menu, szStringBuf, \"1\", 0);\n    formatex(szStringBuf, charsmax(szStringBuf), \"%L\", LANG_PLAYER, \"WITEM_2\");\n    menu_additem(i_Menu, szStringBuf, \"2\", 0);\n    formatex(szStringBuf, charsmax(szStringBuf), \"%L\", LANG_PLAYER, \"WITEM_3\");\n    menu_additem(i_Menu, szStringBuf, \"3\", 0);\n    menu_setprop(i_Menu, MPROP_NEXTNAME, \"\\rNext!\");\n    menu_setprop(i_Menu, MPROP_BACKNAME, \"\\rBack\");\n    menu_setprop(i_Menu, MPROP_EXITNAME, \"\\rExit\");\n    menu_display(id, i_Menu, 0)\n}\n\npublic NewMenu_handler(id, menu, item) {\n    if (item \u003c 0) return PLUGIN_CONTINUE;\n    new cmd[3], access, callback;\n    menu_item_getinfo(menu, item, access, cmd, 2, _, _, callback);\n    return PLUGIN_HANDLED;\n}\n```\n\n\n### Generated Dictionary\n\n```\n[en]\nHELLO_PLAYER_WITH_NAME = Hello Player with Name: %s\nHELLO_DUDE = Hello Dude!\nTEST_VALUE = Test Value\nHELLO_PLAYER = Hello Player!\nWOUR_SERVER_MENU = Our Server Menu\nWITEM_1 = Item 1\nWITEM_2 = Item 2\nWITEM_3 = Item 3\n\n \n[ru]\nHELLO_PLAYER_WITH_NAME = Привет, игрок с именем: %s \nHELLO_DUDE = Привет, чувак! \nTEST_VALUE = Тестовое значение \nHELLO_PLAYER = Привет Игрок! \nWOUR_SERVER_MENU = Меню нашего сервера \nWITEM_1 = Пункт 1 \nWITEM_2 = Пункт 2 \nWITEM_3 = Пункт 3 \n\n \n[de]\nHELLO_PLAYER_WITH_NAME = Hallo Spieler mit Namen: %s \nHELLO_DUDE = Hallo Alter! \nTEST_VALUE = Testwert \nHELLO_PLAYER = Hallo Spieler! \nWOUR_SERVER_MENU = Unser Servermenü \nWITEM_1 = Punkt 1 \nWITEM_2 = Punkt 2 \nWITEM_3 = Punkt 3 \n\n```\n\n### In-game example\n\n![alt text](https://github.com/mrglaster/AMX-Plugin-Translator/blob/main/readme_images/example_print_center_new.png)\n\n![alt text](https://github.com/mrglaster/AMX-Plugin-Translator/blob/main/readme_images/example_menu.png)\n\n## How to use the utility?\n\nThe utility receives 2 or 3 arguments as input. The first one is the path to the AMX script in .sma format, the second one is the original hardcode language of the plugin, the third one (optional) is the list of languages into which the plugin will be translated.\n\nExamples of using :\n\n```\nAMX-Plugins-Translator.exe myplugin.sma en\n```\n\nor\n\n```\nAMX-Plugins-Translator.exe myplugin.sma en \"ru, de, fr\"\n```\n### Arguments Description\n\n| Argument Name    | Type   | Required | Description                                                                                                        |\n|------------------|--------|----------|--------------------------------------------------------------------------------------------------------------------|\n| Path to Plugin   | String | TRUE     | Path to your .sma AMX Plugin                                                                                       |\n| Source Language  | String | TRUE     | Source language of plugin's hardcode. Example: en, de, other languages from the \"Supported Languages\" table        |\n| Output Languages | String | FALSE    | String containing output languages in format \"de, ru, ua\" (check the \"Supported Languages\" table for the full list |\n\n## Supported Languages\n\n| №  | Abbreviation used in the utility | Language             |\n|----|----------------------------------|----------------------|\n| 1  | en                               | English              |\n| 2  | de                               | German               |\n| 3  | sr                               | Serbian              |\n| 4  | tr                               | Turkish              |\n| 5  | fr                               | French               |\n| 6  | sv                               | Swedish              |\n| 7  | da                               | Danish               |\n| 8  | pl                               | Polish               |\n| 9  | nl                               | Dutch                |\n| 10 | es                               | Spanish              |\n| 11 | bp                               | Brazilian Portuguese |\n| 12 | cz                               | Czech                |\n| 13 | fi                               | Finnish              |\n| 14 | bg                               | Bulgarian            |\n| 15 | ro                               | Romanian             |\n| 16 | hu                               | Hungarian            |\n| 17 | lt                               | Lithuanian           |\n| 18 | sk                               | Slovak               |\n| 19 | mk                               | Macedonian           |\n| 20 | ru                               | Russian              |\n| 21 | hr                               | Croatian             |\n| 22 | bs                               | Bosnian              |\n| 23 | cn                               | Chinese              |\n| 24 | al                               | Albanian             |\n| 25 | ua                               | Ukrainian            |\n| 26 | lv                               | Latvian              |\n\n\n### Used Libraries\n\n1) [GTranslate: A collection of free translation APIs](https://github.com/d4n3436/GTranslate)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrglaster%2Famx-plugins-translator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrglaster%2Famx-plugins-translator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrglaster%2Famx-plugins-translator/lists"}