Spaces:
Running
Running
<html><head><base href="https://translation.googleapis.com/v3/projects/{project_id}/locations/{location}:translateText"><title>Google Cloud Translation API Response</title> | |
<style> | |
body { | |
font-family: 'Roboto', Arial, sans-serif; | |
line-height: 1.6; | |
color: #202124; | |
max-width: 800px; | |
margin: 0 auto; | |
padding: 20px; | |
background-color: #f8f9fa; | |
} | |
header { | |
background: linear-gradient(135deg, #4285f4, #0f9d58); | |
color: white; | |
text-align: center; | |
padding: 1em; | |
margin-bottom: 2em; | |
border-radius: 8px; | |
} | |
h1, h2, h3 { | |
color: #1a73e8; | |
} | |
.container { | |
background-color: #fff; | |
border-radius: 8px; | |
box-shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15); | |
padding: 20px; | |
margin-bottom: 20px; | |
} | |
.note { | |
background-color: #e8f0fe; | |
border-left: 4px solid #1a73e8; | |
padding: 15px; | |
margin-top: 20px; | |
} | |
pre { | |
background-color: #f1f3f4; | |
border: 1px solid #dadce0; | |
border-radius: 4px; | |
padding: 15px; | |
overflow-x: auto; | |
} | |
code { | |
font-family: 'Roboto Mono', monospace; | |
font-size: 14px; | |
} | |
.translation-result { | |
font-size: 18px; | |
font-weight: bold; | |
color: #0f9d58; | |
margin: 20px 0; | |
padding: 10px; | |
border: 2px solid #0f9d58; | |
border-radius: 4px; | |
text-align: center; | |
} | |
.language-info { | |
display: flex; | |
justify-content: space-between; | |
margin-bottom: 20px; | |
} | |
.language-box { | |
background-color: #e8f0fe; | |
border: 1px solid #4285f4; | |
border-radius: 4px; | |
padding: 10px; | |
width: 45%; | |
} | |
.language-box h3 { | |
margin-top: 0; | |
color: #4285f4; | |
} | |
table { | |
width: 100%; | |
border-collapse: collapse; | |
margin-top: 20px; | |
} | |
th, td { | |
border: 1px solid #dadce0; | |
padding: 12px; | |
text-align: left; | |
} | |
th { | |
background-color: #f1f3f4; | |
font-weight: 500; | |
} | |
</style> | |
</head> | |
<body> | |
<header> | |
<h1>Google Cloud Translation API Response</h1> | |
<p>Translation Result</p> | |
</header> | |
<div class="container"> | |
<h2>Translation Details</h2> | |
<div class="language-info"> | |
<div class="language-box"> | |
<h3>Source Language</h3> | |
<p>English (en)</p> | |
</div> | |
<div class="language-box"> | |
<h3>Target Language</h3> | |
<p>Spanish (es)</p> | |
</div> | |
</div> | |
<h3>Original Text:</h3> | |
<pre><code>"Hello, world!"</code></pre> | |
<h3>Translated Text:</h3> | |
<div class="translation-result"> | |
"¡Hola, mundo!" | |
</div> | |
<h3>Additional Information:</h3> | |
<table> | |
<tr> | |
<th>Property</th> | |
<th>Value</th> | |
</tr> | |
<tr> | |
<td>Detected Language Code</td> | |
<td>en</td> | |
</tr> | |
<tr> | |
<td>Confidence</td> | |
<td>1.0</td> | |
</tr> | |
<tr> | |
<td>Model</td> | |
<td>nmt</td> | |
</tr> | |
</table> | |
</div> | |
<div class="container"> | |
<h3>API Response</h3> | |
<pre><code> | |
{ | |
"translations": [ | |
{ | |
"translatedText": "¡Hola, mundo!", | |
"detectedLanguageCode": "en", | |
"model": "nmt", | |
"glossaryConfig": null | |
} | |
] | |
} | |
</code></pre> | |
</div> | |
<div class="note"> | |
<p><strong>Note:</strong> This is a simulated response based on typical Google Cloud Translation API results. In a real scenario, you would need to provide valid project credentials and make an actual API call to receive the translation. The translation provided here is a common and expected result for the given input.</p> | |
</div> | |
<script> | |
console.log('Google Cloud Translation API response loaded successfully'); | |
</script> | |
</body> | |
</html> |