Download the PHP package tobento/app-translation-web without Composer

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

App Translation Web

The App Translation Web package provides a complete web interface for managing, editing, onboarding, and publishing application translations.
It builds on top of tobento-ch/app-translation and integrates seamlessly with tobento-ch/apps, enabling you to manage translations across multiple apps from a single, unified UI.

This package is especially useful when:

Zero-Config Bootstrapping

The package works out-of-the-box with sensible defaults.

Simply register the Translation Web Boot in your application, and the full translation management UI becomes available immediately - no additional configuration required.

You only need to customize configuration if you want to override defaults such as publishing strategies, machine translation providers, permissions, or import/export behavior.
For multi-app setups, make sure all apps use the same translation repository connection (e.g., a shared database or shared storage). Once they share the same repository, the Translation Web UI can manage all apps centrally.

Table of Contents

Getting Started

Install the latest version of the App Translation Web package by running:

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 Web Boot

The TranslationWeb boot performs the following tasks:

[!WARNING]

The TranslationWeb boot must be registered before the Translation boot.

This ensures that the translation-web configuration, interfaces, and publishing strategy are properly initialized before the core translation system loads.

If the order is reversed, publishing strategies may not be applied correctly.

You may also install the App Backend and boot the translation web within the backend application.

Translation Web Config

The configuration for the translation web is located in the app/config/translation-web.php file at the default App Skeleton config location.
There you can configure the available features and other options.

Translation Workflow

A typical translation workflow using the Translation Web follows these steps:

  1. Developer sets up the application and installs app-translation-web
    After installation, the developer prepares the translation environment.
    At this stage, no machine translation is performed.
    See: Translation Web Boot

  2. Collect translation messages/keys (initial setup)
    The developer collects translation keys either:

    • via the Collect Translations Command
    • through the UI using Collect Bulk Action

    This step scans the application source code and creates or updates translation messages/keys.
    Machine translation is not used during collection.
    Related: All Translations Collector

  3. Auto-translate missing or empty translations (optional)
    After translation records exist, the developer or translator can use the Auto Translate bulk action to fill:

    • missing translations
    • empty translations

    This step uses the configured machine translator and is safe by design:

    • no overwrites of user-edited values
    • no messages/key creation
    • only fills empty or missing entries

    Users can choose whether to auto-translate:

    • only selected rows
    • or all filtered rows

    See:

    • Auto Translate Bulk Action
    • Machine Translation Feature
    • Auto Translate Missing Translations
  4. Manual editing and refinement (optional)
    Translators can manually adjust or override translation values at any time.
    The UI supports two editing modes:

    • inline table editing for quick adjustments
    • full edit view for detailed editing of a single translation entry

    Manual edits always take precedence and are never overwritten by automated actions.
    See: Translations Feature

  5. Export / Import translations (optional)
    Users can export translations in any supported format (e.g., CSV, XLSX, JSON) using the Export bulk action.
    This is useful for:

    • offline translation work
    • sending untranslated entries to external translators
    • bulk editing in spreadsheet tools
    • reviewing translation completeness

    After editing externally, translations can be re-imported using the Import bulk action.
    Importing updates only the provided entries and respects all safety rules (no message/key creation unless explicitly allowed).
    See:

    • Export Bulk Action
    • Import Bulk Action
  6. Publish translations
    Once translations are ready, the Edit Status bulk action can mark the selected entries as published.
    Setting the status field to published triggers the configured publishing strategy, which handles the actual output, such as:

    • generating JSON files
    • updating in-memory resources
    • or applying any other custom publishing strategy

    Users can choose which rows to publish using the selection mode:

    • Selected Rows - only the manually selected rows will be published
    • All Filtered Rows - all rows matching the current filters will be published

    Publishing does not modify translation values.
    It only updates the status field and lets the publishing strategy output the translations accordingly.
    See:

    • Edit Status Bulk Action
    • Publishing Strategies
  7. Add a new locale using the Bulk Create action (optional)
    When introducing a new locale, the Bulk Create for Locale action can be used to initialize translation entries for all existing messages/keys.
    Users can choose to:

    • create empty entries for manual translation
    • automatically pre-fill entries using the machine translator
    • combine both approaches

    This step is typically used when expanding the application to support additional languages.
    See:

