atico/spreadsheet-translator-symfony-bundle
Architecture Fit:
symfony/translation), enabling direct use of generated files (e.g., demo_common.en_GB.xliff) via Symfony’s Translator service. For Laravel, this would require manual integration (see Integration Approach).Integration Feasibility:
config/packages/ and bundles.php require rewrites (e.g., using Laravel’s config/spreadsheet-translator.php and service container bindings).provider-localfile, reader-matrix, exporter-xliff) add ~10–15MB to vendor/. Justify with team productivity gains (e.g., translators editing Google Sheets in real-time).Technical Risk:
Translation component expects specific file structures (e.g., translations/messages.en.yml). Laravel’s lang/ directory and trans() helper may need custom loader classes.SpreadsheetTranslationLoader) to parse exported files dynamically.config/services.php or environment variables). Misconfiguration could expose tokens.Key Questions:
php artisan translate:load).Stack Fit:
SpreadsheetTranslatorManager) to the container.
// app/Providers/SpreadsheetTranslatorServiceProvider.php
public function register()
{
$this->app->singleton('spreadsheet.translator', function ($app) {
return new SpreadsheetTranslator(
new LocalFileProvider($app['config']['spreadsheet.source']),
new MatrixReader(),
new XliffExporter($app['config']['spreadsheet.output'])
);
});
}
// app/Console/Commands/ExportTranslations.php
public function handle()
{
$translator = app('spreadsheet.translator');
$translator->export();
}
FileLoader to load exported files:
// app/Providers/AppServiceProvider.php
public function boot()
{
$loader = new SpreadsheetTranslationLoader();
$loader->addPath(base_path('translations'));
$this->app['translator']->addLoader('spreadsheet', $loader);
}
| Feature | Symfony Implementation | Laravel Adaptation |
|---|---|---|
| Configuration | config/packages/atico_*.yaml |
config/spreadsheet-translator.php |
| Dependency Injection | Autowiring via services.yaml |
Laravel’s IoC container |
| Translation Loading | Symfony’s Translation component |
Laravel’s trans() helper + custom loader |
| Event System | Symfony Events | Laravel Events or Observers |
Migration Path:
lang/ directory.trans() helper can read exported files.php artisan spreadsheet:export).Compatibility:
symfony/translation package for parsing.FileLoader.google/cloud or microsoft/graph SDKs to handle OAuth.Sequencing:
provider-localfile (mandatory) + desired readers/exporters.composer require samuelvi/spreadsheet-translator-provider-localfile
composer require samuelvi/spreadsheet-translator-exporter-php
spreadsheet-translator.php to config/ with provider/reader/exporter settings.return [
'source' => base_path('storage/app/translations.xlsx'),
'output' => [
'format' => 'php',
'prefix' => 'app_',
'domain' => 'messages',
'path' => base_path('lang'),
],
'locales' => ['en', 'es', 'fr'],
];
// app/Services/SpreadsheetTranslator.php
public function export()
{
$provider = new LocalFileProvider(config('spreadsheet-translator.source'));
$reader = new MatrixReader();
$exporter = new PhpExporter(config('spreadsheet-translator.output'));
$translator = new SpreadsheetTranslator($provider, $reader, $exporter);
return $translator->export();
}
composer.jsonHow can I help you explore Laravel packages today?