Free Translate API using winforms c#

There are several free translation APIs that can be used with C# and Winforms to translate text from English to Chinese. Here are a few examples:

  1. MyMemory Translated API: This API allows you to translate text in various languages, including English and Chinese, and is free for non-commercial use. You can access the API using the following endpoint:|zh
  2. Yandex.Translate API: This API also supports multiple languages and allows for up to 1 million characters per month for free. You can access the API using the following endpoint:
  3. Apertium API: This API is free and open-source, and supports a variety of languages including English and Chinese. You can access the API using the following endpoint:|zh

To use these APIs, you will need to make HTTP requests to the appropriate endpoint, passing in the text to be translated and the desired language pair as parameters. You will also need to handle the response, which will be in JSON format, and parse it to extract the translated text.

You can use HttpClient class or other third party HTTP libraries to make the HTTP request and Newtonsoft.Json or System.Text.Json to parse the json response.

How to use these API in WinForms C# Real Example

Here is an example of how to use the MyMemory Translated API to translate text from English to Chinese in a C# Winforms application:

  1. Add a reference to the System.Net.Http library in your project.
  2. In your form’s code, create a new method that will handle the translation.

private async void TranslateText(string text)
// The endpoint for the MyMemory Translated API
string endpoint = “” + text + “&langpair=en|zh”;

// Use HttpClient to make a GET request to the endpoint
using (HttpClient client = new HttpClient())
    HttpResponseMessage response = await client.GetAsync(endpoint);
    if (response.IsSuccessStatusCode)
        // Get the response content as a string
        string json = await response.Content.ReadAsStringAsync();

        // Parse the JSON to extract the translated text
        dynamic jsonData = JsonConvert.DeserializeObject(json);
        string translatedText = jsonData.responseData.translatedText;

        // Update the UI with the translated text
        translatedTextBox.Text = translatedText;


Call the TranslateText method when the user clicks a button or on text changed event of textbox

private void translateButton_Click(object sender, EventArgs e)

  1. Add Newtonsoft.Json library to your project.

You can use the same concept to use other APIs , just replace the endpoint, the json parsing and handling the response.

Please note that these APIs have usage limits and you may have to signup to get the API key.

Leave a Reply

Your email address will not be published. Required fields are marked *