forked from liferay/liferay-portal
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-test-translation.xml
191 lines (171 loc) · 5.89 KB
/
build-test-translation.xml
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
184
185
186
187
188
189
190
191
<?xml version="1.0"?>
<project basedir="." default="test" name="build-test-translation" xmlns:antelope="antlib:ise.antelope.tasks" xmlns:if="ant:if" xmlns:unless="ant:unless">
<import file="build-test.xml" />
<target name="copy-translation-file">
<if>
<equals arg1="${dependencyFile}" arg2="true" />
<then>
<copy
file="modules/apps/translation/translation-test/src/testFunctional/tests/dependencies/${translation.zip.file.name}/${translation.file.name}"
tofile="${selenium.output.dir.name}/${translation.file.name}"
/>
</then>
<else>
<copy
file="${selenium.output.dir.name}/${translation.zip.file.name}/${translation.file.name}"
tofile="${selenium.output.dir.name}/${translation.file.name}"
/>
</else>
</if>
</target>
<target name="unzip-translation-file">
<antelope:stringutil property="fileName" string="${fileName}">
<antelope:replace regex="\*" replacement=" " />
</antelope:stringutil>
<unzip
dest="${selenium.output.dir.name}"
src="${selenium.output.dir.name}/${fileName}"
/>
</target>
<target name="update-translation-file">
<var name="translation.file.type" value="xlf" />
<antelope:stringutil property="translation.file.name" string="${translation.file.name}">
<antelope:replace regex="\*" replacement=" " />
</antelope:stringutil>
<antelope:stringutil property="translation.zip.file.name" string="${translation.zip.file.name}">
<antelope:replace regex="\*" replacement=" " />
</antelope:stringutil>
<if>
<equals arg1="${translation.zip.file.name}" arg2="WCGeneralName" />
<then>
<var name="translation.zip.file.name" value="Web Content Article Translations-en_US" />
</then>
</if>
<if>
<equals arg1="${operation}" arg2="unzip" />
<then>
<unzip
dest="${selenium.output.dir.name}/${translation.zip.file.name}"
src="${selenium.output.dir.name}/${translation.zip.file.name}.zip"
/>
</then>
</if>
<if>
<equals arg1="${translation.file.rename}" arg2="true" />
<then>
<move
file="${selenium.output.dir.name}/${translation.zip.file.name}/${translation.file.name}.${translation.file.type}"
tofile="${selenium.output.dir.name}/${translation.zip.file.name}/${translation.file.name}.xliff"
/>
<var name="translation.file.type" value="xliff" />
</then>
</if>
<if>
<equals arg1="${contentpage.translation.file}" arg2="true" />
<then>
<pathconvert property="translation.file.path">
<path>
<fileset
dir="${selenium.output.dir.name}/${translation.zip.file.name}"
includes="*${translation.file.name}.${translation.file.type}"
/>
</path>
</pathconvert>
<replace
file="${translation.file.path}"
token="${contentpage.translation.title.target.original}"
value="${contentpage.translation.title.target}"
/>
<replace
file="${translation.file.path}"
token="${contentpage.translation.fragment.target.original}"
value="${contentpage.translation.fragment.target}"
/>
</then>
<else>
<replace
file="${selenium.output.dir.name}/${translation.zip.file.name}/${translation.file.name}.${translation.file.type}"
token="${translation.title.target.original}"
value="${translation.title.target}"
/>
<replace
file="${selenium.output.dir.name}/${translation.zip.file.name}/${translation.file.name}.${translation.file.type}"
token="${translation.description.target.original}"
value="${translation.description.target}"
/>
<replace
file="${selenium.output.dir.name}/${translation.zip.file.name}/${translation.file.name}.${translation.file.type}"
token="${translation.content.target.original}"
value="${translation.content.target}"
/>
</else>
</if>
<if>
<equals arg1="${translation.file.encoding}" arg2="utf8" />
<then>
<pathconvert property="translation.file.path">
<path>
<fileset
dir="${selenium.output.dir.name}/${translation.zip.file.name}"
includes="*${translation.file.name}.${translation.file.type}"
/>
</path>
</pathconvert>
<propertyregex
input="${translation.file.path}"
property="translation.utf8.file.path"
regexp=".xlf"
replace="_utf8.xlf"
/>
<copy
file="${translation.file.path}"
outputencoding="UTF-8"
tofile="${translation.utf8.file.path}"
/>
</then>
</if>
<if>
<equals arg1="${operation}" arg2="zip" />
<then>
<zip
basedir="${selenium.output.dir.name}/${translation.zip.file.name}"
destfile="${selenium.output.dir.name}/${translation.zip.file.name}_translated.zip"
/>
</then>
</if>
</target>
<target name="update-translation-file-id">
<var name="translation.file.type" value="xlf" />
<antelope:stringutil property="translation.file.name" string="${translation.file.name}">
<antelope:replace regex="\*" replacement=" " />
</antelope:stringutil>
<antelope:stringutil property="translation.zip.file.name" string="${translation.zip.file.name}">
<antelope:replace regex="\*" replacement=" " />
</antelope:stringutil>
<if>
<equals arg1="${translation.zip.file.name}" arg2="WCGeneralName" />
<then>
<var name="translation.zip.file.name" value="Web Content Article Translations-en_US" />
</then>
</if>
<if>
<equals arg1="${dependencyFile}" arg2="true" />
<then>
<var name="translation.file.path" value="${selenium.output.dir.name}/${translation.file.name}.${translation.file.type}" />
<replace
file="${translation.file.path}"
token="${translation.entry.type}:"
value="${translation.entry.type}:${structuredContentId}"
/>
</then>
<else>
<var name="translation.file.path" value="${selenium.output.dir.name}/${translation.zip.file.name}/${translation.file.name}.${translation.file.type}" />
<replace
file="${translation.file.path}"
token="${translation.entry.type}:"
value="${translation.entry.type}:1"
/>
</else>
</if>
</target>
</project>