generated from smartcatai/smartcat-serge-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.serge
183 lines (155 loc) · 6.07 KB
/
config.serge
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
sync
{
ts
{
plugin smartcat_v2
data
{
/*
Provide the base API server URL here. Note that the trailing slash
must be omitted. Options are:
https://smartcat.ai (Europe)
https://us.smartcat.ai (North America)
https://ea.smartcat.ai (Asia)
You will know the server your account is on by signing into your account
and looking at the URL.
*/
base_url https://smartcat.ai
/*
Provide your account ID as it is displayed on
your `Settings > API` page once you sign into
your Smartcat account.
*/
account_id 12345678-abcd-9876-5432-abcdef012345
/*
Go to `Settings > API` page in your account,
and generate an API key. Key name can be anything,
e.g. 'Serge', and the auto-generated secret part
of the key is what needs to be added here.
*/
token 1_AaBbCcDdEeFfGgHhIiJjKkLlM
# Project to synchronize data with. To get the ID, navigate to the
# target project and take it from the URL. For example, if the URL is
# https://us.smartcat.ai/projects/01234567-890a-bcde-f012-34567890abcd/files?documentPage=1
# then the ID will be 01234567-890a-bcde-f012-34567890abcd
project_id 01234567-890a-bcde-f012-34567890abcd
# `--mode=current` = download any translations, even unconfirmed ones (default).
# `--mode=confirmed` = download segments at the confirmed stage
# `--mode=complete` = download segments that passed through all translation stages.
pull_params --mode=confirmed
}
}
vcs
{
plugin git
data
{
add_unversioned YES
clone_params --depth 1
email l10n@mycompany.com
name L10N Robot
local_path data
# Set this parameter to be your Git clone URL. If your repository
# main branch is not called 'master', you need to specify it
# explicitly at the end of the URL, like this: #main
remote_path git@github.com:my-company/my-project.git#main
}
}
}
inc
{
common-job-settings
{
/*
Usually you want to have a single database for all your
translation projects, unless you have multiple source languages.
In that case it is recommended to split databases for each
source language.
*/
db_source DBI:SQLite:dbname=db/translate.db3
db_namespace default
/*
Source language must be recognized by Smartcat.
See https://smartcat.ai/Home/Languages
*/
source_language en
/*
Destination (target) languages must be recognized by Smartcat.
*/
destination_languages de ru
output_bom NO
ts_file_path ts/%LANG%/%FILE%.po
/*
Cross-file repetitions will be handled on Smartcat side
*/
reuse_translations NO
callback_plugins
{
/*
Currently Smartcat expects a flat list of .po files
in each language directory, i.e. it doesn't support
subdirectories in its projects.
The code below will flatten output file paths
by replacing `/` with a custom separator, `--`.
*/
:flatten-ts-file-path
{
plugin replace_strings
phase rewrite_relative_ts_file_path
data
{
replace `\/` `--` g
}
}
/*
Filter out strings that don't need to be translated
*/
:skip-unsupported-strings
{
plugin process_if
phase can_extract
data
{
# Do not extract empty strings as these are not supported by Smartcat.
# Also skip strings consisting of whitespace only since Smartcat
# doesn't show them for translation and keeps them untranslated
# in the output .po file.
if
{
content_matches ^\s*$
then
{
return NO
}
}
# Apply the default rule (allow the extraction of all keys).
if
{
content_matches .
then
{
return YES
}
}
}
}
}
}
}
jobs
{
{
@inherit .#inc/common-job-settings
name Localize JavaScript files
id js
source_dir data/en
source_process_subdirs YES
source_match \.js$
output_file_path data/%LANG%/%FILE%
use_keys_as_context YES
parser
{
plugin parse_js
}
}
}