Problem/Motivation

#2212069: Non-English Drupal sites get default configuration in English, edited in English, originals not actually used if translated says its a critical usability problem if default configuration is not translated to the site's default language when installed. Part of resolving that is that then when we add English to the site (later), we need to extract all source strings and add them as a translation, so the English translation is available. If the site already had English at the time of the config installation, we can install it in English, so this issues does not apply. So this applies to sites that do not have English configured.

Proposed resolution

When adding English, extract all source strings for default configuration that exists in the active storage and save them as translations.
Add tests.

Remaining tasks

Do it.

User interface changes

None.

API changes

None.

Files: 
CommentFileSizeAuthor
#19 interdiff.txt780 bytesGábor Hojtsy
#19 2429651-19.patch54.95 KBGábor Hojtsy
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 85,990 pass(es), 47 fail(s), and 7 exception(s). View
#17 interdiff.txt1.95 KBGábor Hojtsy
#17 2429651-17.patch54.94 KBGábor Hojtsy
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 83,262 pass(es), 124 fail(s), and 75 exception(s). View
#15 interdiff.txt23.5 KBGábor Hojtsy
#15 2429651-15.patch54.78 KBGábor Hojtsy
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 79,137 pass(es), 180 fail(s), and 1 exception(s). View
#13 interdiff.txt5.31 KBGábor Hojtsy
#13 2429651-13.patch41.05 KBGábor Hojtsy
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 87,002 pass(es), 15 fail(s), and 5 exception(s). View
#11 2429651-11.patch40.25 KBGábor Hojtsy
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 86,403 pass(es), 189 fail(s), and 11,922 exception(s). View
#11 interdiff.txt7.57 KBGábor Hojtsy
#9 interdiff.txt6.58 KBGábor Hojtsy
#9 2429651-9.patch41.92 KBGábor Hojtsy
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 86,396 pass(es), 160 fail(s), and 12,465 exception(s). View
#7 2429651-7.patch40.17 KBGábor Hojtsy
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 86,547 pass(es), 157 fail(s), and 1,906 exception(s). View
#7 interdiff.txt11.52 KBGábor Hojtsy
#5 2429651-5.patch31.56 KBGábor Hojtsy
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 86,473 pass(es), 159 fail(s), and 1,911 exception(s). View
#5 interdiff.txt24.6 KBGábor Hojtsy
#4 interdiff.txt472 bytesGábor Hojtsy
#4 2429651-clean-concerns-4.patch0 bytesGábor Hojtsy
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 87,231 pass(es). View
#2 2429651-clean-concerns.patch9.03 KBGábor Hojtsy
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 87,149 pass(es), 50 fail(s), and 2 exception(s). View

Comments

Gábor Hojtsy’s picture

Issue tags: +Needs tests
Gábor Hojtsy’s picture

Status: Active » Needs review
FileSize
9.03 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 87,149 pass(es), 50 fail(s), and 2 exception(s). View

Let's start with cleaning up concerns a bit. LocaleConfigManager needs to know what to touch when needing to update config translations, so we need to move the update function there. It also is dependent on all the services we need. Plus we need the batch building to not exclude English, because otherwise when English is added, we'll not get invoked to "save" a translation for that.

Status: Needs review » Needs work

The last submitted patch, 2: 2429651-clean-concerns.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
0 bytes
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 87,231 pass(es). View
472 bytes

Duh wrong use statement.

Gábor Hojtsy’s picture

FileSize
24.6 KB
31.56 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 86,473 pass(es), 159 fail(s), and 1,911 exception(s). View

Easy to make a 0 byte patch pass, ha... Just posting the work in progress for now, this will obviously horribly fail. Also needed to expand the scope quite a bit, so may need to go back to the META eventually instead of trying to do it piece by piece.

Status: Needs review » Needs work

The last submitted patch, 5: 2429651-5.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
11.52 KB
40.17 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 86,547 pass(es), 157 fail(s), and 1,906 exception(s). View

Also adding a config install event and responding to that with changing the language of installed config files.

Status: Needs review » Needs work

The last submitted patch, 7: 2429651-7.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
41.92 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 86,396 pass(es), 160 fail(s), and 12,465 exception(s). View
6.58 KB

