forked from franciscop/translate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
29 lines (25 loc) · 795 Bytes
/
index.html
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
<!-- Small manual front-end test to see it all works -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Translate example</title>
</head>
<body>
<p class="greeting">
Input the key manually in the console like this:
<code>translate.key = 'KEYHERE';</code>
Then call test() from the console.
</p>
<script src="translate.js"></script>
<script>
const test = async () => {
const text = await translate('Hello world', { from: 'en', to: 'es' });
document.querySelector('.greeting').innerText = `Hello world => ${text}`;
console.log('Done! Look at the website :)');
};
</script>
</body>
</html>