-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmartling-config-example.json
93 lines (88 loc) · 6.4 KB
/
smartling-config-example.json
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
{
// Locales array defines which languages are requested for translation. These locales must already exist in the Smartling project.
// You can have one or more locales, but smartling locale name must be unique
// Each locale has two required attributes
// smartling - the locale name in Smartling, available from the API settings in the Smartling project
// application - the corresponding locale name in your system. This value is used in the translation commit message
"locales": [
{
"smartling" : "zh-CN",
"application" : "zh-Hans"
},
{
"smartling" : "zh-TW",
"application" : "zh-Hant"
}
],
// Resource sets that are uploaded to Smartling. You can have one or more resource sets defined by file type.
// Each set has following attributes
// type - defines Smartling type for the resources. It is required attribute.
// See supported types https://docs.smartling.com/display/docs/Supported+File+Types
// If you have resources of several types you need to create several resource sets:
// one or more for each of the type
// authorizeContent - defines whether uploaded content will automatically be authorized for translation.
// Possible values: "true" or "false". Default value is "true".
// pathRegex - regular expression that filters resources to send to Smartling. It is required attribute.
// Expression has groovy (Java 7) format. See http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
// Regex is applied to file paths relative to repository root. An example, you have file
// https://github.com/user/test-repo/master/messages/test.properties. Regex will be applied
// to "messages/test.properties".
// Due to regex is located in JSON some special symbols must be double escaped. An example:
// - "." must be double escaped "\\." (first slash is regex escaping, second slash is JSON escaping)
// - "/" must be double escaped "\\/" (first slash is regex escaping, second slash is JSON escaping)
// translationPathExpression - groovy expression that is used to create a file path and name for translated files.
// If this parameter is empty or undefined translated files won't be pushed back from Smartling to repository.
// See https://docs.smartling.com/display/docs/Repository+Connector+-+Configure+your+Code+Repository for the details
// translationCommitMessage - groovy expression that defining a translation commit message. If it is empty or undefined default message will be used
// smartlingDirectives - string array with additional Smartling directives. Allowed directives depend on resource type.
// See https://docs.smartling.com/display/docs/Supported+File+Types#SupportedFileTypes-java
"resourceSets": [
// Minimal recourse set definition. Translations won't be pushed back.
{
"type" : "javaProperties",
"pathRegex" : "messages\\/.*\\.properties"
},
// Translation set for docx files, translation results will be put to "translated" sub-folder and translated locale will be added to result file names.
// Custom commit message is also defined
{
"type" : "docx",
"pathRegex" : "documentation\\/.*\\.docx",
"translationPathExpression" : "translated/${originalFile.baseName}_${locale}.${originalFile.extension}",
"translationCommitMessage" : "Translate ${originalFile.fullName} to ${locale}"
},
// Translation set with manual authorization. You should go to Smartling and authorize strings for translation after upload.
// Original resources have "_en" suffix and this suffix will be replaced with target locale in translations.
{
"type" : "xml",
"authorizeContent" : "false",
"pathRegex" : "messages\\/.*_en\\.xml",
"translationPathExpression" : "${originalFile.path}${originalFile.baseName.replaceAll('_en$', '_'+locale)}.${originalFile.extension}"
},
// Resource set includes all properties files from /web/messages/en folder and all it sub-folders.
// Named group <path> is defined in the pathRegex value. For this group variable "path" will be created with corresponded value during
// translation path evaluation in groovy.
// Example:
// /web/messages/en/test.properties - translation for zh-CN locale will be placed to /web/messages/zh-Hans/test.properties
// Custom locale name is defined in this file in "locales" array.
// /web/messages/en/admin/main_screen/title.properties - translation for zh-TW locale will be placed to
// /web/messages/zh-Hant/admin/main_screen/title.properties
{
"type" : "javaProperties",
"authorizeContent" : "true",
"pathRegex" : "web\\/messages\\/en/(?<path>.*)\\.properties",
"translationPathExpression" : "web/messages/${locale}/${path}.${originalFile.extension}",
"translationCommitMessage" : "Task TRN-18 translate ${originalFile.name} to ${locale}\n${translatedFile.fullName}"
},
// Translate all properties files from /msg folder and put translations to a /msg sub-folder that has the same name as translated locale.
// Two additional Smartling directives are provided.
{
"type" : "javaProperties",
"pathRegex" : "msg\\/.*\\.properties",
"translationPathExpression" : "msg/${locale}/${originalFile.name}",
"smartlingDirectives" : [
"smartling.placeholder_format = YAML",
"smartling.variants_enabled = true"
]
}
]
}