Deletes the locale

@param                 $localeCode
@param OutputInterface $output
324367
protected function deleteLocaleData($localeCode, OutputInterface $output)
    {
        $entityManager = $this->getDoctrineHelper()->getEntityManager();
        $metadata      = $this->getDoctrineHelper()->getAllMetadata();
        $locale        = $this->getLocaleRepository()->findOneBy(['code' => $localeCode]);
        if (!$locale instanceof LocaleInterface) {
            throw new InvalidArgumentException(sprintf('Wrong locale code "%s" was given', $localeCode));
        }
        foreach ($metadata as $classMetadata) {
            $reflectionClass = $classMetadata->getReflectionClass();
            if ($reflectionClass->implementsInterface(\WellCommerce\Bundle\LocaleBundle\Entity\LocaleAwareInterface::class)) {
                $repository = $entityManager->getRepository($reflectionClass->getName());
                $this->deleteTranslatableEntities($repository, $locale, $output);
            }
        }
        
        $entityManager->remove($locale);
    }
46038
public void setLocale(final Locale locale) {
        if (!equals(this.locale, locale)) {
            this.locale = locale;
            super.setValue(toString(locale));
            i18nBundleProvider.reloadBundles(locale);
        }
    }
79367
static function localeList( $asObject = false, $withVariations = true )
    {
        $locales =& $GLOBALS['eZLocaleLocaleStringList'];
        if ( !is_array( $locales ) )
        {
            $localeRegexp = eZLocale::localeRegexp( $withVariations, false );
            $locales = array();
            $dir = opendir( 'share/locale' );
            while( ( $file = readdir( $dir ) ) !== false )
            {
                if ( preg_match( "/^($localeRegexp)\.ini$/", $file, $regs ) )
                {
                    $locales[] = $regs[1];
                }
            }
            closedir( $dir );
            $locales = array_unique( $locales );
            sort( $locales );
            if ( $asObject )
            {
                $localeObjects = array();
                foreach ( $locales as $locale )
                {
                    $localeInstance = eZLocale::instance( $locale );
                    if ( $localeInstance )
                        $localeObjects[] = $localeInstance;
                }
                $locales = $localeObjects;
            }
        }
        return $locales;
    }
1037068
public function removeTranslation($document, $locale)
    {
        $class = $this->dm->getClassMetadata(get_class($document));
        if ($invoke = $this->eventListenersInvoker->getSubscribedSystems($class, Event::preRemoveTranslation)) {
            $this->eventListenersInvoker->invoke(
                $class,
                Event::preRemoveTranslation,
                $document,
                new LifecycleEventArgs($document, $this->dm),
                $invoke
            );
        }

        $metadata = $this->dm->getClassMetadata(get_class($document));
        if (!$this->isDocumentTranslatable($metadata)) {
            return;
        }

        if (1 === count($this->getLocalesFor($document))) {
            throw new PHPCRException('The last translation of a translatable document may not be removed');
        }

        if ($document instanceof Proxy) {
            $document->__load();
        }

        $oid = spl_object_hash($document);
        $this->documentTranslations[$oid][$locale] = null;
        $this->setLocale($document, $metadata, null);
    }
596217
public function delete($id)
    {
        $this->loadModel('Locale.Languages');
        $language = $this->Languages->get($id);

        if (!in_array($language->code, [CORE_LOCALE, option('default_language')])) {
            if ($this->Languages->delete($language)) {
                $this->Flash->success(__d('locale', 'Language successfully removed!'));
            } else {
                $this->Flash->danger(__d('locale', 'Language could not be removed, please try again.'));
            }
        } else {
            $this->Flash->danger(__d('locale', 'You cannot remove this language as it still in use.'));
        }

        $this->title(__d('locale', 'Delete Language'));
        $this->redirect($this->referer());
    }
892569
public function initialize(OutputInterface $output = null, $purge = false)
    {
        $output = $output ?: new NullOutput();

        arsort($this->initializerMap);

        foreach (array_keys($this->initializerMap) as $initializerId) {
            $output->writeln(sprintf('<comment>%s</>', $initializerId));
            $initializer = $this->container->get($initializerId);
            $initializer->initialize($output, $purge);
        }
        $output->write(PHP_EOL);
        $output->writeln('<comment>*</> Legend: [+] Added [*] Updated [-] Purged [ ] No change');
    }
405149
private function createDeleteForm(Localidad $localidad)
    {
        return $this->createFormBuilder()
            ->setAction($this->generateUrl('localidad_delete', array('id' => $localidad->getId())))
            ->setMethod('DELETE')
            ->getForm()
        ;
    }
