{"id":17346905,"url":"https://github.com/d4n3436/gtranslate","last_synced_at":"2025-04-14T20:31:27.263Z","repository":{"id":50258002,"uuid":"378782590","full_name":"d4n3436/GTranslate","owner":"d4n3436","description":"A collection of free translation APIs (Google Translate, Bing Translator, Microsoft Translator and Yandex.Translate).","archived":false,"fork":false,"pushed_at":"2023-06-30T22:08:35.000Z","size":162,"stargazers_count":47,"open_issues_count":2,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-03-26T21:47:04.827Z","etag":null,"topics":["text-to-speech","translation","translation-api","translator","translator-api","tts"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/d4n3436.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-21T02:15:37.000Z","updated_at":"2024-07-26T02:14:23.589Z","dependencies_parsed_at":"2024-07-26T02:25:04.411Z","dependency_job_id":null,"html_url":"https://github.com/d4n3436/GTranslate","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d4n3436%2FGTranslate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d4n3436%2FGTranslate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d4n3436%2FGTranslate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d4n3436%2FGTranslate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d4n3436","download_url":"https://codeload.github.com/d4n3436/GTranslate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248955553,"owners_count":21189160,"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":["text-to-speech","translation","translation-api","translator","translator-api","tts"],"created_at":"2024-10-15T16:47:02.179Z","updated_at":"2025-04-14T20:31:27.258Z","avatar_url":"https://github.com/d4n3436.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GTranslate\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE) [![Nuget](https://img.shields.io/nuget/vpre/GTranslate)](https://www.nuget.org/packages/GTranslate)\n\nGTranslate is a collection of free translation APIs (Google Translate, Bing Translator, Microsoft Translator and Yandex.Translate). Currently supports translation, transliteration, language detection and text-to-speech.\n\n## Features\n\n- 5 translation services:\n  - Google Translate (old and new APIs)\n  - Bing Translator\n  - Microsoft Azure Translator\n  - Yandex.Translate\n\n- Support for translation, transliteration, language detection and text-to-speech in the included translators.\n\n- Support for all the languages of each translator.\n\n- A language class with methods for getting the supported languages and determining the availability of a language in a specific translator.\n\n- Interfaces, allowing to write custom translators and languages.\n\n- An `AggregateTranslator` class that groups the default translators for ease of use with the ability to add custom translators.\n\n## Installation\nInstall via [NuGet](https://www.nuget.org/packages/GTranslate)\n\nOr via command:\n```\ndotnet add package GTranslate\n```\n\n## Usage\n\n### Translation\n```c#\nusing GTranslate.Translators;\n\n// Create an instance of the Google Translator\nvar translator = new GoogleTranslator();\n\n// Translate \"Hello world\" to Spanish (es)\nvar result = await translator.TranslateAsync(\"Hello world\", \"es\");\n\nConsole.WriteLine(result);\n\n// Output:\n// Translation: 'Hola Mundo', TargetLanguage: 'Spanish (es)', SourceLanguage: 'English (en)', Service: GoogleTranslator\n```\n\n### Transliteration\nTransliteration is similar to translation but way it works is specific to each translator. Some translators only support transliteration implicitly and others have dedicated transliteration endpoints (like Yandex).\n```c#\nusing GTranslate.Translators;\n\nvar translator = new YandexTranslator();\n\n// Transliterate \"Hello world\" (in Russian) into English (latin script)\nvar result = await translator.Transliterate(\"Привет, мир\", \"en\");\n\nConsole.WriteLine(result);\n\n// Output:\n// Transliteration: 'privet, mir', TargetLanguage: 'English (en)', SourceLanguage: 'Russian (ru)', Service: YandexTranslator\n```\n\nIt's recommended to use `MicrosoftTranslator` for transliteration because of its superior API that allows you to explicitly specify the source and target script.\n\n### Languages\nGTranslate provides an easy way to access languages through the `Language` class. A `Language` object contains the English name, native name, ISO 639-1 code, ISO 639-3 code and the supported services (translation engines).\n\nTo get a `Language` object from its ISO 639-1 code, use the `Language.GetLanguage` or `Language.TryGetLanguage` methods. If the language was not found `Language.GetLanguage` will throw an exception and `Language.TryGetLanguage` will simply return `false`.\nA language can also be obtained through its English/native name, ISO-6393 code and some aliases (like `zh-Hans` or `zh-Hant`).\n\n```c#\nusing GTranslate;\n\nvar french = Language.GetLanguage(\"fr\"); // Get the French language\n\nstring input = Console.ReadLine();\nif (Language.TryGetLanguage(input, out var language)\n{\n    // Use language from input\n}\n```\n\nGTranslate exposes the complete list of languages through a language dictionary class `LanguageDictionary` which can be accessed through `Language.LanguageDictionary`. \nIt is essentially a read-only dictionary of ISO 639-1 codes and their respective languages.\n\n### Results\n\nCalling `TranslateAsync` returns an object deriving from `ITranslationResult`. It contains the translation, souce text, service, source language and target language.\n\nThe same applies to `TransliterateAsync` and `ITransliterationResult` but the transliteration is present instead of the translation.\n\nSome translation engines will provide results with extra data in them. This extra data is exposed through properties in their concrete classes. For example, `GoogleTranslationResult` from (`GoogleTranslator.TranslateAsync`) will sometimes provide the confidence of the translation and the transliteration.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd4n3436%2Fgtranslate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd4n3436%2Fgtranslate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd4n3436%2Fgtranslate/lists"}