-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
269 lines (248 loc) · 10.8 KB
/
Copy pathindex.html
File metadata and controls
269 lines (248 loc) · 10.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Azure Translator</title>
<!-- Google Fonts: Syne (display) + DM Sans (body) -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Syne:wght@600;800&family=DM+Sans:wght@300;400;500&display=swap" rel="stylesheet" />
<!-- Main stylesheet -->
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<!-- ========== HEADER ========== -->
<header class="header">
<div class="header-inner">
<div class="logo">
<!-- Inline SVG globe icon -->
<svg class="logo-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"/>
<path d="M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/>
</svg>
<span class="logo-text">Azure <strong>Translate</strong></span>
</div>
<p class="header-tagline">Powered by Microsoft Azure Cognitive Services</p>
</div>
</header>
<!-- ========== MAIN CONTENT ========== -->
<main class="main">
<!-- ── API CREDENTIALS SECTION ── -->
<section class="credentials-card" id="credentials-section">
<div class="credentials-header">
<svg class="cred-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
<path d="M7 11V7a5 5 0 0 1 10 0v4"/>
</svg>
<h2 class="credentials-title">API Credentials</h2>
<!-- Toggle button to collapse/expand credentials -->
<button class="toggle-creds" id="toggle-creds-btn" aria-label="Toggle credentials panel">
<svg id="toggle-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
<polyline points="18 15 12 9 6 15"/>
</svg>
</button>
</div>
<!-- Collapsible credentials body -->
<div class="credentials-body" id="credentials-body">
<p class="credentials-hint">
Get your free key at
<a href="https://portal.azure.com" target="_blank" rel="noopener noreferrer">portal.azure.com</a>
→ Create a resource → Translator.
</p>
<div class="creds-grid">
<!-- API Key input -->
<div class="form-group">
<label for="api-key">API Key <span class="required">*</span></label>
<div class="input-wrapper">
<input
type="password"
id="api-key"
placeholder="Paste your Azure subscription key"
autocomplete="off"
spellcheck="false"
/>
<!-- Show/hide password toggle -->
<button class="eye-btn" id="toggle-key-visibility" aria-label="Toggle key visibility">
<svg id="eye-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
<circle cx="12" cy="12" r="3"/>
</svg>
</button>
</div>
</div>
<!-- Region input -->
<div class="form-group">
<label for="region">Region / Location <span class="required">*</span></label>
<input
type="text"
id="region"
placeholder="e.g. eastus, westeurope, centralindia"
autocomplete="off"
/>
</div>
</div>
</div>
</section>
<!-- ── TRANSLATOR CARD ── -->
<section class="translator-card">
<!-- Language selectors row -->
<div class="lang-row">
<!-- Source language -->
<div class="lang-group">
<label for="source-lang">Translate from</label>
<select id="source-lang">
<option value="auto">Detect Language</option>
<!-- Languages are populated dynamically via JS, but a few defaults below -->
<option value="en">English</option>
<option value="es">Spanish</option>
<option value="fr">French</option>
<option value="de">German</option>
<option value="it">Italian</option>
<option value="pt">Portuguese</option>
<option value="zh-Hans">Chinese (Simplified)</option>
<option value="zh-Hant">Chinese (Traditional)</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="ar">Arabic</option>
<option value="hi">Hindi</option>
<option value="ru">Russian</option>
<option value="nl">Dutch</option>
<option value="pl">Polish</option>
<option value="tr">Turkish</option>
<option value="sv">Swedish</option>
<option value="da">Danish</option>
<option value="fi">Finnish</option>
<option value="nb">Norwegian</option>
<option value="uk">Ukrainian</option>
<option value="cs">Czech</option>
<option value="ro">Romanian</option>
<option value="hu">Hungarian</option>
<option value="id">Indonesian</option>
<option value="ms">Malay</option>
<option value="th">Thai</option>
<option value="vi">Vietnamese</option>
<option value="el">Greek</option>
<option value="he">Hebrew</option>
<option value="bn">Bengali</option>
<option value="ta">Tamil</option>
<option value="ur">Urdu</option>
</select>
</div>
<!-- Swap languages button -->
<button class="swap-btn" id="swap-btn" title="Swap languages" aria-label="Swap source and target languages">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
<path d="M7 16V4m0 0L3 8m4-4l4 4"/>
<path d="M17 8v12m0 0l4-4m-4 4l-4-4"/>
</svg>
</button>
<!-- Target language -->
<div class="lang-group">
<label for="target-lang">Translate to</label>
<select id="target-lang">
<option value="es">Spanish</option>
<option value="en">English</option>
<option value="fr">French</option>
<option value="de">German</option>
<option value="it">Italian</option>
<option value="pt">Portuguese</option>
<option value="zh-Hans">Chinese (Simplified)</option>
<option value="zh-Hant">Chinese (Traditional)</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="ar">Arabic</option>
<option value="hi">Hindi</option>
<option value="ru">Russian</option>
<option value="nl">Dutch</option>
<option value="pl">Polish</option>
<option value="tr">Turkish</option>
<option value="sv">Swedish</option>
<option value="da">Danish</option>
<option value="fi">Finnish</option>
<option value="nb">Norwegian</option>
<option value="uk">Ukrainian</option>
<option value="cs">Czech</option>
<option value="ro">Romanian</option>
<option value="hu">Hungarian</option>
<option value="id">Indonesian</option>
<option value="ms">Malay</option>
<option value="th">Thai</option>
<option value="vi">Vietnamese</option>
<option value="el">Greek</option>
<option value="he">Hebrew</option>
<option value="bn">Bengali</option>
<option value="ta">Tamil</option>
<option value="ur">Urdu</option>
</select>
</div>
</div>
<!-- Text areas row -->
<div class="text-row">
<!-- Input box -->
<div class="text-panel input-panel">
<div class="panel-header">
<span class="panel-label" id="source-label">Source Text</span>
<!-- Character counter -->
<span class="char-count"><span id="char-count">0</span> / 5000</span>
</div>
<textarea
id="input-text"
class="text-area"
placeholder="Enter text to translate…"
maxlength="5000"
aria-label="Source text"
spellcheck="true"
></textarea>
<!-- Clear button -->
<button class="clear-btn" id="clear-btn" title="Clear text" aria-label="Clear input">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
<line x1="18" y1="6" x2="6" y2="18"/>
<line x1="6" y1="6" x2="18" y2="18"/>
</svg>
</button>
</div>
<!-- Output box -->
<div class="text-panel output-panel">
<div class="panel-header">
<span class="panel-label" id="target-label">Translation</span>
<!-- Copy to clipboard button -->
<button class="copy-btn" id="copy-btn" title="Copy translation" aria-label="Copy to clipboard">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
</svg>
<span id="copy-label">Copy</span>
</button>
</div>
<!-- Output is a read-only textarea for easy selection -->
<textarea
id="output-text"
class="text-area output-area"
placeholder="Translation will appear here…"
readonly
aria-label="Translated text"
aria-live="polite"
></textarea>
<!-- Detected language badge -->
<div class="detected-badge" id="detected-badge" aria-live="polite"></div>
</div>
</div>
<!-- Translate button + status -->
<div class="actions-row">
<div class="status-area" id="status-area" aria-live="polite"></div>
<button class="translate-btn" id="translate-btn">
<span class="btn-text">Translate</span>
<!-- Spinner shown while loading -->
<span class="spinner" id="spinner" aria-hidden="true"></span>
</button>
</div>
</section><!-- /translator-card -->
</main><!-- /main -->
<!-- ========== FOOTER ========== -->
<footer class="footer">
<p>Built with Azure Cognitive Services · Translator Text API v3.0</p>
</footer>
<!-- Main JavaScript -->
<script src="app.js"></script>
</body>
</html>