Download the PHP package khalyomede/laravel-translate without Composer

On this page you can find all versions of the php package khalyomede/laravel-translate. 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-translate

Laravel Translate

Translate missing keys in JSON file, CI friendly.

Summary

About

I have a web app and I always find myself pushing code where I added a new translation key that I forgot to translate in other of my supported languages. I also often forget to add my "static" model field that I should translate (which are most of the time linked to reference tables).

I create this package to help me find out which keys I missed to translate before pushing and deploying in production. I use it on my CI as well in case I forget to run the check locally.

Features

Prerequisites

This package assumes you heavily rely on JSON files instead of PHP files to store your translations. It will pull all non short-keys translations (like validation.required, home.headline, ...) and put them in your "lang/[lang].json` file.

I also advice to use plain English as your translation key, for various reasons:

Installation

Install the package:

Publish the configuration file:

Examples

1. Check for missing translations

Call the command using --dry-run to only check for missing keys without writing the missing keys.

You can add more langs by editing the config/translate.php file.

2. Add missing translations

Call the command without flags to actually write the missing keys.

You can add more langs by editing the config/translate.php file.

3. Customize which folders to parse

By default, the folders "app" and "resources/views" are the only that are parsed. If you need to add more, just change the folders in the config file at "config/translate.php".

This will instruct the command to find every files ending with .php or .blade.php in the folders (by searching recursively).

4. Remove translation keys not found

If you are sure all the keys are "findable" by the command in your code, you can enable a configuration to automatically remove keys that are not found. Head to the configuration file at "config/translate.php".

5. Translate models data

When you use any translation function to display the translated text of a model column, and this model appears to be a statically seeded table that will not be changed otherwise, you might want to pull all texts from the desired column to be translated.

Using translate.models config key, you can do it. Head to "config/translate.php":

If you have multiple columns for the same model, you can also pass an array:

You pass it the name of the model as key, and the name of the column to pull translation from as the value.

This assumes you translate your model like this for example:

6. Add raw array of keys

When you have something translation keys not in an Eloquent model nor a hard-coded string like @lang("Hello world"), but you still want to include it in the list of translation keys, you can build a custom array or Collection to give to the command.

Add it like this in your "config/translate.php" file:

You can also return a Collection if you prefer:

You can have more than one translatable:

7. Ignore keys

If you notice something not working as you expect, you can always ignore some keys until you figure out a workaround.

Head to your config file at "config/translate.php":

Tests

or


All versions of laravel-translate with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2.0
stillat/blade-parser Version 1.*
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 khalyomede/laravel-translate contains the following files

Loading the files please wait ....