elcodi/entity-translator
Elcodi Entity Translator is a Symfony/PHP component for translating entity fields in e-commerce applications, part of the Elcodi suite. This read-only package is MIT licensed; use the main elcodi/elcodi repository for issues and contributions.
Treat this as a legacy, low-level translation helper, not a full i18n framework. The first decision is whether you are already inside an Elcodi/Symfony 2.x codebase. If not, do not start here.
dev-master for anything production-facing.src/Elcodi/Component/EntityTranslator/ and inspect:
elcodi/elcodi, use the version already wired there instead of mixing standalone component versions.// Verify exact signatures against the installed version.
$entityTranslator->save($product, $locale, [
'name' => 'Produit',
'description' => 'Description en français',
]);
$entityTranslator->translate($product, $locale);
If that works, wire it into one admin edit screen and one storefront read path before expanding to other entities.
translations[locale][field]. In the controller, normalize and save only the fields you allow:
$translations = $request->request->get('translations', []);
$entityTranslator->save($product, $locale, array_intersect_key($translations, array_flip([
'name',
'description',
'slug',
])));
en_US, fr_FR) or a Language entity. Keep the admin form, request locale, and stored translation locale identical; mismatches are a common source of “missing” translations.elcodi/elcodi repository for issues/PRs. For a real legacy deployment, consider forking or using Composer patches.translator expectations or Symfony’s translation catalogue.doctrine:mapping:info and run schema migrations before debugging application code.translate() writes translated values onto the entity, any later flush() can overwrite the original locale values. Use a detached clone, DTO, or read-only translation step.fr vs fr_FR will create duplicate or invisible translation rows.How can I help you explore Laravel packages today?