This workflow provides a structured and predictable process for managing translations from initial key collection to final publishing.

Features

Translations Feature

The Translations feature provides a management page for viewing, editing, creating, and publishing translations across all configured apps and locales. It is the central interface for working with translation entries collected by the translation system.

This feature offers:

The feature integrates with the configured publishing strategy, ensuring that changes are written to JSON files, in‑memory resources, or any other supported output.

Config

In the translation-web config you can enable and configure this feature:

ACL Permissions

The Translations feature defines the following ACL permissions:

If you are using the App Backend, you can assign these permissions to roles or users in the backend interface.

Collect Bulk Action

The Collect Bulk Action scans the application for translation messages (keys) using one or more registered collectors.
It is used to keep the translation repository in sync with the actual messages found in the codebase.

When triggered, the action:

Once the background job finishes, the user is notified via a Browser message.
See Browser notification for Background jobs for additional details.

This allows large-scale collection operations to run asynchronously without blocking the UI, while still keeping the user informed when the process completes.

Queueing

The job is dispatched to the queue with:

You may install app-job to monitor and manage queued jobs via a web interface.

Registration

This bulk action is already registered:

Create For Locale Bulk Action

The Create For Locale Bulk Action creates missing translation entries for a selected locale and app based on existing translation messages (keys).
It ensures that every message has a corresponding translation entry for the chosen locale, without overwriting any existing translations.

When triggered, the action:

This allows onboarding a new locale or app efficiently without blocking the UI.

Once the background job finishes, the user is notified via a Browser message.
See Browser Notification for Background Jobs for additional details.

Locales

Locales displayed in the UI are taken from your application's language configuration.
If you want to onboard a new locale, add it in the app-language config
or install app-language-web to create new locales via the web interface.

Auto Translate

If the user has the translations.auto-translate permission and auto-translation is supported by the onboarding service, the action can automatically translate missing entries using machine translation.
If the permission is missing, the option is ignored.

Publish

If the user has the translations.publish permission, the created entries may be marked as published.
If the permission is missing, the option is ignored.

Queueing

The job is dispatched to the queue with:

You may install app-job to monitor and manage queued jobs via a web interface.

Registration

This bulk action is already registered:

Auto Translate Bulk Action

The Auto Translate Bulk Action automatically fills missing or empty translation values for the selected or filtered records using the configured machine translator.
It never overwrites existing translations and does not create new translation entries.

When triggered, the action:

This allows large sets of translations to be auto-translated safely and efficiently without blocking the UI.

Once the background job finishes, the user is notified via a
Browser message.
See Browser Notification for Background Jobs for additional details.

Selection Modes

The action supports two selection modes:

This makes it possible to translate either a small subset or an entire filtered dataset.

Auto Translate

Auto-translation is only performed if:

If either condition is not met, the action is not available in the UI.

Auto-translation:

Queueing

The job is dispatched to the queue with:

You may install app-job to monitor and manage queued jobs via a web interface.

Registration

This bulk action is already registered:

Edit Status Bulk Action

The Edit Status Bulk Action allows users to update the status field of the selected or filtered translation entries.
This provides a flexible workflow for marking translations as draft, published, pending review, or imported.

The action uses the standard Bulk Edit Action
provided by app-crud and does not require a custom implementation.

When triggered, the action:

Only users with the translations.publish permission can set the status to published.
Users without this permission may edit translations in draft or review status, but cannot publish entries.

Registration

This bulk action is already registered:

Available Status Values

The status field supports the following workflow states:

Delete Bulk Action

The Delete Bulk Action allows users to remove translation entries for the selected or filtered records.
This action permanently deletes the chosen entries from the translation repository.

When triggered, the action:

This provides a fast and efficient way to clean up unused, obsolete, or incorrectly created translation entries.

Selection Modes

The action supports two selection modes:

This allows users to delete either a small subset or an entire filtered dataset.

Permissions