693324
public function getTranslations($localeCode)
    {
        $locale = $this->getLocaleByCode($localeCode);

        if (!$locale->hasPoFile()) {
            throw new Exception(sprintf(__("The project has never been scanned for %s.", 'strata'), $locale->getNativeLabel()));
        }

        return Translations::fromPoFile($locale->getPoFilePath());
    }
1049023
public void actionDeleteElementLocale() throws JspException {

        try {
            Locale loc = getElementLocale();
            m_content.removeLocale(loc);
            //write the modified xml content
            writeContent();
            List<Locale> locales = m_content.getLocales();
            if (locales.size() > 0) {
                // set first locale as new display locale
                Locale newLoc = locales.get(0);
                setParamElementlanguage(newLoc.toString());
                m_elementLocale = newLoc;
            } else {
                if (LOG.isErrorEnabled()) {
                    LOG.error(Messages.get().getBundle().key(Messages.LOG_GET_LOCALES_1, getParamResource()));
                }
            }

        } catch (CmsXmlException e) {
            // an error occurred while trying to delete the locale, stop action
            showErrorPage(e);
        } catch (CmsException e) {
            // should usually never happen
            if (LOG.isInfoEnabled()) {
                LOG.info(e.getLocalizedMessage(), e);
            }
        }
    }
402149
public function resetForLocale(LocaleEntity $locale)
    {
        $this->createQueryBuilder('t')
            ->delete()
            ->where('t.locale = :locale')->setParameter('locale', $locale)
            ->getQuery()->execute();
    }
548724
public function deleteTranslation($locale, $id)
    {
        if ('en' === $locale) {
            $content = $this->content->findOneBy(['id' => $id]);
        } else {
            $content = $this->translations->findOneBy(['foreignKey' => $id, 'locale' => $locale]);
        }

        if ($content instanceof ContentTranslation || $content instanceof Content) {
            $this->manager->remove($content);
            $this->manager->flush();
        }
    }
347241
public static void removeLocalTID(int localTID)
    {
        if (tc.isEntryEnabled()) Tr.entry(tc, "removeLocalTID", localTID);

        localTIDMap.remove(localTID);

        if (tc.isEntryEnabled()) Tr.exit(tc, "removeLocalTID");
    }
459178
public function deletePage(Node $node, $locale)
    {
        $nodeTranslation = $node->getNodeTranslation($locale, true);
        $nodeVersion = $nodeTranslation->getPublicNodeVersion();
        $page = $nodeVersion->getRef($this->em);

        $this->eventDispatcher->dispatch(
            Events::PRE_DELETE,
            new NodeEvent($node, $nodeTranslation, $nodeVersion, $page)
        );

        $node->setDeleted(true);
        $this->em->persist($node);

        $this->deleteNodeChildren($node, $locale);
        $this->em->flush();

        $this->eventDispatcher->dispatch(
            Events::POST_DELETE,
            new NodeEvent($node, $nodeTranslation, $nodeVersion, $page)
        );

        return $nodeTranslation;
    }
861173
public static function set(string $defaultLocal)
    {
        if (self::$hasBeenSet) {
            throw new LocaleException(
                'Default locale may only be set once'
            );
        }
        self::$defaultLocal = $defaultLocal;
        self::$hasBeenSet = true;
    }
271434
private function dropCountry(
        LocationInterface $location,
        OutputInterface $output
    ) {
        $countryCode = $location->getCode();
        $this->startStopWatch('drop_location');
        $this
            ->locationDirector
            ->remove($location);

        $stopWatchEvent = $this->stopStopWatch('drop_location');
        $this
            ->printMessage(
                $output,
                'Geo',
                'Country ' . $countryCode . ' dropped in ' . $stopWatchEvent->getDuration() . ' milliseconds'
            );

        return $this;
    }
46489
public function deleteLocalFiles($localPath)
    {
        $it = new RecursiveDirectoryIterator(
            $localPath,
            RecursiveDirectoryIterator::SKIP_DOTS
        );

        $files = new RecursiveIteratorIterator(
            $it,
            RecursiveIteratorIterator::CHILD_FIRST
        );

        foreach ($files as $file) {
            if ($file->isDir()) {
                rmdir($file->getRealPath());
            } else {
                unlink($file->getRealPath());
            }
        }

        rmdir($localPath);
    }
1253052
private function removeByPrefix(InputInterface $input, OutputInterface $output)
    {
        $prefix = $input->getOption('prefix');
        $output->writeln(
            sprintf('<comment>Removing all resources from <info>%s</info></comment>', $prefix)
        );

        $api = $this->getCloudinaryApi();

        $response = $api->delete_resources_by_prefix($prefix);
        $this->outputApiResponse($response, 'deleted', $output);
    }