{"id":18781548,"url":"https://github.com/devture/symfony-translation-bundle","last_synced_at":"2025-04-13T12:10:51.812Z","repository":{"id":56967223,"uuid":"118627661","full_name":"devture/symfony-translation-bundle","owner":"devture","description":"Symfony bundle that allows .json files to be translated between multiple languages.","archived":false,"fork":false,"pushed_at":"2024-01-10T09:12:15.000Z","size":31,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T03:12:05.882Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devture.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-23T15:16:32.000Z","updated_at":"2023-01-26T09:42:13.000Z","dependencies_parsed_at":"2024-11-07T20:34:54.532Z","dependency_job_id":"825dd736-b87b-4291-8b94-78dbfcf1a39a","html_url":"https://github.com/devture/symfony-translation-bundle","commit_stats":{"total_commits":17,"total_committers":1,"mean_commits":17.0,"dds":0.0,"last_synced_commit":"ead136469231c654fc2149f894aeb212c8b1b331"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devture%2Fsymfony-translation-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devture%2Fsymfony-translation-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devture%2Fsymfony-translation-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devture%2Fsymfony-translation-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devture","download_url":"https://codeload.github.com/devture/symfony-translation-bundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501867,"owners_count":21114683,"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","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":[],"created_at":"2024-11-07T20:32:30.143Z","updated_at":"2025-04-13T12:10:51.788Z","avatar_url":"https://github.com/devture.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Description\n\nWeb UI for managing Symfony bundles' translation files inside the actual web application.\n\nThis is a port of the similarly named [Silex](https://silex.symfony.com/) bundle: [devture/silex-translation-bundle](https://github.com/devture/silex-translation-bundle)\n\nFinds all source language files (example: `messages.en.json`, `another-domain.en.json`) in a given list of base directories and allows these files to be translated to all given languages.\n\nA `{translationDomain}.{targetLanguage}.json` file is generated and saved next to `{translationDomain}{sourceLanguage}.json` for each locale, whenever the translations for it are saved.\n\nA `{translationDomain}{targetLanguage}.hash.json` file is also saved in the same directory.\nIt contains \"hints\" telling the translation system which source translation string a given translation is derived from. This is so that a translation can be considered outdated if the source translation string changes.\nAt this moment, outdated translations are automatically marked as untranslated in the web UI (that is to say, they are not marked as \"already translated, but outdated\", but simply as \"not translated\").\n\n\n# Installation\n\nInstall through composer (`composer require --dev devture/symfony-translation-bundle`).\n\nAdd to `config/bundles.php`:\n\n```php\nDevture\\Bundle\\TranslationBundle\\DevtureTranslationBundle::class =\u003e ['dev' =\u003e true],\n```\n\n## Permissions\n\nSince the translation system needs to save translation files in the project, we need to grant file-writing privileges\nto the web server user.\n\nExample:\n\n```bash\n$ find /srv/http/my-project/src -type d -name translations | xargs chown :http\n$ find /srv/http/my-project/src -type d -name translations | xargs chmod g+w\n```\n\n\n## Configuration\n\nYou most likely want this bundle active only for your development (`dev`) environment.\nThus, you can drop the following routing config in `config/packages/dev/devture_translation.yaml`\n\n```yaml\ndevture_translation:\n    source_language_locale_key: en\n    paths_to_translate:\n        - \"%kernel.project_dir%/src\"\n        - \"%kernel.project_dir%/translations\"\n    locales:\n        - {\"key\": \"en\", \"name\": \"English\"}\n        - {\"key\": \"ja\", \"name\": \"Japanese\"}\n    twig_layout_path: \"base.html.twig\"\n```\n\n`locales` needs to contain all languages that the translation system should be active for (**including** the source language).\n\nMultiple paths can be specified in `paths_to_translate`.\nEach is scanned for files matching the following pattern: `*/translations/\u003csome translation domain\u003e.\u003csource_language_locale_key\u003e.json`.\n\n`twig_layout_path` is the path to your layout file, which would contain the translation system.\nThe only requirement is that it defines a `content` block. The translation system would render within it.\n\nExample layout file:\n\n```twig\n\u003c!doctype html\u003e\n\u003chtml\u003e\n\t\u003cbody\u003e\n\t\t\u003ch1\u003eWebsite\u003c/h1\u003e\n\t\t{% block content %}{% endblock %}\n\t\u003c/body\u003e\n\u003c/html\u003e\n```\n\n\n## Routing example\n\nYou most likely want this bundle active only for your development (`dev`) environment.\nThus, you can drop the following routing config in `config/routes/dev/DevtureTranslationBundle.yaml`:\n\n```yaml\nDevtureTranslationBundleWebsite:\n    prefix: /{_locale}/translation\n    resource: \"@DevtureTranslationBundle/Resources/config/routes/website.yaml\"\n    requirements:\n        _locale: \"en|ja\"\n```\n\nThe Web UI is available at the `devture_translation.manage` route.\n\n\n## Styling\n\nThis bundle relies on [Bootstrap](http://getbootstrap.com/) v4 for styling.\nUnless you install and include it (somewhere in your `twig_layout_path` template), things would look ugly.\n\nAdditionally, you can make the pages look prettier by including a flag icon for each language somewhere in your layout or CSS file.\n\n```html\n\u003cstyle\u003e\n\t.devture-translation-flag {\n\t\tborder: 1px solid #dbdbdb;\n\t\twidth: 20px;\n\t\theight: 13px;\n\t\tdisplay: inline-block;\n\t\tvertical-align: text-top;\n\t}\n\t.devture-translation-flag.en {\n\t\tbackground: url('/images/flag/en_US.png') no-repeat;\n\t}\n\t.devture-translation-flag..ja {\n\t\tbackground: url('/images/flag/ja_JP.png') no-repeat;\n\t}\n\u003c/style\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevture%2Fsymfony-translation-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevture%2Fsymfony-translation-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevture%2Fsymfony-translation-bundle/lists"}