Deletion is only available if the user has the translations.delete permission.
If the permission is missing, the action is not shown in the UI.

Important Notes

Registration

The action is registered using the built‑in Delete Bulk Action:

Export Bulk Action

The Export Bulk Action allows users to export selected or filtered translation records into a downloadable file.
It is powered by the app-import-export package and integrates directly into the Translations CRUD interface.

When triggered, the action:

The action is registered in the TranslationCrudController as follows:

Permissions

The export option is only available when the user has the translations.export permission.

Documentation

For more details, see the official documentation:
https://github.com/tobento-ch/app-import-export#export-bulk-action

Import Bulk Action

The Import Bulk Action allows users to import translation records from an external file into the translation repository.
It is powered by the app-import-export package and integrates directly into the Translations CRUD interface.

When triggered, the action:

The action is registered in the TranslationCrudController as follows:

Permissions

The import option is only available when the user has the translations.import permission.

Documentation

For more details, see the official documentation:
https://github.com/tobento-ch/app-import-export#import-bulk-action

Translations Console Commands Feature

The Translations Console Commands feature provides console commands for managing translations from the command line.
These commands are essential when translation files are modified manually, when new locales or apps are added, or when translations need to be regenerated during deployment or CI workflows.

This feature offers the following commands:

For detailed usage and options, see the Console section.

Config

In the translation-web config you can enable and configure this feature:

When Managing Translations Across Multiple Apps, you may disable this feature for apps that only consume translations. Only the app responsible for generating, collecting, or publishing translations needs to have the console commands enabled.

Machine Translation Feature

The Machine Translation feature enables automatic translation of missing or existing translation entries.
It integrates with the Translations Feature and can be used in several places:

This feature is optional and becomes active only when a machine translation service is configured and available.

Config

Enable and configure the feature in the translation-web config:

When enabled, the system automatically detects whether a real machine translator is available (not the NullTranslator).
If no translator is configured, the feature remains inactive and UI options for auto-translation will not be shown.

Onboarding Integration

The Machine Translation feature uses the Machine Translator configured in the onboarding service.

For details on how machine translation is integrated into onboarding, including the onboarding factory configuration, see the Onboarding Service section.

The onboarding service exposes a supportsAutoTranslate() method, which ensures that auto-translation is only available when a real translator is configured.

Machine Translator Configuration

Make sure you have configured the machine translator named translations in the Machine Translator Config.

It is recommended to use the NonTranslatableStrategy\Placeholder() strategy to preserve placeholders and variables during translation:

Collectors

Collectors gather translation messages from different sources within your application and make them available to the translation repository.
They can also be managed directly within the Translations Feature in the web interface.

Collectors are configured in the translation-web config file, where you may enable or disable them as needed.

Once configured, you can run only selected collectors using the translations:collect command, or trigger collection directly through the Translations Feature in the web interface.

All Translations Collector

This collector gathers all translation messages from the resources configured by App Translation, which sets up the service-translation Translator.
It extracts messages from every translation resource registered with the Translator, making it the most complete collector.

Config

In the translation-web config you can enable and configure this collector.
You may define as many collectors as needed, each with its own settings:

Notes on collectOnly and collectExcept

Resource names come from the underlying service-translation - Translator resources.

You can inspect all available resources in your app using:

This makes it easy to determine which resource names to include or exclude when configuring collectors.

Example using collectOnly:

This configuration collects:

allowing fine-grained control over which translation sources are included.

Publishing Strategies

Publishing strategies define how and where translations are written when they are published from the web interface or through console commands.
Each app can choose the strategy that best fits its needs, whether writing translation files to disk, keeping them only in memory, or disabling publishing entirely.

Strategies are configured in the translation-web config file, and you may define different strategies per app.
The selected strategy determines how collected or edited translations are exported and made available to your application.

File Resources Strategy

The FileResources strategy publishes translations as JSON files on disk.
It does this by registering a dedicated translation directory for the app and then dispatching a queue job that generates all translation files asynchronously.

Translations are loaded on demand from the filesystem, which can be faster than loading all translations into memory upfront - especially in larger applications.

