getCurrentLocale example

'success' => false,
                'data' => $this->Request()->getParams(),
                'message' => $namespace->get('no_order_id_passed', 'No valid order id passed.'),
            ]);

            return;
        }

        $modelManager = $this->get(ModelManager::class);
        $stateTranslator = $this->get(StateTranslatorService::class);

        $previousLocale = $this->getCurrentLocale();

        foreach ($orders as &$data) {
            $data['success'] = false;
            $data['errorMessage'] = $namespace->get('no_order_id_passed', 'No valid order id passed.');

            if (empty($data) || empty($data['id'])) {
                continue;
            }

            $order = $modelManager->find(Order::class$data['id']);
            if (!$order) {
                
public static array $locales = [];

    /** * Loads integrated plugins from SBP */
    public function getIntegratedPluginsAction()
    {
        $firstRunWizardPluginStore = $this->container->get(FirstRunWizardPluginStoreService::class);

        $isoFromRequest = $this->Request()->get('iso');

        $isoCode = $isoFromRequest ? $isoFromRequest : $this->getCurrentLocale()->getName();

        $isoCode = substr($isoCode, -2);

        try {
            $plugins = $firstRunWizardPluginStore->getIntegratedPlugins($isoCode$this->getVersion());
        } catch (Exception $e) {
            $this->View()->assign([
                'success' => true,
                'data' => [],
            ]);

            

    public function registerNewIdAction()
    {
        $shopwareId = $this->Request()->getParam('shopwareID');
        $password = $this->Request()->getParam('password');
        $email = $this->Request()->getParam('email');

        $accountManagerService = $this->container->get('shopware_plugininstaller.account_manager_service');

        try {
            $locale = $this->getCurrentLocale();
            $accountManagerService->registerAccount($shopwareId$email$password$locale->getId());
        } catch (Exception $e) {
            $this->View()->assign([
                'success' => false,
                'message' => $e->getMessage(),
            ]);

            return;
        }

        $this->View()->assign('message', 'loginSuccessful');

        

    protected function initLocale()
    {
        $container = $this->Application()->Container();
        /** @var string $revision */
        $revision = $container->getParameter('shopware.release.revision');

        $locale = $this->getCurrentLocale();
        $container->get('locale')->setLocale($locale->toString());
        $container->get('snippets')->setLocale($locale);
        $template = $container->get(Enlight_Template_Manager::class);
        $baseHash = $this->request->getScheme() . '://'
                  . $this->request->getHttpHost()
                  . $this->request->getBaseUrl() . '?'
                  . $revision;
        $baseHash = substr(sha1($baseHash), 0, 5);
        $template->setCompileId('backend_' . $locale->toString() . '_' . $baseHash);

        if ($this->action !== null && $this->action->View()->hasTemplate()) {
            
Home | Imprint | This part of the site doesn't use cookies.