elcodi/language-bundle
Language Bundle is part of the Elcodi e-commerce suite for Symfony, providing language and locale management for multilingual stores. Read-only package; use the main elcodi/elcodi repo for issues and pull requests.
composer require elcodi/language-bundle. Because the project is archived and last released in February 2016, pin an explicit constraint (e.g. the last stable tag) rather than relying on dev-master.// app/AppKernel.php
$bundles = [
// ...
new Elcodi\Bundle\LanguageBundle\ElcodiLanguageBundle(),
];
No routing import is normally needed — this bundle is primarily Doctrine mappings, entities, factories, repositories, and services, not HTTP endpoints.DependencyInjection/Configuration.php — the config tree and defaults for the bundle.Resources/config/services.yml (and any doctrine/*.yml) — the actual service IDs and entity mappings.elcodi/language — the Language entity, its factory, and repository interface live there, not in the bundle.bin/console debug:container | grep -i language
bin/console debug:container --tag=doctrine.repository_service | grep -i language
(app/console on Symfony 2.x.)$languages = $this->get('elcodi.repository.language')
->findBy(['enabled' => true]);
Confirm the exact ID with debug:container; Elcodi convention is elcodi.repository.language, elcodi.factory.language, and a manager service, but verify against services.yml.enabled, and pass a plain array to the template. Cache the result if it is requested on every page; language lists change rarely.Language, set ISO code and name, then persist via the manager/repository rather than constructing the entity with new. This keeps you compatible with the component's invariants and any future entity overrides.$request->setLocale(...). Do not expect the bundle to set the Symfony locale for you — it models the domain object, not the request lifecycle.Language ISO code to a Symfony locale string in your own service. This is where a thin adapter pays off if ISO codes and locale strings diverge (e.g. en vs en_US).resolve_target_entities convention is used in the component's configuration, override the concrete Language class in config.yml and have your class extend the base entity. This is the cleanest extension point and avoids editing vendor code.elcodi/elcodi package. Treat any bug you find as yours to patch locally or fork.dev-master as "last commit" — that is exactly what you do not want in production. Always pin a tagged version or a commit hash.Language vs Locale confusion. The entity represents a selectable catalog/UI language. Symfony's locale is a formatting concern. Conflating them causes subtle bugs (number/date formatting changing when a user switches UI language).enabled filter. The repository will happily return disabled languages; filter explicitly everywhere you render a selector or validate a submitted code.bin/console cache:clear) and, if needed, regenerate proxies. Mapping problems show up as "class not found" or missing-table errors at runtime, not at container compile time.Configuration.php before writing YAML — undocumented defaults and required nodes are common in this generation of bundles. A wrong config key can be silently ignored or throw an opaque InvalidConfigurationException.debug:container --show-private and debug:container <id> are more useful than the stale docs.How can I help you explore Laravel packages today?