-//inject apps
-$appsCacheFile = $cacheDir . 'connect-apps.min.json';
-if (!file_exists($appsCacheFile)) {
- header('Content-Type: text/plain');
- echo "Cache file missing: connect-apps.min.json\n";
- exit(1);
-}
-$json = str_replace('"FIXME_APPS"', file_get_contents($appsCacheFile), $json);
-
-
-//inject featured apps
-$featuredAgesCacheFile = $cacheDir . 'connect-featured-ages.min.json';
-if (!file_exists($featuredAgesCacheFile)) {
- header('Content-Type: text/plain');
- echo "Cache file missing: connect-featured-ages.min.json\n";
- exit(1);
+$placeholderFiles = [
+ 'PLACEHOLDER_APPS' => $cacheDir . 'connect-apps.min.json',
+ 'PLACEHOLDER_AGES' => $cacheDir . 'connect-featured-ages.min.json',
+ 'PLACEHOLDER_UITRANSLATION' => $cacheDir . 'connect-uitranslation.min.json',
+];
+foreach ($placeholderFiles as $placeholder => $cacheFile) {
+ //inject apps
+ if (!file_exists($cacheFile)) {
+ header('Content-Type: text/plain');
+ echo "Cache file missing: $cacheFile\n";
+ exit(1);
+ }
+ $json = str_replace(
+ '"' . $placeholder . '"',
+ trim(file_get_contents($cacheFile)),
+ $json
+ );