PHP code example of ixudra / translation

1. Go to this page and download the library: Download ixudra/translation library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ixudra / translation example snippets



    'providers'       => array(

        //...
        Ixudra\Translation\TranslationServiceProvider::class,

    ),



    'facades'       => array(

        //...
        'Translate'       => Ixudra\Translation\Facades\Translation::class,

    ),



    'providers'     => array(

        //...
        'Ixudra\Translation\TranslationServiceProvider',

    ),



    'facades'       => array(

        //...
        'Translation'          => 'Ixudra\Translation\Facades\Translation',

    ),



    // Translate the message in the app default locale
    Translate::message('your.key.goes.here');

    // Translate the message in a given locale
    Translate::message('your.key.goes.here', $locale);



    // Translate the message in the app default locale
    Translate::model('user.create.success');

    // Translate the message in a given locale
    Translate::model('user.create.success', $locale);



    

        return array(

            'menu.title.index'                  => '##models.:model.plural##',
            'menu.title.new'                    => 'New ##models.:model.singular##',
            'menu.title.edit'                   => 'Edit ##models.:model.singular##',

        );



    // Translate the message in the app default locale
    Translate::recursive('admin.menu.title.new', array('model' => 'user'));

    // Translate the message and keep the first character as lowercase (changed to uppercase by default)
    Translate::recursive('admin.menu.title.new', array('model' => 'user'), false);

    // Translate the message in a given locale
    Translate::recursive('admin.menu.title.new', array('model' => 'user'), true, $locale);



    // Publish all resources from all packages
    php artisan vendor:publish

    // Publish only the resources of the package
    php artisan vendor:publish --provider="Ixudra\\Translation\\TranslationServiceProvider"