xfra35 / f3-multilang

Create multilingual apps with this localization plugin for the PHP Fat-Free Framework
GNU General Public License v3.0
48 stars 13 forks source link

Skip $global routes when $migrate is false. #23

Closed ursulnegrul closed 4 years ago

ursulnegrul commented 4 years ago

Hi, I assumed that setting $global as an array of aliases ['adm_login','adm_dash'] would skip the Multilang rewrite but no, I get 404 for /admlogin and 200 for /en/admlogin. How would I accomplish this without manually rewritting routes ? Thank you for your time.

xfra35 commented 4 years ago

Can you share your config (PHP or ini)?

ursulnegrul commented 4 years ago

Ups .. another case of should test yourself first .. I have some bug somewhere with the dynamic routes, the simple test works as expected.. thank you for your time. `<?php

namespace {

    require 'vendor/autoload.php';

    $f3 = \Base::instance();

    $f3->route('GET home: /home',static function(){ echo 'Home page'; });
    $f3->route('GET adm_login: /login',static function(){ echo 'Login page'; });
    $f3->route('GET adm_dash: /dash',static function(){ echo 'Dash page'; });

    $ML = &$f3->ref('MULTILANG');
    $ML['languages'] = ['en' => 'en', 'fr' => 'fr'];
    $ML['migrate'] = false;
    $ML['global'] = ['adm_login', 'adm_dash'];
    $ML['root'] = static function(){ echo 'Root handler'; };

    Multilang::instance();

    $f3->run();
}`