From: Marcel Werk Date: Fri, 30 Sep 2011 19:39:10 +0000 (+0200) Subject: Setup language variables overhaul X-Git-Tag: 2.0.0_Beta_1~1738^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1157f8be9a7b5d069a1b7075e4b6ad32f958bfcb;p=GitHub%2FWoltLab%2FWCF.git Setup language variables overhaul --- diff --git a/wcfsetup/install/files/lib/system/WCFSetup.class.php b/wcfsetup/install/files/lib/system/WCFSetup.class.php index 5f323120d8..3414738e24 100644 --- a/wcfsetup/install/files/lib/system/WCFSetup.class.php +++ b/wcfsetup/install/files/lib/system/WCFSetup.class.php @@ -84,13 +84,13 @@ class WCFSetup extends WCF { * Gets the selected language. */ protected static function getLanguageSelection() { - self::$availableLanguages = self::getAllLanguages(); + self::$availableLanguages = self::getAvailableLanguages(); - if (isset($_REQUEST['languageCode']) && in_array($_REQUEST['languageCode'], self::$availableLanguages)) { + if (isset($_REQUEST['languageCode']) && isset(self::$availableLanguages[$_REQUEST['languageCode']])) { self::$selectedLanguageCode = $_REQUEST['languageCode']; } else { - self::$selectedLanguageCode = LanguageFactory::getPreferredLanguage(self::$availableLanguages, self::$selectedLanguageCode); + self::$selectedLanguageCode = LanguageFactory::getPreferredLanguage(array_keys(self::$availableLanguages), self::$selectedLanguageCode); } if (isset($_POST['selectedLanguages']) && is_array($_POST['selectedLanguages'])) { @@ -148,7 +148,7 @@ class WCFSetup extends WCF { */ protected function initTPL() { self::$tplObj = SetupTemplateEngine::getInstance(); - self::getTPL()->setLanguageID(array_search(self::$selectedLanguageCode, self::$availableLanguages)); + self::getTPL()->setLanguageID((self::$selectedLanguageCode == 'en' ? 0 : 1)); self::getTPL()->setCompileDir(TMP_DIR); self::getTPL()->addTemplatePath(PACKAGE_ID, TMP_DIR); self::getTPL()->registerPrefilter(array('lang')); @@ -167,18 +167,23 @@ class WCFSetup extends WCF { * * @return array */ - protected static function getAllLanguages() { + protected static function getAvailableLanguages() { $languages = $match = array(); $tar = new Tar(SETUP_FILE); foreach ($tar->getContentList() as $file) { - if (strpos($file['filename'], 'setup/lang/') === 0 && substr($file['filename'], -4) == '.xml' && preg_match('!^setup_([a-z]{2}(?:-[A-Za-z0-9]+)?(?:_[A-Za-z]{2})?)$!', basename($file['filename'], '.xml'), $match)) { - $languages[] = $match[1]; + if (strpos($file['filename'], 'setup/lang/') === 0 && substr($file['filename'], -4) == '.xml') { + $xml = new XML(); + $xml->load(TMP_DIR.$file['filename']); + $languageCode = LanguageEditor::readLanguageCodeFromXML($xml); + $languageName = LanguageEditor::readLanguageNameFromXML($xml); + + $languages[$languageCode] = $languageName; } } $tar->close(); - // sort languages by language code - sort($languages); + // sort languages by language name + asort($languages); return $languages; } @@ -289,17 +294,8 @@ class WCFSetup extends WCF { * Shows the first setup page. */ protected function selectSetupLanguage() { - // build language list - $languages = array(); - foreach (self::$availableLanguages as $languageCode) { - $languages[$languageCode] = self::getLanguage()->get('wcf.global.language.'.$languageCode).' ('.$languageCode.')'; - } - - // sort languages - StringUtil::sort($languages); - WCF::getTPL()->assign(array( - 'availableLanguages' => $languages, + 'availableLanguages' => self::$availableLanguages, 'nextStep' => 'showLicense' )); WCF::getTPL()->display('stepSelectSetupLanguage'); @@ -452,15 +448,8 @@ class WCFSetup extends WCF { */ protected function selectLanguages() { $errorField = $errorType = ''; - $allLanguages = $this->getAllLanguages(); $illegalLanguages = array(); - // build visible language list - $languages = array(); - foreach ($allLanguages as $languageCode) { - $languages[$languageCode] = self::getLanguage()->get('wcf.global.language.'.$languageCode).' ('.$languageCode.')'; - } - // skip step in developer mode // select all available languages automatically if (self::$developerMode) { @@ -474,9 +463,6 @@ class WCFSetup extends WCF { exit; } - // sort languages - StringUtil::sort($languages); - // start error handling if (isset($_POST['send'])) { try { @@ -487,7 +473,7 @@ class WCFSetup extends WCF { // illegal selection foreach (self::$selectedLanguages as $language) { - if (!isset($languages[$language])) { + if (!isset(self::$availableLanguages[$language])) { throw new UserInputException('selectedLanguages'); } } @@ -510,7 +496,7 @@ class WCFSetup extends WCF { WCF::getTPL()->assign(array( 'errorField' => $errorField, 'errorType' => $errorType, - 'languages' => $languages, + 'availableLanguages' => self::$availableLanguages, 'nextStep' => 'selectLanguages' )); WCF::getTPL()->display('stepSelectLanguages'); diff --git a/wcfsetup/setup/lang/setup_de.xml b/wcfsetup/setup/lang/setup_de.xml index 3584912596..b18b6e9501 100644 --- a/wcfsetup/setup/lang/setup_de.xml +++ b/wcfsetup/setup/lang/setup_de.xml @@ -1,5 +1,5 @@ - + @@ -8,51 +8,13 @@ - + - - - - - - Heute, %H:%M]]> - WoltLab Community Framework{if $setupPackageName != 'WoltLab Community Framework'} und von {$setupPackageName}{/if}.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -67,7 +29,7 @@ - + @@ -76,11 +38,9 @@ - + - - - + @@ -91,53 +51,24 @@ WoltLab Community Framework über diese Adresse (URL) erreichbar.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + 1 wählen.]]> {$exception->getMessage()}{if $exception|get_class == 'DatabaseException'}
{$exception->getErrorDesc()}{/if}
-
Weitere Informationen zu diesem Problem erhalten Sie im Nachschlagewerk von WoltLab: -
http://www.woltlab.com/help/?code={@$exception->getCode()}]]>
+
{$exception->getMessage()}{if $exception|get_class == 'DatabaseException'}
{$exception->getErrorDesc()}{/if}
]]> 1}n{/if} existier{if $conflictedTables|count > 1}en{else}t{/if} schon in der Datenbank »{$dbName}«:
{implode from=$conflictedTables item="table"}{$table}{/implode}.

Um dieses Problem zu beheben, können Sie:
1. diese Tabelle{if $conflictedTables|count > 1}n{/if} überschreiben, indem Sie die »Ãœberschreiben« Option aktivieren und die »Weiter« Schaltfläche betätigen, oder
2. Sie geben die Daten einer anderen Datenbank ein und betätigen die »Weiter« Schaltfläche, oder
3. Sie geben eine von »{$dbNumber}« unterschiedliche Installationsnummer an und betätigen die »Weiter« Schaltfläche.]]>
1}n{/if} überschreiben]]> @@ -159,8 +90,9 @@ {$exception->getMessage()}
- Bitte kontrollieren Sie, ob das Zielverzeichnis existiert und beschreibbar ist. -

Weitere Informationen zu diesem Problem erhalten Sie im Nachschlagewerk von WoltLab:
http://www.woltlab.com/help/?code={@$exception->getCode()}]]>
+
{$exception->getMessage()}
+ Bitte kontrollieren Sie, ob das Zielverzeichnis existiert und beschreibbar ist.]]> + +
diff --git a/wcfsetup/setup/lang/setup_en.xml b/wcfsetup/setup/lang/setup_en.xml index daf0077b89..9785f10610 100644 --- a/wcfsetup/setup/lang/setup_en.xml +++ b/wcfsetup/setup/lang/setup_en.xml @@ -1,5 +1,5 @@ - + @@ -11,46 +11,10 @@ - - - - \T\o\d\a\y, g:ia]]> - WoltLab Community Framework{if $setupPackageName != 'WoltLab Community Framework'} and {$setupPackageName}{/if}.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -65,19 +29,18 @@ - - - + + + + - + - - - + @@ -88,41 +51,12 @@ WoltLab Community Framework through this adress (URL).]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -130,11 +64,11 @@ + + 1.]]> {$exception->getMessage()}{if $exception|get_class == 'DatabaseException'}
{$exception->getErrorDesc()}{/if}
-
Additional information can be found in the WoltLab Error Reference: -
http://www.woltlab.com/help/?code={@$exception->getCode()}]]>
+
{$exception->getMessage()}{if $exception|get_class == 'DatabaseException'}
{$exception->getErrorDesc()}{/if}
]]> 1}s{/if} already exist{if $conflictedTables|count == 1}s{/if} within your "{$dbName}" Database:
{implode from=$conflictedTables item="table"}{$table}{/implode}.

To solve this problem, please do one of the following:
1. Enable the "Overwrite" option below to overwrite {if $conflictedTables|count > 1}these tables{else}this table{/if} and continue the installation with the "Next" button or
2. You re-enter the database access information, but to a different database and continue the installation with the "Next" button or
3. Enter a new installation number, not forgetting to continue the installation with the "Next" Button.]]>
1}s{/if}?]]> @@ -142,22 +76,23 @@ - + - + - + {$exception->getMessage()}
- Please make sure that the destination folder exists and can be written to. -

Additional information can be found in the WoltLab Error Reference:
http://www.woltlab.com/help/?code={@$exception->getCode()}]]>
+
{$exception->getMessage()}
+ Please make sure that the destination folder exists and can be written to.]]> + +
diff --git a/wcfsetup/setup/template/header.tpl b/wcfsetup/setup/template/header.tpl index e3e20166be..776105ea13 100644 --- a/wcfsetup/setup/template/header.tpl +++ b/wcfsetup/setup/template/header.tpl @@ -18,7 +18,7 @@