Alternative rc.initial "cheap menu"



  • By implementation, not visual representation though.  Here's the original.

    
    echo '
    require_once("config.inc");
    echo "\n\n";
    echo " ". gettext("pfSense console setup") . " \n";
    echo "***********************\n";
    echo gettext(" 0)  Logout (SSH only)") . "\n";
    echo gettext(" 1)  Assign Interfaces") . "\n";
    echo gettext(" 2)  Set LAN IP address") . "\n";
    echo gettext(" 3)  Reset webGUI password") . "\n";
    echo gettext(" 4)  Reset to factory defaults") . "\n";
    echo gettext(" 5)  Reboot system") . "\n";
    echo gettext(" 6)  Halt system") . "\n";
    echo gettext(" 7)  Ping host") . "\n";
    echo gettext(" 8)  Shell") . "\n";
    echo gettext(" 9)  PFtop")  . "\n";
    echo gettext("10)  Filter Logs") . "\n";
    echo gettext("11)  Restart webConfigurator") . "\n";
    echo gettext("12)  System logs") . "\n";
    echo gettext("13)  Change keyboard mapping") . "\n";
    ?>' | php -q
    
    

    Here is an alternative.

    
    php -q -d auto_prepend_file=config.inc < <moo<br>echo	_(' pfSense console setup ')		. "\n" .
              '***********************'		. "\n" .
    	_(' 0)  Logout (SSH only)')		. "\n" .
    	_(' 1)  Assign Interfaces')		. "\n" .
    	_(' 2)  Set LAN IP address')		. "\n" .
    	_(' 3)  Reset webGUI password')		. "\n" .
    	_(' 4)  Reset to factory defaults')	. "\n" .
    	_(' 5)  Reboot system')			. "\n" .
    	_(' 6)  Halt system')			. "\n" .
    	_(' 7)  Ping host')			. "\n" .
    	_(' 8)  Shell')				. "\n" .
    	_(' 9)  PFtop')				. "\n" .
    	_('10)  Filter Logs')			. "\n" .
    	_('11)  Restart webConfigurator')	. "\n" .
    	_('12)  System logs')			. "\n" .
    	_('13)  Change keyboard mapping')	. "\n";
    ?>
    MOO</moo<br> 
    

    Its a shame there is no console exec() in PHP, although pcntl_exec() might be better in PHP 5, I'm testing with 4.11.



  • Importantly for asian language characters used as graphics need to be included too.  In this case the asterisk underline will be incorrect for a full width Japanese title:

    
    みるのディレクトル・サーバーのセットアップのコンソール
    ***********************************
    
    

    Add that to gettext and the translator can adjust to full width characters.

    
    みるのディレクトル・サーバーのセットアップのコンソール
    ***************************
    
    

    A quirk of gettext() is that full width will be automagically downsized to half width unless the full LANG is specified, in this case ja_JP.SJIS.



  • @MrMoo:

    Importantly for asian language characters used as graphics need to be included too.  In this case the asterisk underline will be incorrect for a full width Japanese title:

    
    みるのディレクトル・サーバーのセットアップのコンソール
    ***********************************
    
    

    Add that to gettext and the translator can adjust to full width characters.

    
    みるのディレクトル・サーバーのセットアップのコンソール
    ***************************
    
    

    A quirk of gettext() is that full width will be automagically downsized to half width unless the full LANG is specified, in this case ja_JP.SJIS.

    I see what your saying, but the asterik underline isn't being called by gettext in the original code. I know that the menu on my ip330 takes 3-5 seconds to show up. Probably from all the individual gettext function calls.



  • @rsw686:

    I see what your saying, but the asterik underline isn't being called by gettext in the original code. I know that the menu on my ip330 takes 3-5 seconds to show up. Probably from all the individual gettext function calls.

    That's the point, it should.  When translating to Chinese or Japanese the asterisk line looks silly as its too short.

    Anyway another feature which I should include a patch for is only displaying the SSH logout for SSH connections, easy to do:

    
    if (\$_ENV['SSH_CLIENT'])
    echo    _('0) Logout')
    
    

Locked