Download the PHP package tobento/app-translation without Composer

On this page you can find all versions of the php package tobento/app-translation. 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 app-translation

App Translation

Integrates the service-translation package into your application and provides tools for scanning, managing, and customizing translation messages.

Table of Contents

Getting Started

Add the latest version of the app translation project running this command.

Requirements

Documentation

App

Check out the App Skeleton if you are using the skeleton.

You may also check out the App to learn more about the app in general.

Translation Boot

The translation boot does the following:

By default, Files Resources are used for the translator.

Translate Message

You can translate messages in several ways:

Using the app

Using autowiring

You can also request the in any class resolved by the app.

Using the translation boot

Check out the Translation Service to learn more about it.

Using the trans function

Configure Translator

Configure Locales

Configure locale using the app language

First install the app-language bundle:

Then, just boot the . That's all. The locales will be set based on the .

Configure locale manually

Configure Missing Translation Handler

If you may want to log missing translation, you can set the implementation to fit your needs.

You can find more handlers in the Missing Translation Handler section of the Translation Service.

Managing Translations

Migrate Translations

By default, Files Resources are used for the translator. Therefore, you might install and use the App Migration bundle:

Writing a migration

Migration Boot

App example

Add Translations

You can simply add more translations by the following way:

You may check out the Add Resources section to learn more about it.

Customize Translations

Customizing translations allows you to override existing messages or provide alternative translations without modifying the original translation files. Tobento’s translation system is fully resource-driven and priority-based, so you can extend or replace translations using resources, directories, or external tools such as the Translation Web App.

Using Resources

Resources let you override or extend translations programmatically.
By adding a resource with a higher priority, your custom translations take precedence over the default ones.
You only need to specify the translations you want to override - resources with the same name are automatically merged.

You may check out the Add Resources section to learn more about how resources work in the underlying Translation Service.

Example

Using Directory

You can also customize translations by adding a new translation directory with a higher priority.
Any translation file placed in this directory overrides the corresponding file in the default trans directory.
If a file does not exist in your custom directory, the default file is used automatically.

This approach is ideal when you want to override entire translation files or maintain custom translations separately from the application's default ones.

Example

Using Translation Web App

For a more convenient workflow, you can manage, override, and publish translations using the App Translation Web package.
It provides a full browser-based interface for editing, organizing, importing, exporting, and onboarding translations across one or multiple apps.

Check out App Translation Web for more details.

Scanning Messages

The translation system includes a message scanner that can automatically detect translation messages in your source code.
This is useful when creating a new app, customizing existing features, or adding new translation messages during development.
It helps you keep your translation resources aligned with the messages used in your application code.

The scanner analyzes your project using configurable patterns, allowing you to adapt it to different coding styles or message formats.

Message Scanner

The Message Scanner is responsible for locating translation messages throughout your application.
It supports multiple patterns and flexible configuration so you can tailor the scanning process to your project structure.

Default Output Path and Directory

By default, the Translation Boot registers the MessageScannerInterface with:

This ensures the scanner works out-of-the-box without requiring any command-line options.

The file collected-messages.json is created in your project root directory and is used when running the scanner with the --output option.

If you want to change where scanned messages are stored see next section.

Customizing Scanner

When the scanner is executed, a default scanner instance is provided by the Translation Boot.
It uses the default patterns and directories defined in the boot configuration.

You may customize the scanner by modifying the MessageScannerInterface implementation.
This allows you to add or override patterns, adjust directories, or extend the scanning behavior to match your application's needs.

Available Methods

All with* methods are immutable, returning a new scanner instance.

Default Patterns

The default scanner provides a set of default patterns that detect common translation usages.
These patterns cover typical message calls and are suitable for most applications.

The following patterns are added:

Run Scanner

The message scanner can be executed through the console using the Scan Messages Command.
See the Scan Messages Command for details on how to run it and how to configure directories, output formats, and storage behavior.

Console

List Translations Command

If you have installed the App Console, you may list all available translations using the translations:list command.
This is useful for inspecting which messages exist for each locale and verifying that your translation resources are loaded correctly.

List all translations

Available Options

Option Description
--locale=code Filters translations by the specified locale.

Resources Command

You may inspect all registered translation resources using the translations:resources command.
This helps you understand which resources are loaded, their priority, and how they contribute to the final translation set.

List all translation resources

Available Options

Option Description
--locale=code Filters resources by the specified locale.

Scan Messages Command

You may scan your source code for translation messages using the translations:scan command.
This is useful when creating a new app, customizing existing functionality, or adding new translation messages during development.

Scan messages using the default scanner configuration

Available Options

Option Description
--dir=path Directory to scan (defaults to scanner configuration).
--table Outputs the results as a formatted table instead of JSON.
--output Stores the JSON output using the scanner's configured output path.

Credits


All versions of app-translation with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
tobento/app Version ^2.0
tobento/service-translation Version ^2.0
tobento/service-filesystem Version ^2.0
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 tobento/app-translation contains the following files

Loading the files please wait ...