1. Make processTranslatableData() only consider keys also in the active storage. Because these are synched with locale, we can be sure what we get from locale is correct as much as it can be in this new setup and we can use that as reference data.

2. Remove obsolete compareConfigData()

3. Fixed logic in defaultConfigLangcode(), activeConfigLangcode(), isSupported(). If a given $name does not have an active config copy anymore or it was not shipped config, it should not be supported here.

4. Simplify/fix logic in updateConfigTranslations().

Status: Needs review » Needs work

The last submitted patch, 9: 2429651-9.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
7.57 KB
40.25 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 86,403 pass(es), 189 fail(s), and 11,922 exception(s). View

The config install event is too late. When enabling locale module in the installer, we do that after most config was installed. So we need to update all prior default imported config when the locale module is installed. Then we can do the config updates for other module installs at the same place, no need to add an event for this. Also much less code.

Status: Needs review » Needs work

The last submitted patch, 11: 2429651-11.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
41.05 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 87,002 pass(es), 15 fail(s), and 5 exception(s). View
5.31 KB

Fixed all the issues so now it changes language codes properly and updates built-in config. Also updating translations from the interface translation UI now updates ACTIVE CONFIG.

1. TranslationWrapper::getOption() should return an empty string if the given option was not found. Its the default of all optios. Removes lots of notices.

2. locale_system_set_config_langcodes() used the component list incorrectly. LocaleConfigManager::getComponentsNames() needs the structured array not a flat one.

3. Several issues in LocaleConfigManager::processTranslatableData() which resulted in empty translation arrays.

4. Avoid notices in LocaleConfigManager::defaultConfigLangcode() and activeDefaultLangcode().

5. LocaleConfigManager::updateConfigTranslations() should not do anything if the translation array was empty.

6. Nuke LocaleConfigSubscriber for now by adding an early return. That does not work yet.

Once again this installs in Hungarian beautifully for me. It does not yet feed back to the interface translation when I edit active config or config translation but it does feed back to config when I edit interface translations.

Status: Needs review » Needs work

The last submitted patch, 13: 2429651-13.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
54.78 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 79,137 pass(es), 180 fail(s), and 1 exception(s). View
23.5 KB

Now starting to fix how locale is updated thanks to config (override) changes.

1. Would have been reimplementing some of the bugs in #2429385: locale_system_remove() should not attempt to remove strings from the locale DB so folded that in here.

2. Fix some high level docs in LocaleConfigManager to make responsibilities cleaner. This also explains why some code was removed that previously errorneously updated configuration.

3. Renamed isUpdating to isUpdatingFromLocale and isUpdatingConfigTranslations() to isUpdatingTranslationsFromLocale() in LocaleConfigManager. This makes it clearer what is the role of this flag. Also added better docs to the flag and the method.

4. Removed LocaleConfigManager::isTranslatedConfig() because I did not find a pratical use (its not in HEAD, I introduced it in an earlier patch).

5. Refactored LocaleConfigSubscriber entirely to work with the new simpler translation structure. Removed the bogus cases when configuration updates resulted in new source strings saved or strings deleted from locale storage. When configuration or overrides are updated, we need to treat that update as customized translation changes. Of course if the translation is still the same as source or still the same as the existing interface translation, then we won't mark it custom, but otherwise we need to.

6. Added an onConfigSave() to respond to active config saves, where we need to feed back changes there to locale storage.

Status: Needs review » Needs work

The last submitted patch, 15: 2429651-15.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
54.94 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 83,262 pass(es), 124 fail(s), and 75 exception(s). View
1.95 KB

Config does not have a getLangcode().

Status: Needs review » Needs work

The last submitted patch, 17: 2429651-17.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
54.95 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 85,990 pass(es), 47 fail(s), and 7 exception(s). View
780 bytes

Should pass in the data, not the config.

Status: Needs review » Needs work

The last submitted patch, 19: 2429651-19.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Closed (duplicate)
Issue tags: -sprint, -Needs tests

Given that I found this is not possible to implement in a sane way without implementing the rest of the features, this way oversteps the scope of this issue, posted as #2212069-48: Non-English Drupal sites get default configuration in English, edited in English, originals not actually used if translated. Closing this as duplicate.