@@ -111,147 +111,51 @@ fi
111
111
# Create all bash variables
112
112
source $script_path /bash_variables.sh
113
113
114
- function updateLocale() {
115
- # Update this locale's repository
116
- # $1: Path to l10n repository
117
- # $2: Locale code
118
- # $3: Repository name
119
-
120
- # Assign input variables to variables with meaningful names
121
- l10n_path=" $1 "
122
- locale=" $2 "
123
- repository_name=" $3 "
124
-
125
- cd $l10n_path /$locale
126
- # Check if there are incoming changesets
127
- hg incoming -r default --bundle incoming.hg 2>&1 > /dev/null
128
- incoming_changesets=$?
129
- if [ $incoming_changesets -eq 0 ]
130
- then
131
- # Update with incoming changesets and remove the bundle
132
- echogreen " Updating $repository_name "
133
- hg pull --update incoming.hg
134
- rm incoming.hg
135
-
136
- # Return 1: we need to create the cache for this locale
137
- return 1
138
- else
139
- echogreen " There are no changes to pull for $repository_name "
140
-
141
- # Return 0: no need to create the cache
142
- return 0
143
- fi
144
- }
145
-
146
114
function updateGeckoStrings() {
147
115
function buildCache() {
148
116
# Build the cache
149
- # $1: Locale code
150
- echogreen " Create cache for $repo_name /$1 "
117
+ # $1: Path containing locale folder
118
+ # $2: Locale code
119
+ local path=" $1 "
120
+ local locale=" $2 "
121
+ echogreen " Create cache for $path /$locale "
151
122
mkdir -p " ${root} TMX/${locale} /"
152
- nice -20 python $install /app/scripts/tmx/tmx_products.py --path $repo_folder / $1 / --locale $1 --ref en-US --repo $repo_name
123
+ nice -20 python $install /app/scripts/tmx/tmx_products.py --path $path / $locale / --locale $locale --ref en-US --repo $repo_name
153
124
}
154
125
155
126
local repo_name=" gecko_strings"
156
127
local repo_folder=" $gecko_strings_path "
157
128
local locale_list=" gecko_strings_locales"
158
129
159
- updated_english=false
130
+ # Update en-US, create TMX for en-US
131
+ git -C $repo_folder /en-US pull
132
+ buildCache $repo_folder en-US
160
133
161
- # Store md5 of the existing en-US cache before updating the repositories
162
- cache_file=" ${root} TMX/en-US/cache_en-US_${repo_name} .php"
163
- if [ -f $cache_file ]
164
- then
165
- existing_md5=($( md5sum $cache_file ) )
166
- else
167
- existing_md5=0
168
- fi
169
-
170
- # Update en-US, create TMX for en-US and check the updated md5
171
- hg --cwd $repo_folder /en-US pull --update -r default
172
- buildCache en-US
173
- updated_md5=($( md5sum $cache_file ) )
174
- if [ $existing_md5 != $updated_md5 ]
134
+ # Pull l10n repository if necessary
135
+ if [ " $checkrepo " = true ]
175
136
then
176
- echo " English strings have been updated."
177
- updated_english=true
137
+ git -C $repo_folder /l10n pull
178
138
fi
179
139
180
140
if [ " $all_locales " = true ]
181
141
then
182
- for locale in $( cat ${! locale_list} )
183
- do
184
- if [ $locale != " en-US" ]
185
- then
186
- if [ -d $repo_folder /$locale ]
187
- then
188
- updated_locale=0
189
- if [ " $checkrepo " = true ]
190
- then
191
- updateLocale $repo_folder $locale $repo_name /$locale
192
- updated_locale=$?
193
- fi
194
-
195
- # Check if we have a cache file for this locale. If it's a brand
196
- # new locale, we'll have the folder and no updates, but we
197
- # still need to create the cache.
198
- cache_file=" ${root} TMX/${locale} /cache_${locale} _${repo_name} .php"
199
- if [ ! -f $cache_file ]
200
- then
201
- echored " Cache doesn't exist for ${repo_name} /${locale} "
202
- updated_locale=1
203
- else
204
- php -l $cache_file 2>&1 1> /dev/null
205
- if [ $? -ne 0 ]
206
- then
207
- # There are PHP errors, force the rebuild
208
- echored " PHP errors in $cache_file . Forcing rebuild."
209
- updated_locale=1
210
- fi
211
- fi
212
-
213
- if [ " $forceTMX " = true -o " $updated_english " = true -o " $updated_locale " -eq 1 ]
214
- then
215
- buildCache $locale
216
- fi
217
- else
218
- echored " Folder $repo_folder /$locale does not exist. Run setup.sh to fix the issue."
219
- fi
220
- fi
221
- done
142
+ locales=$( cat ${! locale_list} )
222
143
else
223
- if [ -d $repo_folder /$locale_code ]
224
- then
225
- updated_locale=0
226
- if [ " $checkrepo " = true ]
227
- then
228
- updateLocale $repo_folder $locale_code $repo_name /$locale_code
229
- updated_locale=$?
230
- fi
144
+ locales=($locale_code )
145
+ fi
231
146
232
- cache_file=" ${root} TMX/${locale_code} /cache_${locale_code} _${repo_name} .php"
233
- if [ ! -f $cache_file ]
147
+ for locale in $locales
148
+ do
149
+ if [ $locale != " en-US" ]
150
+ then
151
+ if [ -d $repo_folder /l10n/$locale ]
234
152
then
235
- echored " Cache doesn't exist for ${repo_name} /${locale_code} "
236
- updated_locale=1
153
+ buildCache $repo_folder /l10n $locale
237
154
else
238
- php -l $cache_file 2>&1 1> /dev/null
239
- if [ $? -ne 0 ]
240
- then
241
- # There are PHP errors, force the rebuild
242
- echored " PHP errors in $cache_file . Forcing rebuild."
243
- updated_locale=1
244
- fi
155
+ echored " Folder $repo_folder /l10n/$locale does not exist. Run setup.sh to fix the issue."
245
156
fi
246
-
247
- if [ " $forceTMX " = true -o " $updated_english " = true -o " $updated_locale " -eq 1 ]
248
- then
249
- buildCache $locale_code
250
- fi
251
- else
252
- echored " Folder $repo_folder /$locale_code does not exist."
253
157
fi
254
- fi
158
+ done
255
159
}
256
160
257
161
function updateCommL10n() {
0 commit comments