<commit_before><?php

namespace Bolt\Extension\Animal\Translate\Frontend;

use Bolt\Menu\Menu;
use Bolt\Menu\MenuBuilder;
use Bolt\Translation\Translator as Trans;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;

class LocalizedMenuBuilder extends MenuBuilder
{
    private $prefix = '';
    
    public function resolve(array $menu)
    {
        $reflection = new \ReflectionClass($this);
        $prop = $reflection->getParentClass()->getProperty('app');
        $prop->setAccessible(true);
        $this->app = $prop->getValue($this);
        
        if (isset($this->app['translate.slug'])) {
            $this->prefix = $this->app['translate.slug'] . '/';
        }
        
        return $this->menuBuilder($menu);
    }
    
    private function menuBuilder(array $menu)
    {
        foreach ($menu as $key => $item) {
            $menu[$key] = $this->menuHelper($item);
            if (isset($item['submenu'])) {
                $menu[$key]['submenu'] = $this->menuBuilder($item['submenu']);
            }
        }
<commit_msg>Fix non-prefix routing.<commit_after><?php

namespace Bolt\Extension\Animal\Translate\Frontend;

use Bolt\Menu\Menu;
use Bolt\Menu\MenuBuilder;
use Bolt\Translation\Translator as Trans;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;

class LocalizedMenuBuilder extends MenuBuilder
{
    private $prefix = '';
    
    public function resolve(array $menu)
    {
        $reflection = new \ReflectionClass($this);
        $prop = $reflection->getParentClass()->getProperty('app');
        $prop->setAccessible(true);
        $this->app = $prop->getValue($this);
        
        if (isset($this->app['translate.slug']) && $this->app['translate.config']->isRoutingOverride()) {
            $this->prefix = $this->app['translate.slug'] . '/';
        }
        
        return $this->menuBuilder($menu);
    }
    
    private function menuBuilder(array $menu)
    {
        foreach ($menu as $key => $item) {
            $menu[$key] = $this->menuHelper($item);
            if (isset($item['submenu'])) {
                $menu[$key]['submenu'] = $this->menuBuilder($item['submenu']);
            }
        }

{'fraction_non_alphanumeric': 0.15537332757876565, 'fraction_numerical': 0.0, 'mean_word_length': 2.8, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3089406', 'n_tokens_mistral': 663, 'n_tokens_neox': 672, 'n_words': 111}