summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-11-19 13:56:14 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-11-19 13:56:14 +0000
commit04ca1b4676fa636138071da083f9159707d7328f (patch)
tree32f913f55ccab27d7aa8e327551f77b2325af3dc /includes
parentc0994a3a4ec401aea4c3d420a8ece3a49322049b (diff)
downloadbrdo-04ca1b4676fa636138071da083f9159707d7328f.tar.gz
brdo-04ca1b4676fa636138071da083f9159707d7328f.tar.bz2
#190283 by JirkaRybka and myself: fix installer localization and form handling
- use a two pass localization process so localization is ready for the configure form and profile tasks - fix awkward form API workarounds which were introduced before we used a full bootstrap anyway - allow for more usable localized profiles by letting them skip language selection - lots of documentation improvements to profiles and the installer functions
Diffstat (limited to 'includes')
-rw-r--r--includes/locale.inc30
1 files changed, 18 insertions, 12 deletions
diff --git a/includes/locale.inc b/includes/locale.inc
index 7d30afa92..5f4a2a4d7 100644
--- a/includes/locale.inc
+++ b/includes/locale.inc
@@ -2416,22 +2416,31 @@ function _locale_get_predefined_list() {
* Language code to import translations for.
* @param $finished
* Optional finished callback for the batch.
+ * @param $skip
+ * Array of component names to skip. Used in the installer for the
+ * second pass import, when most components are already imported.
* @return
* A batch structure or FALSE if no files found.
*/
-function locale_batch_by_language($langcode, $finished = '_locale_batch_installer_finished') {
+function locale_batch_by_language($langcode, $finished = NULL, $skip = array()) {
// Collect all files to import for all enabled modules and themes.
$files = array();
- $result = db_query("SELECT name, filename FROM {system} WHERE status = 1");
+ $components = array();
+ $query = "SELECT name, filename FROM {system} WHERE status = 1";
+ if (count($skip)) {
+ $query .= " AND name NOT IN (". db_placeholders($skip, 'varchar') .")";
+ }
+ $result = db_query($query, $skip);
while ($component = db_fetch_object($result)) {
// Collect all files for all components, names as $langcode.po or
// with names ending with $langcode.po. This allows for filenames
// like node-module.de.po to let translators use small files and
// be able to import in smaller chunks.
$files = array_merge($files, file_scan_directory(dirname($component->filename) .'/translations', '(^|\.)'. $langcode .'\.po$', array('.', '..', 'CVS'), 0, FALSE));
+ $components[] = $component->name;
}
- return _locale_batch_build($files, $finished);
+ return _locale_batch_build($files, $finished, $components);
}
/**
@@ -2474,10 +2483,12 @@ function locale_batch_by_component($components, $finished = '_locale_batch_syste
* Array of files to import
* @param $finished
* Optional finished callback for the batch.
+ * @param $components
+ * Optional list of component names the batch covers. Used in the installer.
* @return
* A batch structure
*/
-function _locale_batch_build($files, $finished = NULL) {
+function _locale_batch_build($files, $finished = NULL, $components = array()) {
$t = get_t();
if (count($files)) {
$operations = array();
@@ -2490,6 +2501,9 @@ function _locale_batch_build($files, $finished = NULL) {
'init_message' => $t('Starting import'),
'error_message' => $t('Error importing interface translations'),
'file' => './includes/locale.inc',
+ // This is not a batch API construct, but data passed along to the
+ // installer, so we know what did we import already.
+ '#components' => $components,
);
if (isset($finished)) {
$batch['finished'] = $finished;
@@ -2538,13 +2552,5 @@ function _locale_batch_language_finished($success, $results) {
}
/**
- * Finished callback of installer locale import batch.
- * Advance installer task to the finished screen.
- */
-function _locale_batch_installer_finished($success, $results) {
- variable_set('install_task', 'finished');
-}
-
-/**
* @} End of "locale-autoimport"
*/