Download the PHP package bernardomacedo/laravel-db-translator without Composer
On this page you can find all versions of the php package bernardomacedo/laravel-db-translator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bernardomacedo/laravel-db-translator
More information about bernardomacedo/laravel-db-translator
Files in bernardomacedo/laravel-db-translator
Package laravel-db-translator
Short Description Laravel 5.6 database translation extension
License MIT
Homepage https://github.com/bernardomacedo/laravel-db-translator
Informations about the package laravel-db-translator
Laravel Database Translator
This package allows you to add translations to database and generates the localization folders per group.
Note:
- It does not replace the current Laravel translator by using another function call to build key/value translations.
- It does not conflict with your current Laravel project.
- It does not replace any of your current translations and works seamlessly with your language files, because this package generates it's own language files and directories.
- Dev Laravel 5.6
Compatibility
Laravel Framework 5.6
Install
First register the service provider and facade in your application.
To publish all settings...
...or individually:
And run migrations
Add a disk to the filesystems.php
filestorage:
If you change the default disk name, because it might conflict with another package or with a potential future one, be sure to change it under the published db-translator.php => storage_driver` parameter.
Usage
Default language set to App::getLocale()
.
In a blade template use:
This translation method is easier to interpret because even if the translation is not found, the text you input will be returned.
What groups are for?
Sometimes you need to generate a specific translation for a context based situation. Where the same phrase or text you wish to translate, means something different in other languages. So, the group parameter allows you to differentiate the same translation to be translated differently depending on context.
Dynamic groups and variables
When using dynamic variables for translation, be sure to force a group named 'dynamic_...'
Translating a text
DBTranslator will try to find the $variable_id
and the $language_id
for you if you only supply strings.
Sometimes you wish to create a variable for translating, adding a translation directly on a language you choose.
So, supplying a string on $variable_id that does not exist on the translations_variables
table, will generate a new one, adding an entry to the translations_translated
table directly.
Generating the translation files
on a controller class
This will create all required files under the directory supplied on the filesystems.php
file.
Getting all variables on database
Getting available translations
Inserting / Removing translations into/from database without rendering views in the browser
You can add translations to database without rendering a view.
For this you can run a artisan command and Laravel Database Translator
will check your view folders configured under config/view.php
config file paths
and will add any element of lang(*) found to the database.
Inserting translations
Removing unused translations
When running these commands, Dynamic groups
and `$variables will be ignored.
eg:
Generating translations
Generates for Portuguese
Generates for Spanish
Generates all languages
Generates active languages
Generates inactive languages
License
The Laravel Database Translator is open-sourced software licensed under the MIT license
All versions of laravel-db-translator with dependencies
illuminate/translation Version 5.6.x
illuminate/database Version 5.6.x
illuminate/console Version 5.6.x
illuminate/filesystem Version 5.6.x
illuminate/config Version 5.6.x
illuminate/routing Version 5.6.x