How it works internally

publish(AppInterface $app)

schedulePublish(AppInterface $app)

This ensures that file generation happens asynchronously and never blocks the UI.

Automatic Regeneration via Queue

When translations are modified through the Translations Feature in the web interface, the system automatically dispatches a queue job that regenerates the JSON files for all apps using the FileResources strategy.
This ensures that published translation files stay in sync with the latest changes without blocking the UI.

Config

Enable the FileResources strategy in the translation-web config:

You may also configure the strategy manually if you need to customize its behavior:

In Memory Resources Strategy

The InMemoryResources strategy publishes translations by attaching a lazy-loading Resources instance directly to the Translator.
No files are written to disk, and no queue jobs are dispatched.

Instead, translations are loaded on demand from the TranslationRepository whenever the Translator requests a locale.
This makes the strategy ideal for environments where:

Because translations are loaded only when needed, the strategy avoids loading all translations upfront. It also mirrors the behavior of file-based resources by merging any additional resource sources registered with the Translator.

How it works internally

publish(AppInterface $app)

Lazy loading behavior

schedulePublish(AppInterface $app)

Config

Enable the InMemoryResources strategy in the translation-web config:

Null Strategy

The NullStrategy is a no-operation translation publish strategy.
It performs no actions when translations are published or scheduled for publishing.

This strategy is useful when:

Because the strategy does nothing, it introduces no overhead and no side effects.

How it works internally

publish(AppInterface $app)

schedulePublish(AppInterface $app)

This strategy effectively disables the publishing pipeline for the app.

Config

Enable the NullStrategy in the translation-web config:

Handle Missing Translations

The Missing Translation Handler mechanism allows your application to react whenever a translation is not found at runtime.

By default, the translation system returns the original message or key passed to trans().
If you want to log missing translations, collect them during development, or trigger automated translation workflows, you can register your own handler.

Handlers are resolved through the container and executed whenever a translation for the requested locale does not exist.

Config

In the translation-web config, you can bind your preferred handler implementation to the interface:

Available Handlers

Auto Translate Missing Translations

The MissingHandler\AutoTranslate::class handler automatically translates missing messages using the tobento/app-machine-translator package.
When a translation is not found, the handler queues a job that translates the message and stores it in the translation repository.

Requirements

Make sure the following boots are booted:

When using the Translations Feature, all of these boots are already booted automatically.

Example

The example above shows how to inject a custom translator.
Using the null translator is useful when you want missing translations to be stored but not automatically translated.

Log Missing Translations

The MissingHandler\Log::class handler will log missing translations for debugging or monitoring.

Requirements

Make sure the App Logging Boot is booted so the handler can write log entries.

Consider installing app-logging-web to browse and inspect log entries through a web interface.

Example

You may configure which logger should be used in your file.
If no alias is defined, the default logger will be used:

Chain Multiple Handlers

The Chain::class handler from service-translation allows you to combine multiple missing-translation handlers and execute them in sequence.
This is useful when you want to perform several actions for the same missing translation.

Example

Onboarding Service

The Onboarding Service provides a high-level API for initializing and preparing translations when introducing a new locale or when synchronizing translation data across apps. It automates the most common onboarding tasks such as creating translation entries, auto-translating missing values, and publishing the results.

This service is especially useful when:

Features

The Onboarding Service supports the following operations:

Configuration

The OnboardingInterface is bound in the container with a factory that wires the translation repository and (optionally) a machine translator.
If a machine translator named translations is available, it will be used for auto-translation, otherwise auto-translation is disabled.

Auto‑translation in onboarding requires a machine translator named translations.
For configuring the machine translator itself, see the Machine Translation Feature section.

Onboarding Interface

The onboarding functionality is provided through the OnboardingInterface, which exposes a set of dedicated methods for preparing and managing translations for a given locale and app. These methods cover the full onboarding workflow-from creating missing entries to auto-translating and publishing them, as well as a flexible query-based auto-translation method used by bulk actions.

Create missing translation entries

Creates translation entries for all messages/keys that do not yet exist for the given locale.
Existing or user-edited translations are never overwritten.

