Drupal 8 has configuration schemas to describe the structure of configuration. This was proposed in part to resolve regressions and keep content types, menu items, etc. translatable. The schemas describe the structure of configuration but not yet which items are translatable and there is no connection with the software translation system (locale module) in core to use that information to make shipped configuration translatable. This solves regressions making shipped settings like email texts, content types, etc. translatable again.
Patches atall included this integration but that was postponed on other attempts and got committed after all, which was more minimalistic. So we need to resurrect all the previously written code and adapt to the current schema system. Take things removed in progress in and the feature set delta between that and and make it work with the committed schema system.
Changed user interfaces
The only user interface change is a new step is added in the installer to import configuration translations. Module enable and disable batches will last a bit longer because the configuration translation update steps are included in the existing batches.
Configuration schema elements get a 'translatable' boolean property, and the text and label types are marked true. Core already uses this guideline to use text and label types for UI facing text elements that are to be made translatable, so this is just codifying an existing pattern.
Drupal\locale\LocaleConfigManager is added to wrap shipped configuration and access with translations. locale_config() is added in locale.module to access an instance of that. Drupal\locale\LocaleTypedConfig is added to wrap each config Element.
Steps to test #
1. Apply patch.
2. When installing Drupal and enabling modules(Language, Interface Translation), strings from the configuration of said modules will show up under Admin > Configuration > User interface translation.
3. Search for strings there like the shipped user role names ("Authenticated user"), the default contact category ("Website feedback"), block placement titles ("User login", "Footer menu"), content type names and descriptions ("Basic page", "Use basic pages for your static content, such as an 'About us' page.") etc.
4. Translate them on this user interface (some/all of them may already be translated based on the .po files imported from localize.drupal.org, feel free to modify the translations for testing too).
5. Watch as the translation is being used when you switch language on the site (on the block, add content page, contact page, user editing screen in a foreign language, etc). (The contact category title will show on the dedicated URL of the contact category, eg. /contact/feedback for the default one, it does not show on the main /contact page).
- Needs more manual testing and code reviews, then done :) (The patch is functionally complete, tests are included and expanded. )
- figure out if we want to keep implementing Drupal\Core\TypedData\TranslatableInterface, which is what makes the getTranslationLanguages() weird code and the strict mode in getTranslation() required. (see #153)
|#154||interdiff.txt||7.76 KB||Gábor Hojtsy|
|#154||1905152-metadata-locale-integration-154.patch||55.46 KB||Gábor Hojtsy|
PASSED: [[SimpleTest]]: [MySQL] 55,032 pass(es). View
|#153||interdiff.txt||6.95 KB||Gábor Hojtsy|
|#153||1905152-metadata-locale-integration-153.patch||56.9 KB||Gábor Hojtsy|
PASSED: [[SimpleTest]]: [MySQL] 55,384 pass(es). View
PASSED: [[SimpleTest]]: [MySQL] 55,349 pass(es). View