gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 1 | <?php |
| 2 | /******************************************************************************* |
| 3 | * Copyright (c) 2008 Eclipse Foundation and others. |
| 4 | * All rights reserved. This program and the accompanying materials |
| 5 | * are made available under the terms of the Eclipse Public License v1.0 |
| 6 | * which accompanies this distribution, and is available at |
| 7 | * http://www.eclipse.org/legal/epl-v10.html |
| 8 | * |
| 9 | * Contributors: |
| 10 | * Eclipse Foundation - Initial API and implementation |
droy | 133e746 | 2008-05-13 17:37:24 +0000 | [diff] [blame] | 11 | * Motoki MORT mori-m@mxa.nes.nec.co.jp - patch, bug 227366 |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 12 | * Kit Lo (IBM) - patch, bug 217339, generate pseudo translations language packs |
| 13 | *******************************************************************************/ |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 14 | |
| 15 | /* |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 16 | * Documentation: http://wiki.eclipse.org/Babel_/_Server_Tool_Specification#Outputs |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 17 | */ |
gobrien | b854dcb | 2008-01-30 18:50:45 +0000 | [diff] [blame] | 18 | |
droy | b6e25c7 | 2008-07-18 13:01:13 +0000 | [diff] [blame] | 19 | ob_start(); |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 20 | ini_set("memory_limit", "12M"); |
| 21 | define("BABEL_BASE_DIR", "../../"); |
gobrien | b854dcb | 2008-01-30 18:50:45 +0000 | [diff] [blame] | 22 | |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 23 | define("USE_PHOENIX", false); |
| 24 | require(BABEL_BASE_DIR."html/global.php"); |
droy | b6e25c7 | 2008-07-18 13:01:13 +0000 | [diff] [blame] | 25 | InitPage(""); |
| 26 | |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 27 | $work_dir = "/home/babel-working/"; |
| 28 | if (!($ini = @parse_ini_file(BABEL_BASE_DIR."classes/base.conf"))) { |
gobrien | b854dcb | 2008-01-30 18:50:45 +0000 | [diff] [blame] | 29 | errorLog("Failed to find/read database conf file - aborting."); |
| 30 | exitTo("error.php?errNo=101300","error: 101300 - database conf can not be found"); |
| 31 | } |
gobrien | b854dcb | 2008-01-30 18:50:45 +0000 | [diff] [blame] | 32 | $context = $ini['context']; |
gobrien | b854dcb | 2008-01-30 18:50:45 +0000 | [diff] [blame] | 33 | |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 34 | $work_context_dir = $work_dir.$context."/"; |
| 35 | $tmp_dir = $work_context_dir."tmp/"; |
| 36 | $output_dir = $work_context_dir."output/"; |
| 37 | $source_files_dir = "source_files_for_generate/"; |
gobrien | b854dcb | 2008-01-30 18:50:45 +0000 | [diff] [blame] | 38 | |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 39 | $leader = ". . "; |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 40 | $timestamp = date("Ymdhis"); |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 41 | |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 42 | exec("rm -rf $work_dir*"); |
| 43 | exec("mkdir $work_context_dir"); |
| 44 | exec("mkdir $output_dir"); |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 45 | |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 46 | echo "Generating update site\n"; |
| 47 | $train_result = mysql_query('SELECT DISTINCT train_id FROM release_train_projects'); |
| 48 | while (($train_row = mysql_fetch_assoc($train_result)) != null) { |
| 49 | $train_id = $train_row['train_id']; |
| 50 | $train_version = "3.4.0"; |
| 51 | if (strcmp($train_id, "europa") == 0) { |
| 52 | $train_version = "3.3.0"; |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 53 | } |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 54 | $site_xml = ''; |
| 55 | |
| 56 | $output_dir_for_train = $output_dir . $train_row['train_id'] . "/"; |
| 57 | exec("mkdir $output_dir_for_train"); |
| 58 | exec("mkdir ${output_dir_for_train}features/"); |
| 59 | exec("mkdir ${output_dir_for_train}plugins/"); |
| 60 | |
| 61 | # $language_result = mysql_query( 'SELECT * FROM languages WHERE languages.is_active' ); |
| 62 | $language_result = mysql_query('SELECT * FROM languages WHERE languages.is_active'); |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 63 | while( ($language_row = mysql_fetch_assoc($language_result)) != null ) { |
| 64 | $language_name = $language_row['name']; |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 65 | $language_iso = $language_row['iso_code']; |
| 66 | $language_locale = $language_row['locale']; |
| 67 | $language_id = $language_row['language_id']; |
| 68 | if (strcmp($language_iso, "en") == 0) { |
| 69 | $language_iso = "en_AA"; |
| 70 | $language_name = "Pseudo Translations"; |
| 71 | } |
| 72 | if ($language_locale != null) { |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 73 | $language_name = $language_locale . " " . $language_name; |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 74 | } |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 75 | echo "${leader}Generating language pack for $train_id - $language_name ($language_iso) (language_id=" . $language_id . ")\n"; |
| 76 | |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 77 | /* |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 78 | * Determine which plug-ins need to be in this language pack. |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 79 | */ |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 80 | if (strcmp($language_iso, "en_AA") == 0) { |
| 81 | $file_result = mysql_query("SELECT DISTINCT f.project_id, f.version, f.file_id, f.name |
| 82 | FROM files AS f |
| 83 | INNER JOIN strings AS s ON f.file_id = s.file_id |
| 84 | INNER JOIN release_train_projects as v ON (f.project_id = v.project_id AND f.version = v.version) |
| 85 | WHERE f.is_active |
| 86 | AND v.train_id = '" . $train_row['train_id'] . "'"); |
| 87 | |
| 88 | $index_file = fopen("${output_dir}BabelPseudoTranslationsIndex.html", "w"); |
| 89 | fwrite($index_file, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">\n<html>\n<head>\n<title>Babel Pseudo Translations Index</title>\n" . |
| 90 | "<meta http-equiv=Content-Type content=\"text/html; charset=UTF-8\">\n</head>\n<body>\n\t<h1>Babel Pseudo Translations Index</h1>\n" . |
| 91 | "\t<h2>" . $train_version . ".v" . $timestamp . "</h2>\n\t<ul>\n"); |
| 92 | } else { |
| 93 | $file_result = mysql_query("SELECT DISTINCT f.project_id, f.version, f.file_id, f.name |
| 94 | FROM files AS f |
| 95 | INNER JOIN strings AS s ON f.file_id = s.file_id |
| 96 | INNER JOIN translations AS t ON (s.string_id = t.string_id AND t.is_active) |
| 97 | INNER JOIN release_train_projects as v ON (f.project_id = v.project_id AND f.version = v.version) |
| 98 | WHERE t.language_id = " . $language_id . " |
| 99 | AND f.is_active |
| 100 | AND v.train_id = '" . $train_row['train_id'] . "'"); |
| 101 | } |
| 102 | |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 103 | $plugins = array(); |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 104 | while (($file_row = mysql_fetch_assoc($file_result)) != null) { |
| 105 | # save original filename |
| 106 | $file_row['origname'] = $file_row['name']; |
| 107 | |
droy | 02c430a | 2008-06-02 19:42:08 +0000 | [diff] [blame] | 108 | # strip useless CVS structure before the plugin name (bug 221675 c14): |
| 109 | $pattern = '/^([a-zA-Z0-9\/_-])+\/([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)(.*)\.properties$/i'; |
| 110 | $replace = '${2}.${3}${4}.properties'; |
| 111 | $file_row['name'] = preg_replace($pattern, $replace, $file_row['name']); |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 112 | |
droy | 02c430a | 2008-06-02 19:42:08 +0000 | [diff] [blame] | 113 | # strip source folder (bug 221675) (org.eclipse.plugin/source_folder/org/eclipse/plugin) |
| 114 | $pattern = '/^([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)\.([a-zA-Z0-9\._-]+)(.*)\/(\1)([\.\/])(\2)([\.\/])(.*)\.properties$/i'; |
| 115 | $replace = '${1}.${2}.${3}/${5}${6}${7}${8}${9}.properties'; |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 116 | $file_row['name'] = preg_replace($pattern, $replace, $file_row['name']); |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 117 | |
| 118 | if (preg_match("/^([a-zA-Z0-9\.]+)\/(.*)$/", $file_row['name'], $matches)) { |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 119 | $file_row['subname'] = $matches[2]; |
| 120 | $plugins[$matches[1]][] = $file_row; |
| 121 | } else { |
| 122 | echo " WARNING: no plug-in name found in file " . $file_row['file_id'] . " \"" . $file_row['name'] . "\"\n"; |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 123 | } |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 124 | } |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 125 | |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 126 | /* |
| 127 | * Generate one plug-in fragment for each plug-in |
| 128 | */ |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 129 | foreach ($plugins as $plugin_name => $plugin_row) { |
| 130 | echo "${leader}${leader}Generating plug-in fragment $plugin_name\n"; |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 131 | /* |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 132 | * Clean and create the temporary directory |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 133 | */ |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 134 | if (file_exists($tmp_dir)) { |
| 135 | exec("rm -rf $tmp_dir; mkdir $tmp_dir"); |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 136 | } else { |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 137 | exec("mkdir $tmp_dir"); |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 138 | } |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 139 | |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 140 | /* |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 141 | * Generate each *.properties file |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 142 | */ |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 143 | foreach ($plugin_row as $properties_file) { |
| 144 | /* |
| 145 | * Convert the filename to *_lang.properties, e.g., foo_fr.properties |
| 146 | */ |
| 147 | $filename = $properties_file['subname']; |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 148 | if (preg_match( "/^(.*)\.properties$/", $filename, $matches)) { |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 149 | $filename = $matches[1] . '_' . $language_iso . '.properties'; |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 150 | } |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 151 | echo "${leader}${leader}${leader}Generating properties file $filename (file_id=" . $properties_file['file_id'] . ")\n"; |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 152 | /* |
| 153 | * Create any needed sub-directories |
| 154 | */ |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 155 | $fullpath = $tmp_dir . $filename; |
| 156 | preg_match("/^((.*)\/)?(.+?)$/", $fullpath, $matches); |
| 157 | exec("mkdir -p \"" . $matches[1] . "\""); |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 158 | /* |
| 159 | * Start writing to the file |
| 160 | */ |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 161 | $outp = fopen($fullpath, "w"); |
| 162 | fwrite($outp, "# Copyright by many contributors; see http://babel.eclipse.org/\n"); |
| 163 | if (strcmp($language_iso, "en_AA") == 0) { |
| 164 | $sql = "SELECT string_id, name, value FROM strings WHERE file_id = " . $properties_file['file_id'] . |
| 165 | " AND is_active AND non_translatable = 0"; |
| 166 | $strings_result = mysql_query($sql); |
| 167 | while (($strings_row = mysql_fetch_assoc($strings_result)) != null) { |
| 168 | fwrite($outp, $strings_row['name'] . "="); |
| 169 | fwrite($outp, $properties_file['project_id'] . $strings_row['string_id'] . ":" . $strings_row['value']); |
| 170 | fwrite($outp, "\n"); |
| 171 | |
| 172 | $value = htmlspecialchars($strings_row['value']); |
| 173 | if (strlen($value) > 100) { |
| 174 | $value = substr($value, 0, 100) . " ..."; |
| 175 | } |
| 176 | fwrite($index_file, "\t\t<li><a href=\"http://babel.eclipse.org/babel/translate.php?project=" . $properties_file['project_id'] . |
| 177 | "&version=" . $properties_file['version'] . "&file=" . $properties_file['origname'] . "&string=" . $strings_row['name'] . |
| 178 | "\">" . $properties_file['project_id'] . $strings_row['string_id'] . "</a> " . $value . "</li>\n"); |
| 179 | } |
| 180 | } else { |
| 181 | $sql = "SELECT |
| 182 | strings.name AS 'key', |
| 183 | strings.value AS orig, |
| 184 | translations.value AS trans |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 185 | FROM strings, translations |
| 186 | WHERE strings.string_id = translations.string_id |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 187 | AND translations.language_id = " . $language_id . " |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 188 | AND strings.file_id = " . $properties_file['file_id'] . " |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 189 | AND translations.is_active"; |
| 190 | $strings_result = mysql_query($sql); |
| 191 | while (($strings_row = mysql_fetch_assoc($strings_result)) != null) { |
| 192 | fwrite($outp, $strings_row['key'] . "="); |
| 193 | #echo "${leader1S}${leaderS}${leaderS}${leaderS}" . $strings_row['key'] . "="; |
| 194 | if ($strings_row['trans']) { |
| 195 | # json_encode returns the string with quotes fore and aft. Need to strip them. |
| 196 | # $tr_string = preg_replace('/^"(.*)"$/', '${1}', json_encode($strings_row['trans'])); |
| 197 | # $tr_string = str_replace('\\\\', '\\', $tr_string); |
| 198 | $tr_string = toescapedunicode($strings_row['trans']); |
| 199 | fwrite($outp, $tr_string); |
| 200 | # echo $strings_row['trans']; |
| 201 | } else { |
| 202 | fwrite($outp, $strings_row['orig']); |
| 203 | } |
| 204 | fwrite($outp, "\n"); |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 205 | } |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 206 | } |
| 207 | /* |
| 208 | * Finish the properties file |
| 209 | */ |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 210 | fclose($outp); |
| 211 | echo "${leader}${leader}${leader}Completed properties file $filename\n"; |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 212 | } |
| 213 | /* |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 214 | * Copy in the various legal files |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 215 | */ |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 216 | exec("cp ${source_files_dir}about.html ${tmp_dir}"); |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 217 | /* |
| 218 | * Generate the META-INF/MANIFEST.MF file |
| 219 | */ |
| 220 | $parent_plugin_id = $plugin_name; |
| 221 | $fragment_id = "${parent_plugin_id}.nl_$language_iso"; |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 222 | $fragment_version = $train_version . ".v" . $timestamp; |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 223 | $fragment_filename = $fragment_id . "_" . $fragment_version . ".jar"; |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 224 | |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 225 | $plugins[$plugin_name]['id'] = $fragment_id; |
| 226 | $plugins[$plugin_name]['version'] = $fragment_version; |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 227 | |
| 228 | exec("mkdir $tmp_dir/META-INF" ); |
| 229 | $outp = fopen("$tmp_dir/META-INF/MANIFEST.MF", "w"); |
| 230 | fwrite($outp, "Manifest-Version: 1.0\n"); |
| 231 | fwrite($outp, "Bundle-Name: $parent_plugin_id $language_name NLS Support\n"); |
| 232 | fwrite($outp, "Bundle-SymbolicName: $fragment_id ;singleton=true\n"); |
| 233 | fwrite($outp, "Bundle-Version: $fragment_version\n"); |
| 234 | fwrite($outp, "Bundle-Vendor: Eclipse Foundation Inc.\n"); |
| 235 | fwrite($outp, "Fragment-Host: $parent_plugin_id\n"); |
| 236 | fclose($outp); |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 237 | /* |
| 238 | * Jar up this directory as the fragment plug-in jar |
| 239 | */ |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 240 | system("cd $tmp_dir; jar cfM ${output_dir_for_train}plugins/$fragment_filename ."); |
| 241 | echo "${leader}${leader}Completed plug-in fragment $plugin_name\n"; |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 242 | } |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 243 | /* |
| 244 | * Clean and create the temporary directory |
| 245 | */ |
| 246 | if (file_exists($tmp_dir)) { |
| 247 | exec("rm -rf $tmp_dir; mkdir $tmp_dir"); |
| 248 | } else { |
| 249 | exec("mkdir $tmp_dir"); |
| 250 | } |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 251 | /* |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 252 | * Create the feature.xml |
| 253 | * |
| 254 | * TODO <url><update label=... url=... and <url><discovery label=... url=... are not implemented |
| 255 | * |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 256 | * <url> |
| 257 | * <update label="%updateSiteName" url="http://update.eclipse.org/updates/3.2" /> |
| 258 | * <discovery label="%updateSiteName" url="http://update.eclipse.org/updates/3.2" /> |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 259 | * </url> |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 260 | */ |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 261 | $feature_id = "org.eclipse.babel.nls.$language_iso"; |
| 262 | $feature_version = $train_version . ".v" . $timestamp; |
| 263 | $feature_filename = $feature_id . "_" . $feature_version . ".jar"; |
| 264 | |
| 265 | $outp = fopen("$tmp_dir/feature.xml", "w"); |
| 266 | fwrite($outp, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> |
| 267 | <feature |
| 268 | id=\"$feature_id\" |
| 269 | label=\"Eclipse Language Pack for $language_name\" |
| 270 | image=\"eclipse_update_120.jpg\" |
| 271 | provider-name=\"Eclipse Foundation Inc.\" |
| 272 | version=\"$feature_version\"> |
| 273 | <license url=\"license.html\">\n" . htmlspecialchars(file_get_contents("${source_files_dir}license.txt")) . "\t</license> |
| 274 | <description>Translations in $language_name for all Eclipse Projects</description>" ); |
| 275 | foreach ($plugins as $plugin_name => $plugin_row) { |
| 276 | fwrite($outp, ' |
| 277 | <plugin fragment="true" id="' . |
| 278 | $plugin_row['id'] . '" unpack="false" version="' . |
| 279 | $plugin_row['version'] . '"/>'); |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 280 | } |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 281 | fwrite($outp, ' |
| 282 | </feature>'); |
| 283 | fclose($outp); |
| 284 | /* |
| 285 | * Copy in the various legal files |
| 286 | */ |
| 287 | exec("cp ${source_files_dir}about.html ${tmp_dir}"); |
| 288 | exec("cp ${source_files_dir}license.html ${tmp_dir}"); |
| 289 | exec("cp ${source_files_dir}epl-v10.html ${tmp_dir}"); |
| 290 | exec("cp ${source_files_dir}eclipse_update_120.jpg ${tmp_dir}"); |
| 291 | /* |
| 292 | * Copy in the Babel Pseudo Translations Index file |
| 293 | */ |
| 294 | if (strcmp($language_iso, "en_AA") == 0) { |
| 295 | fwrite($index_file, "\t</ul>\n</body>\n</html>"); |
| 296 | fclose($index_file); |
| 297 | exec("cp ${output_dir}BabelPseudoTranslationsIndex.html ${tmp_dir}"); |
| 298 | exec("rm ${output_dir}BabelPseudoTranslationsIndex.html"); |
| 299 | } |
| 300 | /* |
| 301 | * Jar up this directory as the feature jar |
| 302 | */ |
| 303 | system("cd $tmp_dir; jar cfM ${output_dir_for_train}features/$feature_filename ."); |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 304 | /* |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 305 | * Register this feature with the site.xml |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 306 | */ |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 307 | $site_xml .= " <feature url=\"features/$feature_filename\" id=\"$feature_id\" version=\"$feature_version\"> |
| 308 | <category name=\"Language Packs\"/> |
| 309 | </feature>\n"; |
| 310 | echo "${leader}Completed language pack for $language_name ($language_iso)\n"; |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 311 | } |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 312 | /* |
droy | 0b08d29 | 2008-05-28 15:18:11 +0000 | [diff] [blame] | 313 | * <site mirrorsURL=... implemented in the weekly build process by sed'ing <site> |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 314 | */ |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 315 | $outp = fopen("${output_dir_for_train}site.xml", "w"); |
| 316 | fwrite($outp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?> |
| 317 | <site> |
| 318 | <description url=\"http://babel.eclipse.org/\"> |
| 319 | This update site contains user-contributed translations of the strings in all Eclipse projects. |
| 320 | Please see the http://babel.eclipse.org/ Babel project web pages for a full how-to-use explanation of |
| 321 | these translations as well as how you can contribute to the translations of this and future versions of Eclipse. |
| 322 | </description> |
| 323 | <category-def name=\"Language Packs\" label=\"Language Packs\"> |
| 324 | <description>Language packs for all Eclipse projects</description> |
| 325 | </category-def>\n"); |
| 326 | fwrite($outp, $site_xml); |
| 327 | fwrite($outp, "</site>"); |
| 328 | fclose($outp); |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 329 | } |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 330 | echo "Completed generating update site\n"; |
| 331 | |
| 332 | /* |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 333 | 2. what happens if the translation feature includes plug-in fragments for |
| 334 | plug-ins that are not in the current image? |
| 335 | does it load correctly and ignore those fragments? if so, good |
| 336 | A: warnings appear in the run-time error log |
| 337 | does it fail to load? if so, then we need to generate different features, perhaps |
| 338 | one feature for each plug or else we need to know more about the project |
| 339 | distro structure to know which plug-ins to put in each feature |
| 340 | what happens if those plug-ins are later added - does it load the strings now? |
| 341 | A: probably not |
| 342 | 3. need to handle different versions of each feature/plugin/platform; generate different |
| 343 | language packs for each |
| 344 | */ |
gobrien | 1a8e02f | 2008-01-30 01:46:26 +0000 | [diff] [blame] | 345 | |
kitlo | 58d8a5a | 2008-09-24 20:08:44 +0000 | [diff] [blame^] | 346 | $alloutput = fopen($output_dir."langpack_output_".date("m_d_Y"), "w"); |
| 347 | fwrite($alloutput,ob_get_contents()); |
| 348 | ?> |