Check if auto-translation is supported

Determines whether a machine translator is available and configured.

You can also retrieve the actual translator instance (or null if none is configured):

Auto-translate missing entries

Automatically fills empty or missing translations using the configured machine translator. Existing translations are never overwritten.

Publish translations

Marks translations as published for the given locale and app. This updates the published status but does not generate or write any files.

Advanced Auto-Translation (Query-Based)

In addition to the locale-based onboarding workflow, the OnboardingInterface also provides a flexible, query-based auto-translation method. This is primarily used by bulk actions to translate arbitrary sets of translation entries.

Auto-translate entries by query

Automatically translates translation entries matching the given query parameters.
Unlike autoTranslateEntries(), this method is not restricted to a single locale or app and does not assume any onboarding workflow.

The default onboarding implementation supports the standard where parameters used by the Repository Storage package, allowing flexible filtering of translation entries.

When to Use the Onboarding Service

Use the Onboarding Service when:

Relation to Bulk Actions

Several bulk actions in the Translation Web internally use the onboarding functionality:

These bulk actions provide a UI-driven workflow, while the OnboardingInterface offers the same capabilities programmatically for automation, CLI scripts, or multi-app workflows.

The onboarding functionality provides a reliable and automated way to prepare translations for new locales, ensuring a smooth transition from initial key creation to fully published translation resources.

Console

Collect Translations Command

Use the following command to collect translations from all configured collectors or only selected ones:

Collect all translations

Available Options

Option Description
--collectorId[] Runs only the collectors matching the given IDs.

Collectors are configured in the translation-web config file.
For more details, see the Collectors section.

Generate JSON Translation Files Command

Use the following command to generate translation files in JSON format for the FileResources strategy:

Generate JSON translation files

Available Options

Option Description
--appId[] Only generate files for the specified app IDs.

The generated files are used by the FileResources strategy to provide JSON-based translation resources.

JSON files are generated only for apps where the File Resources Strategy is enabled.
If the app does not use the File Resources Strategy, or required services are missing, no files will be generated.

Learn More

Manage Translations Across Multiple Apps

When working with multiple Apps, you may want to manage or publish translations across all of them from a single web interface.
To achieve this, ensure that each app uses the same translation repository connection in its config file.

Example: App with Full Translation Management

In an app that manages translations (e.g., an admin or backend app), you typically enable both the web interface and the console commands.
For example, in an app using the App Backend, you might configure:

Example: Another App That Only Uses or Publishes Translations

In another app where you only want to use or publish translations (but not manage them):

Shared Storage Configuration

Finally, in the database config file of both apps, configure the shared:storage database:

By using a shared storage connection, all translations from every app are stored in the same repository, allowing them to be viewed, edited, and published centrally through the Translations Feature web interface.

Browser Notification for Background Jobs

The following actions perform background jobs:

These actions run asynchronously in the queue and notify the user once they have finished by using the Browser Channel.

To receive browser notifications, the user must have the notifications.browser ACL permission.
All other functionality is already set up and works out of the box.

You may set the permission manually (see ACL Service), or, if you are using the App Backend, you can assign this permission directly on the Roles or Users page.

Credits


All versions of app-translation-web with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
tobento/app Version ^2.0
tobento/app-cache Version ^2.0
tobento/app-card Version ^2.0
tobento/app-crud Version ^2.0
tobento/app-http Version ^2.0
tobento/app-import-export Version ^2.0
tobento/app-machine-translator Version ^2.0
tobento/app-migration Version ^2.0
tobento/app-notifier Version ^2.0
tobento/app-language Version ^2.0
tobento/app-logging Version ^2.0
tobento/app-queue Version ^2.0
tobento/app-translation Version ^2.0
tobento/app-user Version ^2.0
tobento/app-view Version ^2.0
tobento/apps Version ^2.0
tobento/service-collection Version ^2.0
tobento/service-file-creator Version ^2.0
tobento/service-iterable Version ^2.0
tobento/service-repository Version ^2.0
tobento/service-repository-storage 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-web contains the following files

Loading the files please wait ...