Updated as of #24.
Problem/Motivation
After uninstalling the locale_tamper module (or any other module) and revisiting admin/reports/translations the following notices are displayed:
Notice: Undefined index: locale_tamper in locale_translation_status_form() (line 634 of core/modules/locale/locale.pages.inc).
Notice: Trying to get property of non-object in locale_translation_status_form() (line 634 of core/modules/locale/locale.pages.inc).
Notice: Undefined index: echo in locale_translation_status_form() (line 634 of core/modules/locale/locale.pages.inc).
Notice: Trying to get property of non-object in locale_translation_status_form() (line 634 of core/modules/locale/locale.pages.inc).
When uninstalling a module before any translation is imported the below warning is displayed. Although this is an edge use case, the fix is easy.
Warning: Invalid argument supplied for foreach() in locale_translation_status_delete_projects() (line 985 of core/modules/locale/locale.module).
Proposed resolution
Check if there are any status's (it is not empty) before changing status and resaving it.
Remaining tasks
- reproduce on current d8 head.
Steps to reproduce
based on #9
- install d8
- "install/extend" (not called enable) interface translation module under Extend
- add a language at admin/config/regional/language
- download a module, for example UI Cache Clear, https://drupal.org/node/1969588/git-instructions/8.x-1.x
- Add a line to the ui_cache_clear.info.yml file: project: "ui_cache_clear" (the packaging script does not yet work with D8 .info.yml files, we need this for it to know how to try and fetch the translation file for the project)
- install the module, on Extend, admin/modules
- go to admin/reports/translations, and see
Home >> Administration >> Reports Available translation updates Add or remove shortcut Last checked: never (Check manually) Language Status Afrikaans Hide description Missing translations for 2 projects Drupal core (8.0-dev). No translation files are provided for development releases. UI Cache Clear (no version). File not found at http://ftp.drupal.org/files/translations/8.x/ui_cache_clear/ui_cache_clear-.af.po nor at translations://ui_cache_clear-.af.po
- check for translations manually on admin/reports/translations
- uninstall a module, on admin/modules/uninstall, for example: Contact
- reload the translations report page admin/reports/translations
- See error? Or no error? How many projects does it say it is missing translations for? Did it reduce from 2 to 1?)
User interface changes
none
API changes
none
Related Issues
- Originally this issue was about disabling, now it is about uninstall due to: #1199946: Disabled modules are broken beyond repair so the "disable" functionality needs to be removed
Original Report (before disabling was removed)
After disabling a the locale_tamper module (or any other module) and revisiting admin/reports/translations the following notices are displayed:
Notice: Undefined index: locale_tamper in locale_translation_status_form() (line 634 of core/modules/locale/locale.pages.inc).
Notice: Trying to get property of non-object in locale_translation_status_form() (line 634 of core/modules/locale/locale.pages.inc).
Notice: Undefined index: echo in locale_translation_status_form() (line 634 of core/modules/locale/locale.pages.inc).
Notice: Trying to get property of non-object in locale_translation_status_form() (line 634 of core/modules/locale/locale.pages.inc).
When uninstalling a module before any translation is imported the below warning is displayed. Although this is an edge use case, the fix is easy.
Warning: Invalid argument supplied for foreach() in locale_translation_status_delete_projects() (line 985 of core/modules/locale/locale.module).
Comment | File | Size | Author |
---|---|---|---|
#27 | Language4.png | 110.72 KB | oheller |
#27 | Language2.png | 132.34 KB | oheller |
#25 | Available translation updates localhost.png | 46.17 KB | Prashant.c |
#25 | Extend localhost.png | 49.94 KB | Prashant.c |
#23 | updatingtranslations.png | 89 KB | YesCT |
Comments
Comment #1
Sutharsan CreditAttribution: Sutharsan commentedThe attached patch implements hook_modules_disabled() to clear the translation status when a module is disabled. This solved the php notice.
For the php warning is adds an if-condition to locale_translation_status_delete_projects() to check for existing translation status before it is removed.
Comment #2
Sutharsan CreditAttribution: Sutharsan commentedComment #3
YesCT CreditAttribution: YesCT commentedtagging
Comment #4
docker CreditAttribution: docker commentedAfter the first time disabling the locale_tamper get the attached warning on the modules page.
I didn't get any message on the admin/reports/translations page.
After that I couldn't reproduce the error even If I tried to uninstall a different module or uninstall-install-disable the locale_tamper.
After a new d8 installation I've applied the #1 patch. I didn't get the warning or any other message after the first time disabling the locale_tamper. I still havent got any message after uninstalling the module.
Comment #5
Elijah LynnJust checkout latest 8.x-dev and cannot reproduce either. Can you see if latest HEAD still has this issue?
Comment #6
stpaultim CreditAttribution: stpaultim commentedTrying to recreate this issue. So far unsuccessful. Posting my steps so folks can help see if I'm missing anything:
NOTE: I was unable to try this with the "locale_tamper" module as suggested, because the "locale_tamper" module does not have .info.yml files and will not load.
1) Pulled a fresh version of Drupal 8 with GIT
2) Turn on Multilingual modules: Content Translation, Interface Translation, & Language
• Without these modules, there is no "translation" report. Even with them, it's an "Available Translation Updates" report.
3) Install Devel module
• Get AJAX HTTP error ("An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: http://drupal8:8082 ................) I am ignoring this for now, because I seem to get this error for every module I install. See: #1885788: An AJAX HTTP error occurred during module installation via UI
• Enable Devel module
4) In "Devel Settings" toggle "Display query log" - and verify that query log is working. Toggle it off again. (Just wanted to actually DO something with Devel before disabling it.
5) Disable Devel module and uninstall Devel module
• Go to Reports >> Available Translation Updates and look for error. None found.
6) Under "Available Translation Updates" Add 3 languages (German, French, & Amharic).
7) Install Backup and Migrate Module.
• Get AJAX HTTP error ("An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: http://drupal8:8082 ................) I am ignoring this for now, because I seem to get this error for every module I install. See: #1885788: An AJAX HTTP error occurred during module installation via UI
• Enable Backup and Migrate module
8) Create a QUICK BACKUP using Backup and Migrate Module - again, to actually do something with the module before disabling it.
9) Disable Backup and Migrate module.
• Go to Reports >> Available Translation Updates and look for error. None found.
10) Uninstall Backup and Migrate module.
• Go to Reports >> Available Translation Updates and look for error. None found.
=================
If anyone can suggest anything else I might do that would create this problem, let me know and I'll try again. ALSO: the reports suggested the problem occurred when "revisiting admin/reports/translations." I'm not exactly sure which report this is. I tried to recreate the error looking at the "Available translation updates" report. If I'm misunderstanding the problem, please correct me and I'll try again.
Comment #7
YesCT CreditAttribution: YesCT commented@stpaultim is the behavior any different if you go to the translations status report while the module is on, *then* disable it and go back to the report?
Comment #8
robertdbailey CreditAttribution: robertdbailey commented@YesCT, confirmed no difference if we first visit the translation status report while the module is on and then disable the module and go back to the report. I visited the report, then enabled the XML-RPC module, then visited the report again to confirm there were no warning messages, then disabled the XML-RPC module, then visited the report again to confirm there were again no warning messages.
So, I am not able to reproduce the error, along with @Elijah Lynn and @stpaultim. Closing issue as cannot reproduce.
Comment #9
Sutharsan CreditAttribution: Sutharsan commentedI can still repoduce the error, and this is how:
project: "ui_cache_clear"
(the packaging script does not yet work with D8 .info.yml files)Comment #10
nonsieFollowed the steps but was unable to replicate this error
Comment #11
andymartha CreditAttribution: andymartha commentedFollowed the steps in #9 but was unable to replicate this error
Comment #12
jair CreditAttribution: jair commentedNeeds Reroll
Comment #13
jlbellidoRerolled with @luismagr and @neoligero , and run test.
Comment #15
Sutharsan CreditAttribution: Sutharsan commentedThe
if (isset($status))
condition will always be true. In worst caselocale_translation_get_status()
will return an empty array. Should beif (!empty($status))
.Comment #16
jlbellidoThanks @Shutharsan, sorry for that.
Comment #18
mr.baileysThe failing test seems unrelated to this patch, and passes locally, so setting to RTBC.
Comment #19
mr.baileys#16: locale-notice-disable-module-1887136-16.patch queued for re-testing.
Comment #20
jlbellidoDeleted hook_modules_disabled() because now modules can't be disabled. Thanks @Sutharsan for to advise me.
Comment #21
penyaskitoBack to RTBC after Sutharsan requirement were fixed.
Comment #21.0
YesCT CreditAttribution: YesCT commentedin progress updating due to disabling modules broken...
Comment #22
YesCT CreditAttribution: YesCT commentedI'm updating the issue summary.
Comment #22.0
YesCT CreditAttribution: YesCT commentedfix typo and clarify
Comment #23
YesCT CreditAttribution: YesCT commentedI cannot reproduce this.
I did notice a few things while trying to, these should be separate issues if they are not already:
1. #2034879-3: [Meta] Fix documentation that refers to enabling/disabling of modules
admin/config/regional/translate/settings
says "Check for updates of disabled modules and themes"
2. Even when my settings admin/config/regional/translate/settings says
When I install a module, I get a batch progress bar that says
I did not expect it to get the translation. I have configured to never get updates.
2a. is it really checking for the translation?
2b. is getting the initial translation different than checking for updates?
3. When installing, I get notice:
Notice: Undefined index: path in Drupal\Core\Routing\RouteBuilder->rebuild() (line 97 of core/lib/Drupal/Core/Routing/RouteBuilder.php).
Maybe because the locale module is doing something related to translating config.
Comment #23.0
YesCT CreditAttribution: YesCT commentedadded steps to reproduce
Comment #24
YesCT CreditAttribution: YesCT commentedup to date summary for now.
But need someone to verify this is reproducible.
Comment #24.0
YesCT CreditAttribution: YesCT commentedupdated approach.
Comment #24.1
YesCT CreditAttribution: YesCT commentednoting up to date as of... comment number
Comment #25
Prashant.cFollowed the steps by #9 and able to reproduce this error.
Also getting warnings after enabling the module ui_cache_clear attaching screenshots.
Comment #26
Prashant.cComment #27
oheller CreditAttribution: oheller commentedWhile trying to recreate #9 I had the below issues. Here is the process I made it through.
1) Install Drupal: English, Standard profile, MySQL database
2) Enable Language + Interface translation module
3) Enable a language: Dutch
4) Download a module: UI Cache Clear
5) Add a line to the ui_cache_clear.info.yml file: project: "ui_cache_clear" (the packaging script does not yet work with D8 .info.yml files)
6) Enable the module: admin/modules - Error Language2
7) Install and enable Rules module.
8) Uninstall Rules module (wanted to add project:"rules" to rules.info.yml) - Error Language4
I haven't been able to reproduce this yet.
Comment #36
g-brodieiAs part of Bush Smash Initiative,
I'm trying to reproduce the bug following instructions on the issue summary updated by @YesCT and #9. I'd also tried the steps on #27 by @oheller. Big thanks to all previous contributors providing tests and patches.
Do note that adding new line to {module_name}.info.yml file as mentioned on Step 5 of IS is not tested since the packing script of drupal.org adds this automatically already.
I did the following steps,
1. Fresh install 8.9.x, php 7.3, mysql 5.7
2. Enable interface translation module (locale)
3. Add new language Chinese, Traditional at admin/config/regional/language
3. Install taxonomy menu module with
composer require drupal/taxonomy_menu
4. Check admin/reports/translations, no errors were shown
5. Uninstall taxonomy menu module
6. Check admin/reports/translations, no errors were shown again
7. Tried with new language Afrikaans, and repeat step 4-6.
Still no error or bug shown like issue description.
Therefore, I'm closing this issue as it cannot be reproduced.