Методы перевода с африкаанс на английский с примерами кода

from googletrans import Translator
def translate_afrikaans_to_english(text):
translator = Translator(service_urls=['translate.google.com'])
translation = translator.translate(text, src='af', dest='en')
return translation.text
translated_text = translate_afrikaans_to_english('Jy is welkom')
print(translated_text)  # Output: "You are welcome"
from textblob import TextBlob
def translate_afrikaans_to_english(text):
blob = TextBlob(text)
translation = blob.translate(from_lang='af', to='en')
return translation
translated_text = translate_afrikaans_to_english('Jy is welkom')
print(translated_text)  # Output: "You are welcome"
import requests
def translate_afrikaans_to_english(text, subscription_key):
endpoint = "https://api.cognitive.microsofttranslator.com/translate"
headers = {
    "Ocp-Apim-Subscription-Key": subscription_key,
    "Content-Type": "application/json",
    "Ocp-Apim-Subscription-Region": "your_region"  # Replace with the appropriate region
}
params = {
    "api-version": "3.0",
    "to": "en"
}
body = [
    {
        "text": text
    }
]
response = requests.post(endpoint, headers=headers, params=params, json=body)
translation = response.json()[0]["translations"][0]["text"]
return translation
subscription_key = "your_subscription_key"  # Replace with your own subscription key
translated_text = translate_afrikaans_to_english('Jy is welkom', subscription_key)
print(translated_text)  # Output: "You are welcome"