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
|
<?php /** * API keys/settings screen */
$this->extend('../layout'); /* @var Loco_mvc_ViewParams $ui */ /* @var Loco_mvc_ViewParams[] $apis */ /* @var Loco_mvc_ViewParams $nonce */ $help = apply_filters('loco_external','https://localise.biz/wordpress/plugin/manual/providers'); ?>
<form action="" method="post" enctype="application/x-www-form-urlencoded"> <input type="hidden" name="<?php $nonce->e('name')?>" value="<?php $nonce->e('value')?>" /> <table class="form-table"> <tbody><?php // DEEPL $api = $apis['deepl']?> <tr> <th scope="row"><?php $api->e('name')?></th> <td> <fieldset> <legend class="screen-reader-text"> <span><?php $ui->e('api_key')?></span> </legend> <p> <label for="loco--deepl_api_key"> <?php $ui->e('api_key')?>: </label> <input type="text" size="50" name="api[deepl][key]" id="loco--deepl_api_key" value="<?php $api->e('key')?>" spellcheck="false" /> </p> <p> <span class="description"><a href="https://www.deepl.com/translator" target="_blank" tabindex="-1">https://www.deepl.com/translator</a></span> </p> </fieldset> </td> </tr><?php // GOOGLE $api = $apis['google']?> <tr> <th scope="row"><?php $api->e('name')?></th> <td> <fieldset> <legend class="screen-reader-text"> <span><?php $ui->e('api_key')?></span> </legend> <p> <label for="loco--google_api_key"> <?php $ui->e('api_key')?>: </label> <input type="text" size="50" name="api[google][key]" id="loco--google_api_key" value="<?php $api->e('key')?>" spellcheck="false" /> </p> <p> <span class="description"><a href="https://cloud.google.com/translate/" target="_blank" tabindex="-1">https://cloud.google.com/translate</a></span> </p> </fieldset> </td> </tr><?php // LECTO AI $api = $apis['lecto']?> <tr> <th scope="row"><?php $api->e('name')?></th> <td> <fieldset> <legend class="screen-reader-text"> <span><?php $ui->e('api_key')?></span> </legend> <p> <label for="loco--lecto_api_key"> <?php $ui->e('api_key')?>: </label> <input type="text" size="50" name="api[lecto][key]" id="loco--lecto_api_key" value="<?php $api->e('key')?>" spellcheck="false" /> </p> <p> <span class="description"><a href="https://lecto.ai/?ref=loco" target="_blank" tabindex="-1">https://lecto.ai/?ref=loco</a></span> </p> </fieldset> </td> </tr><?php // MICROSOFT $api = $apis['microsoft']?> <tr> <th scope="row"><?php $api->e('name')?></th> <td> <fieldset> <legend class="screen-reader-text"> <span><?php $ui->e('api_key')?></span> </legend> <p> <label for="loco--microsoft_api_key"> <?php $ui->e('api_key')?>: </label> <input type="text" size="50" name="api[microsoft][key]" id="loco--microsoft_api_key" value="<?php $api->e('key')?>" spellcheck="false" /> </p> <p> <label for="loco--microsoft_api_region"> <?php $ui->e('api_region')?>: </label> <input type="text" size="20" name="api[microsoft][region]" id="loco--microsoft_api_region" value="<?php $api->e('region')?>" spellcheck="false" placeholder="global" /> </p> <p> <span class="description"><a href="https://aka.ms/MicrosoftTranslator" target="_blank" tabindex="-1">https://aka.ms/MicrosoftTranslator</a></span> </p> </fieldset> </td> </tr><?php // OPENAI (CHATGPT) $api = $apis['openai']?> <tr> <th scope="row"><?php $api->e('name')?></th> <td> <fieldset> <legend class="screen-reader-text"> <span><?php $ui->e('api_key')?></span> </legend> <p> <label for="loco--openai_api_key"> <?php $ui->e('api_key')?>: </label> <input type="text" size="50" name="api[openai][key]" id="loco--openai_api_key" value="<?php $api->e('key')?>" spellcheck="false" /> </p> <p> <label for="loco--openai_api_model"> Model: </label> <input type="text" size="50" name="api[openai][model]" id="loco--openai_api_model" value="<?php $api->e('model')?>" placeholder="gpt-4o-mini" spellcheck="false" /> </p> <p> <label for="loco--openai_prompt" style="vertical-align: top"> Prompt: </label> <textarea class="regular-text" name="api[openai][prompt]" id="loco--openai_prompt"><?php $api->e('prompt')?></textarea> </p> <p> <span class="description"><a href="https://platform.openai.com/" target="_blank" tabindex="-1">https://platform.openai.com/</a></span> </p> </fieldset> </td> </tr><?php /* @var Loco_mvc_ViewParams[] $hooked */ foreach( $hooked as $api ):?> <tr> <th scope="row"><?php $api->e('name')?></th> <td> <p><?php $api->key ? esc_html_e('Configured externally','loco-translate') : esc_html_e('No API key','loco-translate') ?><br /> <span class="description"><a href="<?php $api->e('url')?>" target="_blank" tabindex="-1"><?php $api->e('url')?></a></span> </p> </td> </tr><?php endforeach?> </tbody> </table>
<div class="panel"> <p> <strong class="has-icon"><?php esc_html_e('Important','loco-translate')?>:</strong> <span> <?php esc_html_e('Third party services are subject to their own terms of use and may incur costs from the provider','loco-translate')?>. <a href="<?php self::e($help)?>#legal" target="_blank" tabindex="-1"><?php esc_html_e('See full disclaimer','loco-translate')?></a>. </span> </p> </div>
<p class="submit"> <input type="submit" class="button-primary" value="<?php esc_html_e('Save settings','loco-translate')?>" /> <a class="button button-link" href="<?php self::e($help)?>" target="_blank"><?php esc_html_e('Documentation','loco-translate')?></a> </p> </form>
|