1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "files": [
12 {
13 "name": "en.json",
14 "role": "source",
15 "content": "{\"cart\":{\"title\":\"Your cart\",\"items\":\"You have {count, plural, one {# item} other {# items}}\",\"checkout\":\"Checkout\"},\"greeting\":\"Hello {name}!\",\"help\":\"See https://example.com/help\",\"save\":\"Save\"}"
16 },
17 {
18 "name": "de.json",
19 "content": "{\"cart\":{\"title\":\"Dein Einkaufswagen\",\"items\":\"Sie haben {count, plural, one {# Artikel}}\",\"checkout\":\"Zur Kasse gehen und bezahlen\"},\"greeting\":\"Hallo {nom}!\",\"help\":\"Siehe https://example.com/hilfe\",\"old\":\"Alt\"}"
20 }
21 ],
22 "glossary": [
23 {
24 "source": "cart",
25 "target": "Warenkorb",
26 "locale": "de"
27 },
28 {
29 "source": "Einkaufswagen",
30 "forbidden": true,
31 "target": "Warenkorb",
32 "locale": "de"
33 }
34 ],
35 "formality": {
36 "de": "formal"
37 }
38};
39
40
41const run = await client.actor("siteverdict/siteverdict-translation-qa").call(input);
42
43
44console.log('Results from dataset');
45console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
46const { items } = await client.dataset(run.defaultDatasetId).listItems();
47items.forEach((item) => {
48 console.dir(item);
49});
50
51