2lenet/crudit-translation-provider

Symfony Translation Provider backed by crudit-studio (crudit:// DSN).

Maintainers

Package info

github.com/2lenet/CruditTranslationProvider

Type:symfony-bundle

pkg:composer/2lenet/crudit-translation-provider

Transparency log

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-07-17 08:13 UTC

This package is auto-updated.

Last update: 2026-07-17 12:34:00 UTC


README

PHPStan status PHPUnit status PHPCS status

Symfony Translation Provider backed by crudit-studio: your project's translations are centrally managed in crudit-studio, and synchronized with the standard translation:pull / translation:push commands — exactly like the official Loco, Crowdin or Lokalise providers, through a crudit:// DSN.

Installation

composer require 2lenet/crudit-translation-provider

If your app doesn't use Symfony Flex, register the bundle in config/bundles.php:

Lle\CruditTranslationProvider\LleCruditTranslationProviderBundle::class => ['all' => true],

Configuration

Declare the provider in config/packages/translation.yaml:

framework:
    translator:
        providers:
            crudit:
                dsn: '%env(CRUDIT_TRANSLATION_DSN)%'
                domains: []   # empty = all domains
                locales: []   # empty = your app's enabled_locales

And set the DSN in your .env.local:

CRUDIT_TRANSLATION_DSN=crudit://PROJECT_CODE:TOKEN@crudit-studio.example.com
  • PROJECT_CODE — your project's code in crudit-studio,
  • TOKEN — the project's API token,
  • host (and optional port) of your crudit-studio instance, reached over HTTPS.

For a local crudit-studio over plain HTTP, add ?scheme=http:

CRUDIT_TRANSLATION_DSN=crudit://PROJECT_CODE:TOKEN@localhost:8328?scheme=http

Usage

# Send local translations to crudit-studio.
# crudit-studio NEVER overwrites a key it already knows (it may have been edited
# by a translator through its UI), so pushing is always safe.
bin/console translation:push crudit

# Fetch translations from crudit-studio into your local files
bin/console translation:pull crudit --force

Initial migration

There is no dedicated init command: the very first translation:push crudit against an empty crudit-studio project uploads your whole local catalogue (every key, locale and domain) and becomes the starting point managed in crudit-studio.

Translation file formats

The provider itself never reads or writes files — it exchanges message catalogues with the standard Symfony commands, which handle the local files:

  • translation:push loads your local files through Symfony's registered loaders, so every format supported by the Translation component works out of the box: YAML, XLIFF, JSON, PHP, CSV, INI, gettext (.po/.mo), Qt XML (.ts), ResourceBundle...
  • translation:pull writes local files in the format you ask for with --format (XLIFF 1.2 by default):
bin/console translation:pull crudit --force --format=yaml

Not supported

translation:push --delete-missing (the provider delete() operation) is not supported yet: for now, crudit-studio is the authority and keys are removed through its UI. We are looking into supporting this option in the near future.

Development

composer install
vendor/bin/phpunit
vendor/bin/phpcs
vendor/bin/phpstan analyse