{"id":18997634,"url":"https://github.com/maschmann/translationloaderbundle","last_synced_at":"2025-10-24T09:37:24.826Z","repository":{"id":12701881,"uuid":"15374322","full_name":"maschmann/TranslationLoaderBundle","owner":"maschmann","description":"Symfony2 bundle with database translation loader","archived":false,"fork":false,"pushed_at":"2020-04-24T06:16:55.000Z","size":324,"stargazers_count":23,"open_issues_count":14,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-27T08:37:24.046Z","etag":null,"topics":["bundle","php","symfony","symfony-bundle"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maschmann.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-22T11:21:29.000Z","updated_at":"2023-10-11T13:19:58.000Z","dependencies_parsed_at":"2022-09-07T09:31:12.925Z","dependency_job_id":null,"html_url":"https://github.com/maschmann/TranslationLoaderBundle","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/maschmann/TranslationLoaderBundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maschmann%2FTranslationLoaderBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maschmann%2FTranslationLoaderBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maschmann%2FTranslationLoaderBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maschmann%2FTranslationLoaderBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maschmann","download_url":"https://codeload.github.com/maschmann/TranslationLoaderBundle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maschmann%2FTranslationLoaderBundle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280776495,"owners_count":26388949,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-24T02:00:06.418Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bundle","php","symfony","symfony-bundle"],"created_at":"2024-11-08T17:42:03.593Z","updated_at":"2025-10-24T09:37:24.791Z","avatar_url":"https://github.com/maschmann.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"TranslationLoaderBundle\n=========\n\n[![Build Status](https://travis-ci.org/maschmann/TranslationLoaderBundle.svg?branch=master)](https://travis-ci.org/maschmann/TranslationLoaderBundle)\n[![Latest Stable Version](https://poser.pugx.org/asm/translation-loader-bundle/v/stable.png)](https://packagist.org/packages/asm/translation-loader-bundle)\n[![Total Downloads](https://poser.pugx.org/asm/translation-loader-bundle/downloads.png)](https://packagist.org/packages/asm/translation-loader-bundle)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/maschmann/TranslationLoaderBundle/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/maschmann/TranslationLoaderBundle/?branch=master)\n[![SensioLabsInsight](https://insight.sensiolabs.com/projects/11ee80ea-d70f-41f6-84e6-31a71411c7e8/mini.png)](https://insight.sensiolabs.com/projects/11ee80ea-d70f-41f6-84e6-31a71411c7e8)\n\n[![knpbundles.com](http://knpbundles.com/maschmann/TranslationLoaderBundle/badge-short)](http://knpbundles.com/maschmann/TranslationLoaderBundle) [![phpci build status](http://phpci.br0ken.de/build-status/image/1)](http://phpci.br0ken.de)\n\nTranslationLoaderBundle allows you to do several cool things with your symfony standard edition translations. It relies mostly on the Translator component and doctrine.\nSo you can...\n  - import all your bundle's translations (if they are in the default path)\n  - export all translations in your preferred format\n  - add translations via commandline\n\nInstallation\n----------\n\n1. Add `asm/translation-loader-bundle` as a dependency of your project:\n\n   ```bash\n   $ composer require asm/translation-loader-bundle \"~1.0\"\n   ```\n\n1. Register the bundle in the kernel:\n\n   ```php\n   // app/AppKernel.php\n   // ...\n\n    public function registerBundles()\n    {\n        $bundles = array(\n            // ...\n            new Asm\\TranslationLoaderBundle\\AsmTranslationLoaderBundle(),\n        );\n\n        return $bundles;\n    }\n   ```\n1. If you want the admin gui, add routing config:\n\n    ```yaml\n    # app/config/routing.yml\n    \n    asm_translation_loader.gui:\n        resource: \"@AsmTranslationLoaderBundle/Resources/config/routing.yml\"\n        prefix:   /translation\n    ```\n\nHow does it work?\n----------\n\nIt's quite simple.\nFor every cache clear you do, the translation dumper is generating a MessageCatalogue in your cache directory from which the application later retrieves all your translations and according fallbacks. So far, so good... We're not changing that but moving the translations from files to a flat database table, so they're (in some cases) easier to change and maintain.\nAfter installing and following the setup steps, your cache MessageCatalogue will be created directly from the database.\n\nGetting started\n----------\n###EntityManager\nYou can tell the bundle to use an EntityManager other than your default manager.\nTherefore you need to add a configuration node to your app/config/config.yml\n```yml\nasm_translation_loader:\n    driver: orm\n    database:\n        entity_manager: \u003cyourmanager_here\u003e # default: null\n```\n\n###History\nIf enabled, the history feature listens on doctrine actions and adds an entry for each change, adding the name of the currently logged-in user.\n\n```yml\nasm_translation_loader:\n    history: true # default false\n```\n\n###Setup the translation table\n```sh\nphp app/console doctrine:schema:update --force\n```\nThis will create the translation table for you, so you can start importing.\n\n###Importing all translations to database\n```sh\nphp app/console asm:translations:import\n```\n__Be careful:__ The import might take a while, since the process checks for each translation if it's already present and then either inserts or updates. I'm open to suggestions here ;-)\nThis command also has a \"-c\" so you can clear the database first. might be a bit faster for larger imports if your table is already filled.\n\n###Generate dummy translation files or using configuration\n```sh\nphp app/console asm:translations:dummy\n```\nSince the TranslationLoader bases on files, you'd have to create empty files like \"messages.en_US.db\" for each language you want to use with your translation database. I have not yet found a nice way around that, so for the time being, you can use the dummy file generator which creates such a file for each message domain/locale you have in your db. The files will be placed in app/Resources/translations/*\nThe other option is configuring the loader for specific locales and message domains:\n```yml\nasm_translation_loader:\n    resources:\n        fr: [ foo, bar ]\n        de: baz\n        en: ~\n    driver: orm\n    history: true # default false\n    database:\n        entity_manager: default\n```\n\n###Delete your old translation files\nAfter checking your translation table, you should delete all translation files from your custom bundle's directories.\nType a short\n```sh\nphp app/console ca:cl\n```\nand check your symfony cache dir for the brand new MessageCatalogue we've now filled from the db :-)\n\n###Funstuff\nIf you're tired of database-translations, don't despair: Just use the file dumper and re-generate your files!\n```sh\nphp app/console help asm:translations:dump\n```\nCheck out your translation files in app/Resources/translations and if you remove all *.db files, your're back on file-mode!\n\n###Testing\nI've not yet completed my test-setup and be glad to get a little contribution here ;-)\n\nContributions\n---------\nGreat thanks got to xabbuh for supporting with refactorings and testing (implementation)!\nAnyone who wants to contribute is greatly welcome!\n\nLicense\n----\n\nAsmTranslationLoaderBundle is licensed under the MIT license. See the [LICENSE](Resources/meta/LICENSE) for the full license text.\n\n\n**Free Software, Hell Yeah!**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaschmann%2Ftranslationloaderbundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaschmann%2Ftranslationloaderbundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaschmann%2Ftranslationloaderbundle/lists"}