{"id":20961779,"url":"https://github.com/heimrichhannot/contao-multilingual-fields-bundle","last_synced_at":"2025-12-28T16:44:10.126Z","repository":{"id":62515512,"uuid":"358255199","full_name":"heimrichhannot/contao-multilingual-fields-bundle","owner":"heimrichhannot","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-08T07:27:47.000Z","size":252,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-10-12T03:01:18.930Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heimrichhannot.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-04-15T12:41:50.000Z","updated_at":"2025-03-25T13:24:57.000Z","dependencies_parsed_at":"2025-08-06T08:13:02.682Z","dependency_job_id":"3daca2c7-bb9f-4027-86a4-acade3d10719","html_url":"https://github.com/heimrichhannot/contao-multilingual-fields-bundle","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/heimrichhannot/contao-multilingual-fields-bundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-multilingual-fields-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-multilingual-fields-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-multilingual-fields-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-multilingual-fields-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heimrichhannot","download_url":"https://codeload.github.com/heimrichhannot/contao-multilingual-fields-bundle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-multilingual-fields-bundle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28101486,"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-12-28T02:00:05.685Z","response_time":62,"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":[],"created_at":"2024-11-19T02:17:19.304Z","updated_at":"2025-12-28T16:44:10.107Z","avatar_url":"https://github.com/heimrichhannot.png","language":"PHP","readme":"# Contao Multilingual Fields Bundle\n\nThis utility bundle offers functionality for backend editor's to translate arbitrary fields of any table-driven data\ncontainer in the Contao CMS.\n\n## Features\n\n- define which fields of which data containers should be translatable\n- adds a button to the backend palette for switching into translation mode\n- content elements: optionally add a select field to the backend palette in order to display the corresponding content\n  element only for the selected language\n\n## Impressions\n\n![Edit languages button](docs/img/edit-languages-button.png)\nThe button for editing the languages (right) and the button for showing certain content elements only for the selected\nlanguage (left, for `tl_content` only)\n\n![Edit languages](docs/img/edit-languages.png)\nEditors can specify which of the fields should be translated for which languages\n\n## Use case\n\nThe use case for this bundle is to have an automatic and structured process for adding translatable fields to a data\ncontainer. Also, you get a nice and editor-friendly way to edit translations in the backend ;-)\n\n## What doesn't the bundle do?\n\nCurrently for most data containers this bundle is a utility bundle for just bringing a nice and editor-friendly way to edit translations in the backend.\nIt's up to you how to use the fields.\n\n**Besides tl_content there's no out-of-the-box support for contao's frontend modules!**\n\nBut you can of course use the created fields in your templates (if the modules passes the data there).\n\n## How does it work?\n\nThe bundle works quite simply: it looks into your project's `\u003cproject_dir\u003e/config/config.yml` and based on that adds the\nfields defined here as translatable fields.\n\nExample: Imagine the following `config.yml` (position is the field representing the job of the member in the company):\n\n```yaml\nhuh_multilingual_fields:\n  fallback_language: de\n  languages:\n    - en\n  data_containers:\n    tl_member:\n      fields:\n        - { name: position }\n```\n\nThis would end up in your DCA being automatically modified the following way:\n\n```php\n// ...\n[\n    // the original position field is nearly unchanged -\u003e only some meta field links are set in eval\n    'position' =\u003e [\n        'exclude'   =\u003e true,\n        'search'    =\u003e true,\n        'inputType' =\u003e 'text',\n        'eval'      =\u003e [\n            'maxlength' =\u003e 128,\n            'tl_class' =\u003e 'w50',\n            'mandatory' =\u003e true,\n            'isTranslatedField' =\u003e true,\n            'translationConfig' =\u003e [\n                'en' =\u003e [\n                    'field' =\u003e 'en_position',\n                    'selector' =\u003e 'en_translate_position'\n]               ]\n            ]\n         ],\n        'sql'       =\u003e \"varchar(128) NOT NULL default ''\"\n    ],\n    // automatically created: the selector field and the translation field\n    // the selector field (subpalette and selector is also set)\n    'en_translate_position' =\u003e [\n        'label'     =\u003e ['Translate (English)', 'Click this option in order to translate the field for the given language.'],\n        'exclude'   =\u003e true,\n        'inputType' =\u003e 'checkbox',\n        'eval'      =\u003e [\n            'tl_class' =\u003e 'w50',\n            'submitOnChange' =\u003e true,\n            'translationField' =\u003e 'en_position',\n            'translatedField' =\u003e 'position'\n        ],\n        'sql'       =\u003e \"char(1) NOT NULL default ''\",\n    ],\n    // the translation field\n    'en_position' =\u003e [\n        'label'     =\u003e ['Position (English)', '\u003cthe description as given\u003e'], // generated automatically out of the label of the \"position\" field\n        'exclude'   =\u003e true,\n        'search'    =\u003e true,\n        'inputType' =\u003e 'text',\n        'eval'      =\u003e [\n            'maxlength' =\u003e 128,\n            'tl_class' =\u003e 'w50',\n            'mandatory' =\u003e true,\n            'translatedField' =\u003e 'position',\n            'translationSelectorField' =\u003e 'en_translate_position'\n         ],\n        'sql'       =\u003e \"varchar(128) NOT NULL default ''\"\n    ]\n]\n```\n\n## Installation \u0026 configuration\n\n1. Run `composer require heimrichhannot/contao-multilingual-fields-bundle`.\n1. Create the file `\u003cproject_dir\u003e/config/config.yml` if not already existing and specify your translatable fields:\n   ```yaml\n   huh_multilingual_fields:\n     fallback_language: de\n     content_language_select: # add a select field to content element palettes for displaying elements only for the specified language\n       enabled: true # default: false\n       types: # if not set, the select field is added to all tl_content types\n         - text\n     languages:\n       - en\n     data_containers:\n       tl_member:\n         sql_condition: tl_member.firstname LIKE ? # optional; activate the functionality only for some entities\n         sql_condition_values:\n           - \"%%john%%\" # be careful about escaping; in yaml the reserved character \"%\" can't be in first place and need to be be escaped\n         fields:\n           - { name: alias, is_alias_field: true, alias_base_field: lastname }\n           - { name: lastname }\n           - { name: position }\n   ```\n1. Clear the project's cache (`\u003cproject_dir\u003e/var/cache`).\n1. Update the database. The new fields should be created now.\n\n## Insert tags\n\nThe following new insert tags are available. These take into account the translated jumpTo url and alias.\n\nName | Example\n-----|--------\n`{{mf_news_url::\u003cid\u003e::\u003clanguage\u003e}}` | `{{mf_news_url::1::de}}`\n`{{mf_event_url::\u003cid\u003e::\u003clanguage\u003e}}` | `{{mf_event_url::5::es}}`\n`{{mf_faq_url::\u003cid\u003e::\u003clanguage\u003e}}` | `{{mf_faq_url::8::en}}`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheimrichhannot%2Fcontao-multilingual-fields-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheimrichhannot%2Fcontao-multilingual-fields-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheimrichhannot%2Fcontao-multilingual-fields-bundle/lists"}