use TYPO3\CMS\Core\Package\PackageInterface;
use TYPO3\CMS\Core\Package\PackageManager;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extbase\Mvc\Controller\CommandController;
+use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
+use TYPO3\CMS\Lang\Domain\Repository\LanguageRepository;
+use TYPO3\CMS\Lang\Service\RegistryService;
+use TYPO3\CMS\Lang\Service\TranslationService;
/**
* Language command controller updates translation packages
*/
-class LanguageCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\CommandController
+class LanguageCommandController extends CommandController
{
/**
* @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher
/**
* @param \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher
*/
- public function injectSignalSlotDispatcher(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher)
+ public function injectSignalSlotDispatcher(Dispatcher $signalSlotDispatcher)
{
$this->signalSlotDispatcher = $signalSlotDispatcher;
}
/**
* @param \TYPO3\CMS\Lang\Service\RegistryService $registryService
*/
- public function injectRegistryService(\TYPO3\CMS\Lang\Service\RegistryService $registryService)
+ public function injectRegistryService(RegistryService $registryService)
{
$this->registryService = $registryService;
}
public function updateCommand($localesToUpdate = '')
{
/** @var $translationService \TYPO3\CMS\Lang\Service\TranslationService */
- $translationService = $this->objectManager->get(\TYPO3\CMS\Lang\Service\TranslationService::class);
+ $translationService = $this->objectManager->get(TranslationService::class);
/** @var $languageRepository \TYPO3\CMS\Lang\Domain\Repository\LanguageRepository */
- $languageRepository = $this->objectManager->get(\TYPO3\CMS\Lang\Domain\Repository\LanguageRepository::class);
+ $languageRepository = $this->objectManager->get(LanguageRepository::class);
$locales = array();
if (!empty($localesToUpdate)) {
- $locales = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $localesToUpdate, true);
+ $locales = GeneralUtility::trimExplode(',', $localesToUpdate, true);
} else {
$languages = $languageRepository->findSelected();
foreach ($languages as $language) {
}
}
/** @var PackageManager $packageManager */
- $packageManager = $this->objectManager->get(\TYPO3\CMS\Core\Package\PackageManager::class);
+ $packageManager = $this->objectManager->get(PackageManager::class);
$this->emitPackagesMayHaveChangedSignal();
$packages = $packageManager->getAvailablePackages();
$this->outputLine((sprintf('Updating language packs of all activated extensions for locales "%s"', implode(', ', $locales))));
*
* The TYPO3 project - inspiring people to share!
*/
+
use TYPO3\CMS\Backend\Template\Components\ButtonBar;
use TYPO3\CMS\Backend\Template\Components\Menu\Menu;
use TYPO3\CMS\Backend\Template\Components\Menu\MenuItem;
use TYPO3\CMS\Backend\View\BackendTemplateView;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Lang\Domain\Model\Extension;
+use TYPO3\CMS\Lang\Domain\Repository\ExtensionRepository;
+use TYPO3\CMS\Lang\Domain\Repository\LanguageRepository;
+use TYPO3\CMS\Lang\Service\RegistryService;
+use TYPO3\CMS\Lang\Service\TranslationService;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
/**
* @param \TYPO3\CMS\Lang\Domain\Repository\LanguageRepository $languageRepository
*/
- public function injectLanguageRepository(\TYPO3\CMS\Lang\Domain\Repository\LanguageRepository $languageRepository)
+ public function injectLanguageRepository(LanguageRepository $languageRepository)
{
$this->languageRepository = $languageRepository;
}
/**
* @param \TYPO3\CMS\Lang\Domain\Repository\ExtensionRepository $extensionRepository
*/
- public function injectExtensionRepository(\TYPO3\CMS\Lang\Domain\Repository\ExtensionRepository $extensionRepository)
+ public function injectExtensionRepository(ExtensionRepository $extensionRepository)
{
$this->extensionRepository = $extensionRepository;
}
/**
* @param \TYPO3\CMS\Lang\Service\TranslationService $translationService
*/
- public function injectTranslationService(\TYPO3\CMS\Lang\Service\TranslationService $translationService)
+ public function injectTranslationService(TranslationService $translationService)
{
$this->translationService = $translationService;
}
/**
* @param \TYPO3\CMS\Lang\Service\RegistryService $registryService
*/
- public function injectRegistryService(\TYPO3\CMS\Lang\Service\RegistryService $registryService)
+ public function injectRegistryService(RegistryService $registryService)
{
$this->registryService = $registryService;
}
'success' => false,
'progress' => 0,
);
+ $progress = 0;
if (!empty($data['locale'])) {
$allCount = 0;
for ($i = 0; $i < $numberOfExtensionsToUpdate; $i++) {
$offset = (int)$data['count'] * $numberOfExtensionsToUpdate + $i;
+ /** @var Extension $extension */
$extension = $this->extensionRepository->findOneByOffset($offset);
if (empty($extension)) {
// No more extensions to update
* The TYPO3 project - inspiring people to share!
*/
+use TYPO3\CMS\Core\Utility\VersionNumberUtility;
+use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
+
/**
* Extension model
*/
-class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
+class Extension extends AbstractEntity
{
/**
* @var string
*/
public function setVersionFromString($version)
{
- $this->version = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger($version);
+ $this->version = VersionNumberUtility::convertVersionNumberToInteger($version);
}
/**
* The TYPO3 project - inspiring people to share!
*/
+use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
+
/**
* Language model
*/
-class Language extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
+class Language extends AbstractEntity
{
/**
* @var string
*/
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
+use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
+use TYPO3\CMS\Extensionmanager\Utility\ListUtility;
+use TYPO3\CMS\Lang\Domain\Model\Extension;
/**
* Extension repository
/**
* @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
*/
- public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
+ public function injectObjectManager(ObjectManagerInterface $objectManager)
{
$this->objectManager = $objectManager;
}
/**
* @param \TYPO3\CMS\Extensionmanager\Utility\ListUtility $listUtility
*/
- public function injectListUtility(\TYPO3\CMS\Extensionmanager\Utility\ListUtility $listUtility)
+ public function injectListUtility(ListUtility $listUtility)
{
$this->listUtility = $listUtility;
}
foreach ($extensions as $entry) {
/** @var $extension \TYPO3\CMS\Lang\Domain\Model\Extension */
$extension = $this->objectManager->get(
- \TYPO3\CMS\Lang\Domain\Model\Extension::class,
+ Extension::class,
$entry['key'],
$entry['title'],
$this->getExtensionIconWithPath($entry)
* Find one extension by offset
*
* @param int $offset The offset
- * @return TYPO3\CMS\Lang\Domain\Model\Extension The extension
+ * @return \TYPO3\CMS\Lang\Domain\Model\Extension The extension
*/
public function findOneByOffset($offset)
{
* The TYPO3 project - inspiring people to share!
*/
+use TYPO3\CMS\Core\Configuration\ConfigurationManager;
+use TYPO3\CMS\Core\Localization\Locales;
use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
+use TYPO3\CMS\Lang\Domain\Model\Language;
+use TYPO3\CMS\Lang\Service\RegistryService;
/**
* Language repository
/**
* @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
*/
- public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
+ public function injectObjectManager(ObjectManagerInterface $objectManager)
{
$this->objectManager = $objectManager;
}
/**
* @param \TYPO3\CMS\Core\Localization\Locales $locales
*/
- public function injectLocales(\TYPO3\CMS\Core\Localization\Locales $locales)
+ public function injectLocales(Locales $locales)
{
$this->locales = $locales;
}
/**
* @param \TYPO3\CMS\Lang\Service\RegistryService $registryService
*/
- public function injectRegistryService(\TYPO3\CMS\Lang\Service\RegistryService $registryService)
+ public function injectRegistryService(RegistryService $registryService)
{
$this->registryService = $registryService;
}
*/
public function __construct()
{
- $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
+ $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
try {
$globalSettings = $configurationManager->getLocalConfigurationValueByPath($this->configurationPath);
$this->selectedLocales = (array)$globalSettings['availableLanguages'];
$languages = $this->locales->getLanguages();
array_shift($languages);
foreach ($languages as $locale => $language) {
- $label = htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:setup/Resources/Private/Language/locallang.xlf:lang_' . $locale));
+ $label = htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:setup/Resources/Private/Language/locallang.xlf:lang_' . $locale));
if ($label === '') {
$label = htmlspecialchars($language);
}
$this->languages[$locale] = $this->objectManager->get(
- \TYPO3\CMS\Lang\Domain\Model\Language::class,
+ Language::class,
$locale,
$label,
in_array($locale, $this->selectedLocales),
}
$dir = count($languages) - count($this->selectedLocales);
$diff = $dir < 0 ? array_diff($this->selectedLocales, $languages) : array_diff($languages, $this->selectedLocales);
- GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class)->setLocalConfigurationValueByPath(
+ GeneralUtility::makeInstance(ConfigurationManager::class)->setLocalConfigurationValueByPath(
$this->configurationPath,
array('availableLanguages' => $languages)
);
}
return $this->updateSelectedLanguages($locales);
}
+
+ /**
+ * Returns LanguageService
+ *
+ * @return \TYPO3\CMS\Lang\LanguageService
+ */
+ protected function getLanguageService()
+ {
+ return $GLOBALS['LANG'];
+ }
}
* The TYPO3 project - inspiring people to share!
*/
+use TYPO3\CMS\Core\Charset\CharsetConverter;
+use TYPO3\CMS\Core\Localization\Locales;
use TYPO3\CMS\Core\Localization\LocalizationFactory;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
public function init($lang)
{
// Initialize the conversion object:
- $this->csConvObj = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Charset\CharsetConverter::class);
+ $this->csConvObj = GeneralUtility::makeInstance(CharsetConverter::class);
// Initialize the parser factory object
$this->parserFactory = GeneralUtility::makeInstance(LocalizationFactory::class);
// Find the requested language in this list based
// on the $lang key being inputted to this function.
/** @var $locales \TYPO3\CMS\Core\Localization\Locales */
- $locales = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\Locales::class);
+ $locales = GeneralUtility::makeInstance(Locales::class);
// Language is found. Configure it:
if (in_array($lang, $locales->getLocales())) {
// The current language key
* The TYPO3 project - inspiring people to share!
*/
+use TYPO3\CMS\Core\Registry;
+
/**
* Registry service
*/
/**
* @param \TYPO3\CMS\Core\Registry $registry
*/
- public function injectRegistry(\TYPO3\CMS\Core\Registry $registry)
+ public function injectRegistry(Registry $registry)
{
$this->registry = $registry;
}
* The TYPO3 project - inspiring people to share!
*/
+use TYPO3\CMS\Core\Exception;
+use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtility;
+use TYPO3\CMS\Lang\Exception\Language as LanguageException;
+use TYPO3\CMS\Lang\Exception\XmlParser as XmlParserException;
/**
* Extends of extensionmanager ter connection to enrich with translation
* related methods
*/
-class TerService extends \TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtility implements \TYPO3\CMS\Core\SingletonInterface
+class TerService extends TerUtility implements SingletonInterface
{
/**
* Fetches extensions translation status
$line = xml_get_current_line_number($parser);
$error = xml_error_string(xml_get_error_code($parser));
xml_parser_free($parser);
- throw new \TYPO3\CMS\Lang\Exception\XmlParser('Error in XML parser while decoding l10n XML file. Line ' . $line . ': ' . $error, 1345736517);
+ throw new XmlParserException('Error in XML parser while decoding l10n XML file. Line ' . $line . ': ' . $error, 1345736517);
} else {
// Init vars
$stack = array(array());
// Traverse the parsed XML structure:
foreach ($values as $val) {
// First, process the tag-name (which is used in both cases, whether "complete" or "close")
- $tagName = ($val['tag'] == 'languagepack' && $val['type'] == 'open') ? $val['attributes']['language'] : $val['tag'];
+ $tagName = (string)($val['tag'] == 'languagepack' && $val['type'] == 'open') ? $val['attributes']['language'] : $val['tag'];
if (!$documentTag) {
$documentTag = $tagName;
}
$absoluteLanguagePath = GeneralUtility::getFileAbsFileName(PATH_typo3conf . $relativeLanguagePath);
$absoluteExtensionLanguagePath = GeneralUtility::getFileAbsFileName(PATH_typo3conf . $relativeLanguagePath . $extensionKey . '/');
if (empty($absolutePathToZipFile) || empty($absoluteLanguagePath) || empty($absoluteExtensionLanguagePath)) {
- throw new \TYPO3\CMS\Lang\Exception\Language('Given path is invalid.', 1352565336);
+ throw new LanguageException('Given path is invalid.', 1352565336);
}
if (!is_dir($absoluteLanguagePath)) {
GeneralUtility::mkdir_deep(PATH_typo3conf, $relativeLanguagePath);
$result = true;
}
}
- } catch (\TYPO3\CMS\Core\Exception $exception) {
+ } catch (Exception $exception) {
// @todo logging
}
return $result;
$l10nResponse = GeneralUtility::getURL($mirrorUrl . $packageUrl, 0, array(TYPO3_user_agent));
if ($l10nResponse === false) {
- throw new \TYPO3\CMS\Lang\Exception\XmlParser('Error: Translation could not be fetched.', 1345736785);
+ throw new XmlParserException('Error: Translation could not be fetched.', 1345736785);
} else {
return array($l10nResponse);
}
$absoluteTargetPath, zip_entry_read($zipEntry, zip_entry_filesize($zipEntry))
);
if ($return === false) {
- throw new \TYPO3\CMS\Lang\Exception\Language('Could not write file ' . $zipEntryName, 1345304560);
+ throw new LanguageException('Could not write file ' . $zipEntryName, 1345304560);
}
} else {
- throw new \TYPO3\CMS\Lang\Exception\Language('Could not write file ' . $zipEntryName, 1352566904);
+ throw new LanguageException('Could not write file ' . $zipEntryName, 1352566904);
}
}
} else {
- throw new \TYPO3\CMS\Lang\Exception\Language('Extension directory missing in zip file!', 1352566905);
+ throw new LanguageException('Extension directory missing in zip file!', 1352566905);
}
}
} else {
- throw new \TYPO3\CMS\Lang\Exception\Language('Unable to open zip file ' . $file, 1345304561);
+ throw new LanguageException('Unable to open zip file ' . $file, 1345304561);
}
return $result;
}
* The TYPO3 project - inspiring people to share!
*/
+use TYPO3\CMS\Core\SingletonInterface;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
+use TYPO3\CMS\Extensionmanager\Utility\Repository\Helper;
+
/**
* Translation service
*/
-class TranslationService implements \TYPO3\CMS\Core\SingletonInterface
+class TranslationService implements SingletonInterface
{
/**
* Status codes for AJAX response
/**
* @param \TYPO3\CMS\Lang\Service\TerService $terService
*/
- public function injectTerService(\TYPO3\CMS\Lang\Service\TerService $terService)
+ public function injectTerService(TerService $terService)
{
$this->terService = $terService;
}
/**
* @param \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher
*/
- public function injectSignalSlotDispatcher(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher)
+ public function injectSignalSlotDispatcher(Dispatcher $signalSlotDispatcher)
{
$this->signalSlotDispatcher = $signalSlotDispatcher;
}
/**
* @param \TYPO3\CMS\Extensionmanager\Utility\Repository\Helper $helper The helper
*/
- public function injectRepositoryHelper(\TYPO3\CMS\Extensionmanager\Utility\Repository\Helper $helper)
+ public function injectRepositoryHelper(Helper $helper)
{
$this->mirrorUrl = $helper->getMirrors(false)->getMirrorUrl();
}
public function updateTranslation($extensionKey, $locales)
{
if (is_string($locales)) {
- $locales = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $locales);
+ $locales = GeneralUtility::trimExplode(',', $locales);
}
$locales = array_flip((array) $locales);
foreach ($locales as $locale => $key) {
$state = static::TRANSLATION_INVALID;
+ $error = '';
try {
$state = $this->updateTranslationForExtension($extensionKey, $locale);
} catch (\Exception $exception) {
* The TYPO3 project - inspiring people to share!
*/
+use TYPO3\CMS\Extbase\Mvc\View\AbstractView;
+use TYPO3\CMS\Extbase\Mvc\Web\Response;
+use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
+
/**
* Base class for JSON views
*/
-abstract class AbstractJsonView extends \TYPO3\CMS\Extbase\Mvc\View\AbstractView
+abstract class AbstractJsonView extends AbstractView
{
/**
* @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
/**
* @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
*/
- public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
+ public function injectObjectManager(ObjectManagerInterface $objectManager)
{
$this->objectManager = $objectManager;
}
*/
protected function sendResponse(array $data)
{
- $response = $this->objectManager->get(\TYPO3\CMS\Extbase\Mvc\Web\Response::class);
+ $response = $this->objectManager->get(Response::class);
$response->setHeader('Content-Type', 'application/json; charset=utf-8');
$response->setContent(json_encode($data));
$response->sendHeaders();
$data = array();
$languages = $this->variables['languages'];
foreach ($this->variables['extensions'] as $extension) {
+ /** @var $extension \TYPO3\CMS\Lang\Domain\Model\Extension */
$extensionArray = $extension->toArray();
$row = array(
$extensionArray,
$extensionArray,
);
foreach ($languages as $language) {
+ /** @var $language \TYPO3\CMS\Lang\Domain\Model\Language */
$row[] = $language->toArray();
}
$data[] = $row;