-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautotranslate.php
73 lines (71 loc) · 2.85 KB
/
autotranslate.php
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
<?php
use App\Models\Answer;
use App\Models\Note;
use App\Models\Phase;
use App\Models\Plan;
use App\Models\Question;
use App\Models\Questionnaire;
use App\Models\Type;
return [
'source_language' => 'en',
'target_languages' => [
'deepl' => ['el', 'de', 'fr', 'it', 'pl', 'pt-PT', 'es', 'nl'],
'google' => ['hr', 'cs', 'sk', 'sl', 'ga']
],
'api_key' => env('AUTOTRANSLATE_DEEPL_KEY'), // DeepL API key
'api_key_g' => env('AUTOTRANSLATE_GOOGLE_KEY'), // Google Cloud Translation API key
'options' => [ // See: https://github.com/DeepLcom/deepl-php & https://www.deepl.com/docs-api/translate-text
'formality' => 'prefer_more', // Choose the formality of the text. Available options: 'less', 'more', 'default', 'prefer_less', 'prefer_more'.
'split_sentences' => 'nonewlines', // Specify how input text should be split into sentences. Available options: 'on' (default), 'off', 'nonewlines'.
'preserve_formatting' => false, // Controls automatic-formatting-correction (punctuation at beginning/end, upper/lower case at beginning).
'tag_handling' => 'html', // Type of tags to parse before translation. Available options: 'html', 'xml'.
'glossary' => null, // The ID of the DeepL glossary to use. Default: null
],
'language_options' => [], // Language-specific overrides. The key is the language code and the value is an array of options.
'db_entry_sources' => [ // DB entries to translate [model class, text entry function]
[Question::class, 'formattedText'],
[Note::class, 'formattedText'],
[Answer::class, 'text'],
[Phase::class, 'text'],
[Type::class, 'text'],
[Plan::class, 'text'],
[Questionnaire::class, 'text']
],
'excluded_words' => [ // Excluded strings.
'\\n',
'\\r',
'Recommendation-Decision Matrix Tool',
'Recommendation-Decision Matrix tool',
'Recommendation-Decision Matrix',
'Quick Finance Readiness Check',
'TEESlab',
'PROSPECT+',
'HORIZON 2020',
'Horizon 2020',
'SEAPs',
'SECAPs',
'SECAP',
'ESCOs',
'EEOs',
'Own Funds',
'Interacting/Internal Contracting',
'Revolving Funds',
'Soft Loans',
'Green Bonds',
'EPC',
'3rd Party Financing',
'Guarantee Funds',
'On-bill financing',
'Citizens Financing - Cooperatives/Crowdfunding',
'rdmtool.teeslab [at] unipi.gr',
'CBP',
'Google Analytics',
'Google Cloud Translation',
'DeepL',
'API',
'Email',
'Cookies',
'cookies',
'(EU) 2016/679'
],
];