PHP code example of zachleigh / laravel-lang-bundler

1. Go to this page and download the library: Download zachleigh/laravel-lang-bundler 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/ */

    

zachleigh / laravel-lang-bundler example snippets


    'welcome' => 'Welcome!',
    'login' => 'Login',
    'signup' => 'Signup',

    'profile' => 'Your Profile',
    'friends' => 'Your Friends',
    'body' => 'Enter body below',

return [
    'home.welcome',
    'home.login',
    'home.signup',
    'user.profile',
    'user.friends',
    'user.body'
];

transB('bundles.components.bundle_name');

transB('bundle_name');

[
    'welcome' => 'Welcome!',
    'login' => 'Login',
    'signup' => 'Signup',
    'profile' => 'Your Profile',
    'friends' => 'Your Friends',
    'body' => 'Enter body below',
];

transB('bundle_name', ['parameterName' => $value]);

return [
    'welcome_user' => 'Welcome :user',
    'message_to'   => 'You sent a message to :user',
    'invite_from'  => 'You have an invite from :user'
];

return [
    'user.welcome_user',
    'user.message_to',
    'user.invite_from'
];

transB('bundle_name', [
    'welcome_user.user' => 'Bob',
    'message_to.user' => 'Sally',
    'invite_from.user' => 'George'
]);

'inbox_status' => 'You have a new message.|You have new messages'

'home.inbox_status'

transB('bundle_name', ['inbox_status.choice' => 3]);

bundle_item($id, $type, $parameters = []);

return [
    'welcome_user' => 'Welcome :user',
    'message_to'   => 'You sent a message to :user',
    'invite_from'  => 'You have an invite from :user'
];

return [
    bundle_item('user.welcome_user', 'value_strtoupper'),
    'user.message_to',
    'user.invite_from'
];

return [
    bundle_item('user.welcome_user', 'key_strtoupper'),
    'user.message_to',
    'user.invite_from'
];

return [
    bundle_item('user.welcome_user', 'both_strtoupper'),
    'user.message_to',
    'user.invite_from'
];

bundle_item('user.welcome_user', 'value_callback', [
    'callback' => 'function_name'
]),

bundle_item('user.invite_from', 'key_change', [
    'new' => 'newKey'
]),

bundle_item('user.invite_from', 'value_explode', [
    'delimiter' => ' '
]),

bundle_item('home.invite_from', 'value_strtolower')

bundle_item('home.invite_from', 'value_strtoupper')

bundle_item('home.invite_from', 'value_ucfirst')

bundle_item('home.months', 'value_values')

    /**
     * Alter key and return.
     *
     * @param string $key
     *
     * @return string
     */
    abstract public function key($key);

    /**
     * Alter value and return.
     *
     * @param mixed $value
     *
     * @return mixed
     */
    abstract public function value($value);

'aliases' [
    'alias' => 'full.path.to.bundle'
];

transB('alias');

return [
    'user.welcome_user',
    'user.message_to',
    'user.invite_from'
];

return [
    'welcomeUser' => 'Welcome user!',
    'messageTo' => 'Message to user',
    'inviteFrom' => 'You have an invitation from user!',
];

return [
    'bundle_name' => [
        'translations.home',
        'translations.navigation',
        'translations.menu',
        'translations.login'
    ];
];

return [
    'bundle_name' => [
        'home',
        'navigation',
        'menu',
        'login'
    ];
];

php artisan vendor:publish --tag=config

php artisan langb:start

php artisan langb:new components.user.profile