Download the PHP package highsolutions/laravel-translation-manager without Composer

On this page you can find all versions of the php package highsolutions/laravel-translation-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-translation-manager

Laravel Translation Manager

Easy management of translations in Laravel.

Laravel-Translation-Manager by HighSolutions

Installation

Add the following line to the require section of your Laravel webapp's composer.json file:

Run composer update to install the package.

Then, update config/app.php by adding an entry for the service provider:

Next, publish all package resources:

This will add to your project:

- migration - database table for storing translations
- configuration - package configurations
- views - configurable views for translation management
- translations - translations for webinterface

Remember to launch migration:

Workflow

This package doesn't replace the Translation system, only import/export PHP files to a database and make them editable in browser. Package contains helper for live editing content on website.

The workflow would be:

- Import translations: Read all translation files and save them in the database
- Find all translations in php/twig sources
- Optionally: Listen to missing translation with the custom Translator
- Optionally: Mark not-translated records as not-translated (suffix command)
- Translate all keys through the webinterface
- Export: Write all translations back to the translation files.

Usage

You can access package in http://yourdomain.com/translations in default configuration. You can change as you pleased.

Configuration

Setting name Description Default value
route Route declaration (prefix, namespace, middlewares etc.) [,'prefix' => 'translations', 'namespace' => 'HighSolutions\TranslationManager', 'middleware' => [,'web', 'auth',],]
delete_enabled Enable deletion of translations true
exclude_groups Exclude specific file groups (like validation, pagination, routes etc.) []
exclude_langs Exclude specific langs and directories (like vendor and en, etc.) []
basic_lang Basic language used by translator. 'en'
sort_keys Export translations with keys output alphabetically. false
highlight_locale_marked Highlight lines with locale marked as not translated. false
live_translation_enabled Enable live translation of content. false
popup_placement Position of live translation popup. top
permissions Define whow and when can edit translations. env('APP_ENV') == 'local'

Commands

Import command

The import command will search through app/lang and load all strings in the database, so you can easily manage them.

Note: By default, only new strings are added. Translations already in the DB are kept the same. If you want to replace all values with the ones from the files, add the --replace (or -R) option: php artisan translations:import --replace

Find translations in source

The Find command/button will look search for all php/twig files in the app directory, to see if they contain translation functions, and will try to extract the group/item names. The found keys will be added to the database, so they can be easily translated. This can be done through the webinterface, or via an Artisan command.

Export command

The export command will write the contents of the database back to resources/lang php files. This will overwrite existing translations and remove all comments, so make sure to backup your data before using. Supply the group name to define which groups you want to publish. If you want to export all groups, provide * as name of group.

For example, php artisan translations:export reminders when you have 2 locales (en/pl), will write to resources/lang/en/reminders.php and resources/lang/pl/reminders.php

Clean command

The clean command will search for all translation that are NULL and delete them, so your interface is a bit cleaner. Note: empty translations are never exported.

Reset command

The reset command simply clears all translation in the database, so you can start fresh (by a new import). Make sure to export your work if needed before doing this.

Clone command

The clone command copy directory of basic language (langFrom parameter) and saves as new language (langTo parameter). After this operation you will need to launch import command.

Suffix command

The suffix command analyzes all translations from new locale (langNew parameter) and if the value is the same as in original language (langOriginal parameter) then adds suffix to the end of value of new locale translations to mark that this translation needs to be translated. The suffix is locale code (e.g. EN) upper-cased.

Detect missing translations

Most translations can be found by using the Find command (see above), but in case you have dynamic keys (variables/automatic forms etc), it can be helpful to 'listen' to the missing translations. To detect missing translations, we can swap the Laravel TranslationServicepProvider with a custom provider. In your config/app.php, comment out the original TranslationServiceProvider and add the one from this package:

This will extend the Translator and will create a new database entry, whenever a key is not found, so you have to visit the pages that use them. This way it shows up in the webinterface and can be edited and later exported. You shouldn't use this in production, just in production to translate your views, then just switch back.

Live editing

When you have translations in database, you can use transEditable method instead of trans whenever it's suitable. To do this, you have to make few steps:

Update config/app.php by adding an entry for the service provider (another one):

Add these two methods to app\helpers.php file.

In your layout view add this scripts and style (see Layout customization section):

If you want to change all links into non-links, add this little script:

Last step is to add this JS file:

And now you are able to use transEditable helper and when live editing is active (checked through isLiveTranslationEnabled), user is able to click on text, popup will show and text can be changed. Saving changes will cause saving to the database and exporting this text to translation file. If live editing is not active, user will see standard text.

You can use this helper like this:

Do not use this inside of non-clickable elements (title attribute, alt attributes etc.). To launch popup inside link, click on border, not text.

Changelog

1.3.0

1.2.0

1.1.0

1.0.0

0.6.0

0.5.1

0.5.0

0.4.7

0.4.5

0.4.4

0.4.3

0.4.0

0.3.7

0.3.6

0.3.0

0.2.0

Roadmap

Credits

This package was originally created by Barry vd. Heuvel and is available here: laravel-feed.

Currently is developed by HighSolutions, software house from Poland in love in Laravel.


All versions of laravel-translation-manager with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0|>=8.0.2
illuminate/console Version 5.*|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
illuminate/support Version 5.*|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
symfony/finder Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package highsolutions/laravel-translation-manager contains the following files

Loading the files please wait ....