# import requests
# import json

# webhook_url = 'http://127.0.0.1:5000/webhook'

# data = { 'name': 'Request three', 
#          'Channel URL': 'test url3' }

# r = requests.post(webhook_url, data=json.dumps(data), headers={'Content-Type': 'application/json'})

kv_strings1 = [
    "Accounts", "Inbox", "Sent", "Draft", "Trash", "All Mails", "All labels", "Address Book", "Settings", "Purchase", "New address", "Network status"
     "My addresses", "Chats", "No Chat", "Contacts", "Send", "Available Credits", "+Add more credits", "Select method to make an address",
     "Pseudorandom Generator", "Passphrase (deterministic) Generator", "Proceed Next", "Enter a label to generate address for", 
     "to ", "Type or Scan QR code for recipients address", "My Addresses", "Total connections", "Total Connections", "Processes",
     "person-to-person", "Brodcast", "publickeys", "objects", "Label", "Address", "Send message from", "Show QR code", "Cancel",
    "Yes", "No", "From ", "[b]", "Date  ", "User Interface", "Start-on-login not yet supported on your OS", "Tray"]

kv_strings2 = ["Start Bitmessage in the tray(don't show main window)", "Minimize to tray", "Close to tray", "Hide connection notifications",
    "Show notification when message received", "Use identicons", "Reply below Quote", "Interface Language", "Apply", "Listening port",
    "Listen for connections on port", "8444", "UPnP", "Proxy server / Tor", "Type", "Server hostname", "localhost", "Port", "9050", "Username",
    "Pass", "Authentication", "Listen for incoming connections when using proxy", "Only connect to onion services(*.onion)", "Bandwidth limit"]

kv_strings3 = ["Maximum download rate (kB/s):[0:unlimited]", "0", "Maximum upload rate (kB/s):[0:unlimited]", "Maximum outbound connections:[0:none]",
    "Total difficulty", "00000.0", "Small message difficulty", "Maximum acceptable total difficulty",
    "Hardware GPU acceleration (OpenCL)", "OK", "Leave these input fields blank for the default behavior.",
    "Give up after", "days and", "Connect to", "Namecoind", "NMControl", "hostname", "Password"]

demo_str = ['hello', 'this', 'is']
translated_dict = {}

from deep_translator import GoogleTranslator

for string in kv_strings1:
    try:
        int(string)
    except:
        to_translate = string
        translated = GoogleTranslator(source='auto', target='fr').translate(to_translate)
        translated_dict[string] = translated

# for string in kv_strings2:
#     to_translate = string
#     translated = GoogleTranslator(source='auto', target='fr').translate(to_translate)
#     translated_dict[string] = translated

# for string in kv_strings3:
#     to_translate = string
#     translated = GoogleTranslator(source='auto', target='fr').translate(to_translate)
#     translated_dict[string] = translated

print(translated_dict)


{
    'Accounts': 'Comptes', 'Inbox': 'Boîte de réception', 'Sent': 'Envoyé', 'Draft': 'Brouillon', 'Trash': 'Déchets', 'All Mails': 'Tous les e-mails', 
'All labels': 'Toutes les étiquettes', 'Address Book': "Carnet d'adresses", 'Settings': 'Réglages', 'Purchase': 'Acheter', 'New address': 'Nouvelle adresse', 
'Network statusMy addresses': 'État du réseauMes adresses', 'Chats': 'Chats', 'No Chat': 'Pas de message texte', 'Contacts': 'Contacts', 'Send': 'Envoyer',
 'Available Credits': 'Crédits disponibles', '+Add more credits': '+Ajouter plus de crédits', 
 'Select method to make an address': 'Sélectionnez la méthode pour créer une adresse', 'Pseudorandom Generator': 'Générateur pseudo-aléatoire', 
 'Passphrase (deterministic) Generator': 'Générateur de phrase de passe (déterministe)', 'Proceed Next': 'Procéder ensuite', 
 'Enter a label to generate address for': "Entrez une étiquette pour générer l'adresse pour", 'to ': 'à', 
 'Type or Scan QR code for recipients address': "Tapez ou scannez le code QR pour l'adresse des destinataires",
  'My Addresses': 'Mes adresses', 'Total connections': 'Connexions totales', 'Total Connections': 'Connexions totales', 
  'Processes': 'Processus', 'person-to-person': 'personne à personne', 'Brodcast': 'Diffusion', 'publickeys': 'clés publiques',
   'objects': 'objets', 'Label': 'Étiquette', 'Address': 'Adresse', 'Send message from': 'Envoyer un message de', 'Show QR code': 'Afficher le code QR', 
   'Cancel': 'Annuler', 'Yes': 'Oui', 'No': 'Non', 'From ': 'De', '[b]': '[c]', 'Date  ': 'Date', 'User Interface': 'Interface utilisateur',
    'Start-on-login not yet supported on your OS': "Start-on-login n'est pas encore pris en charge sur votre système d'exploitation", 'Tray': 'Plateau'
    }