Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/erpushpinderrana/config_translations_example
Drupal Config Translation Example
https://github.com/erpushpinderrana/config_translations_example
config config-only drupal drupal-config drupal-config-translation drupal-module drupal9 i18n internationalization localization multilingual pushpinderdrupal translation
Last synced: 8 days ago
JSON representation
Drupal Config Translation Example
- Host: GitHub
- URL: https://github.com/erpushpinderrana/config_translations_example
- Owner: erpushpinderrana
- License: mit
- Created: 2022-02-17T00:33:28.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-02-17T03:03:01.000Z (over 2 years ago)
- Last Synced: 2024-10-11T02:21:22.295Z (about 1 month ago)
- Topics: config, config-only, drupal, drupal-config, drupal-config-translation, drupal-module, drupal9, i18n, internationalization, localization, multilingual, pushpinderdrupal, translation
- Language: PHP
- Homepage:
- Size: 18.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Drupal Config Translation Example - Module
The Configuration Translation module (part of Drupal Core in Drupal 9) allows configuration to be translated into different languages. Whenever there are custom configurations, then it relies on having a correct configuration schema to provide translations. So, every module must provide a correct schema. This is just an example module to get an idea of how can we achieve it through a custom module.## How to get config translation
[Translated Config](https://www.drupal.org/project/translated_config) module is necessary if there is a use case of such type as Drupal Core does not provide a way to get one complete dataset of configuration in a specified language.```
\Drupal::service('translated_config.helper')->getTranslatedConfig('system.site','de')->get('name');
```## References
* https://www.drupal.org/docs/multilingual-guide/translating-configuration
* http://www.hojtsy.hu/blog/2014-may-26/drupal-8-multilingual-tidbits-16-configuration-translation-development
* https://www.drupal.org/docs/user_guide/en/language-config-translate.html
* https://antistatique.net/en/blog/drupal-8-how-to-translate-the-config-api
* https://www.drupal.org/docs/drupal-apis/configuration-api/configuration-schemametadata