<small>{lang}wcf.acp.language.add.source.description{/lang}</small>
</dd>
</dl>
+
+ <dl{if $errorField == 'packageID'} class="formError"{/if}>
+ <dt><label for="packageID">{lang}wcf.acp.language.add.package{/lang}</label></dt>
+ <dd>
+ <select id="packageID" name="packageID">
+ <option value="0"></option>
+ {foreach from=$packages item=package}
+ <option value="{$package->packageID}"{if $package->packageID == $packageID} selected{/if}>{$package->getName()} ({$package->package})</option>
+ {/foreach}
+ </select>
+ {if $errorField == 'packageID'}
+ <small class="innerError">
+ {if $errorType == 'empty'}
+ {lang}wcf.global.form.error.empty{/lang}
+ {else}
+ {lang}wcf.acp.language.add.package.error.{@$errorType}{/lang}
+ {/if}
+ </small>
+ {/if}
+ <small>{lang}wcf.acp.language.add.package.description{/lang}</small>
+ </dd>
+ </dl>
{event name='fields'}
</div>
use wcf\data\language\Language;
use wcf\data\language\LanguageEditor;
+use wcf\data\package\Package;
+use wcf\data\package\PackageCache;
use wcf\form\AbstractForm;
use wcf\system\exception\SystemException;
use wcf\system\exception\UserInputException;
*/
public $sourceLanguageID = 0;
+ /**
+ * @var int
+ */
+ public $packageID = 0;
+
/**
* @inheritDoc
*/
if (isset($_POST['sourceLanguageID'])) {
$this->sourceLanguageID = \intval($_POST['sourceLanguageID']);
}
+ if (isset($_POST['packageID'])) {
+ $this->packageID = \intval($_POST['packageID']);
+ }
}
/**
throw new UserInputException('sourceLanguageID');
}
+ if (!PackageCache::getInstance()->getPackage($this->packageID)) {
+ throw new UserInputException('packageID');
+ }
+
// try to import
try {
// open xml document
$xml->load($this->filename);
// import xml document
- $this->language = LanguageEditor::importFromXML($xml, -1, $this->sourceLanguage);
+ $this->language = LanguageEditor::importFromXML($xml, $this->packageID, $this->sourceLanguage);
// copy content
if (!isset($this->languages[$this->language->languageID])) {
{
parent::assignVariables();
+ $packages = PackageCache::getInstance()->getPackages();
+ \usort($packages, static function (Package $a, Package $b) {
+ return $a->getName() <=> $b->getName();
+ });
+
WCF::getTPL()->assign([
'languages' => $this->languages,
'sourceLanguageID' => $this->sourceLanguageID,
+ 'packages' => $packages,
+ 'packageID' => $this->packageID,
]);
}
<item name="wcf.acp.language.item.languageCategory.error.notUnique"><![CDATA[Der angegebene Bezeichner wird bereits für eine vorhandene Sprachvariablen-Kategorie verwendet.]]></item>
<item name="wcf.acp.language.item.languageCategory.error.tooFewSegments"><![CDATA[Die angegebene Kategorie enthält {#$segmentCount} Abschnitt{if $segmentCount > 1}e{/if}.]]></item>
<item name="wcf.acp.language.item.languageCategoryID.mode.new"><![CDATA[Neue Sprachvariablen-Kategorie]]></item>
+ <item name="wcf.acp.language.add.package"><![CDATA[Paket]]></item>
+ <item name="wcf.acp.language.add.package.description"><![CDATA[Die importierten Texte werden dem ausgewählten Paket zugeordnet.]]></item>
</category>
<category name="wcf.acp.masterPassword">
<item name="wcf.acp.masterPassword"><![CDATA[Hauptkennwort]]></item>
<item name="wcf.acp.language.item.languageCategory.description"><![CDATA[The entered language category identifier is used to group phrases.]]></item>
<item name="wcf.acp.language.item.languageCategory.error.notUnique"><![CDATA[The entered identifier is already used by an existing language category.]]></item>
<item name="wcf.acp.language.item.languageCategory.error.tooFewSegments"><![CDATA[The entered category contains {#$segmentCount} segment{if $segmentCount > 1}s{/if}.]]></item>
+ <item name="wcf.acp.language.add.package"><![CDATA[Package]]></item>
+ <item name="wcf.acp.language.add.package.description"><![CDATA[The imported phrases will be assigned to the selected package.]]></item>
</category>
<category name="wcf.acp.masterPassword">
<item name="wcf.acp.masterPassword"><![CDATA[Master Password]]></item>