Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
language system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
18 Jul 2011 at 15:28 UTC
Updated:
29 Jul 2014 at 19:48 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
sunmmm, "ui" is yet another abbreviation. :-/
#1216094: We call too many things 'language', clean that up could have used some more discussion, agreement, and buy-in, before attempting to create a patch, IMHO. But anyway...
I currently see:
So the most logical thing would be to have:
and thus, $language_interface.
Comment #2
gábor hojtsySuperb. The patch makes it very easy to search and replace for this. Did that. I think this patch is great because it singles out all the $language values which were global (unless I missed some), so whatever we decide to rename it to, we can. If we want it to be $language_locale_code_key_tag we can make that happen :)
Comment #3
gábor hojtsyBased on discussion with @sun in IRC, marking postponed for now to make sure we get to the right terminology in #1216094: We call too many things 'language', clean that up. The patch is still good to serve as a base to identify what to rename, and depending on the changes done in the interim, might be used to search and replace to generate a new patch later.
Comment #4
gábor hojtsyComment #5
gábor hojtsyNow this one includes all instances of GLOBALS['language'] as well. That should help with lots of notices, hope it also helps with making tests pass.
Comment #6
plachComing back later
Comment #8
gábor hojtsyEven more places where I found global $language in other constellations. Getting there.
Comment #10
gábor hojtsyEvidently I still missed some places in tests where the detection and selection configuration was handled.
Comment #12
gábor hojtsyFinally some leftover pieces of classes and block tests.
Comment #12.0
gábor hojtsyUpdated.
Comment #12.1
gábor hojtsyUsed summary template for updated summary. Hopefully even clearer.
Comment #13
gábor hojtsyTalked about this in IRC with plach. He says we need to update the 'language_types' variable and rename 'language_negotiation_language' to 'language_negotiation_language_interafce'. No other affected settings identified so far. That is still to be done. Reviews of the patch welcome in the meantime.
Comment #14
plachI reviewed the patch and aside from the stupid thing below it looks ready to go. The bot is doing a far better job at testing it than the one I could do myself. We are still missing an update function, however. About this I found another variable that should be updated:
locale_language_providers_weight_languageshould becomelocale_language_providers_weight_language_interface.Comment is not wrapping at column 80.
Comment #15
gábor hojtsy@plach: thanks! Here is a version of the patch with updates (5) and one without (6). I think we are currently opening separate issues for the updates to get them tested once they'll actually be run, so not sure we should include that here. Anyway, this is the update function I devised, please review!
Also made the change you spotted for the 80 column issue :)
Comment #16
plachI'm a bit worried by this: at a first read it seems that the original key order is not preserved. Since the key order determines the order in which languages are initialized, and content language inherits from interface language, this should lead content language to get an empty value. I guess the bot is not failing because we have no test coverage for D7 > D8 upgrade yet.
Why
is_nulland not$setting === NULLwhich should be faster?29 days to next Drupal core point release.
Comment #17
gábor hojtsyOk, this should keep the order. I'm not crazy about === NULL, its ok :) What about this?
Comment #18
plachNow it looks good :)
I'll test the upgrade path myself as soon as I can.
Comment #19
sunum, did you guys already hear about PHP's latest awesome function http://www.php.net/manual/en/function.isset.php ?
Comment #20
lars toomre commentedNever will set language_types to $new_types due to misspelling in
if (!empty($types) && isset($types['lanuguage'])) {
Cheers!
Comment #21
plach@sun:
yes, I read something about it, not that good after all ;)
Comment #22
gábor hojtsy@Lars: ha! Looks like I'm close to unlocking the "language word mistyped in most creative ways" badge soon. Fixed that in the attached patch, good catch.
Comment #23
sunComment #24
plachWe are almost there but not yet: without the fixes below the update won't work.
This should be
Moreover I realized that also the interface language switcher block delta must be renamed from 'language' to 'language_interface'.
Additionally while running the update, if language negotiation settings are present, notices are thrown all around since the global
$language_interfaceis not initialized yet. These can be fixed by adding the following line to update.php (see also the attached patch):29 days to next Drupal core point release.
Comment #25
gábor hojtsyOk, so the only thing you have not done in your updated patch seems to be the data migration for blocks to the new name. Will look into that then.
Comment #26
plachYes, I only made the minimal fixes needed to make the upgrade run smoothly. This way I can review the final patch :)
Comment #27
gábor hojtsyThanks! Updated the patch with code to update data in the block, block_role and block_node_type tables.
Comment #28
plachI tested #27 with the fix below and everything looks good. If we need upgrade path tests this is NW otherwise if they need a separate issue this one is RTBC.
The 'module' column should be 'locale' :)
22 days to next Drupal core point release.
Comment #29
gábor hojtsyTalked to catch, he thinks we'd better add some update testing, although nothing will run our updates to test it... :| #1182290: Add boilerplate upgrade path tests is the main culprit.
Comment #30
gábor hojtsyOk, well, I wanted to have this in much sooner, but with no upgrade path tests, this did not get to fruition. At this point however, there is no point in working on this, since we are moving on to have a context system instead of globals. The update related code needs to be taken over to #1260918: Convert language globals to contexts that handles the migration of the language globals to context and will need to do the same or similar rename of the global language.
Comment #31
gábor hojtsyTagging for base language system.
Would this make sense to be reopened given that contexts are still not anywhere in sight?
Comment #32
gábor hojtsyTagging for language negotiation too.
Comment #33
gábor hojtsyReopening based on @plach's suggestion in http://drupal.org/node/1431040#comment-5574216 (#1431040: Rename LOCALE_LANGUAGE_NEGOTIATION_* constants to LANGUAGE_NEGOTIATION_*).
Comment #34
plachI guess this needs to be done soonish.
Comment #35
plach#28: language-1222194-28.patch queued for re-testing.
Comment #37
plachThis was ugly to reroll. Hope I didn't miss anything.
Comment #39
plachWrong update number. This should also go in the proper PHP doc group.
20 days to next Drupal core point release.
Comment #40
plachComment #41
gábor hojtsyRe-uploading for retest. I think testbot was stuck and found no way to get it restested but to upload again.
Comment #43
plachThere were a couple of missing places.
Comment #45
gábor hojtsyFixed the three remaining places the tests were failing (AFAIS). Locale_test.module, book.module and one more place in locale.module. Also put the new update function under an incrementally increasing number, but before the existing one. We have no reason to mix up the function order, do we?
Even if this passes I think we need update testing for it which would include some of the values touched in the update and ensure it updates properly.
Comment #47
plach(Hopefully) The last fix.
I ain't sure about this, I think tests would fail if we messed something up in the update function. Let's try without
locale_update_8001.Comment #49
plachNice!
However it seems that block upgrade is not test covered, I think a simple assertion about the presence of the language switcher in the page would be enough, right?
Comment #50
gábor hojtsyYes, I think so. (drupal-7.language.database.php does not currently have it enabled though, so that would need to change too).
Comment #51
plachAw, I saw some activity around it in the latest patches. Is there a resource or something I can read to learn the proper way to create/alter the DB dump?
Comment #52
gábor hojtsy@plach: its a php file using the D8 DB API, so you can just alter where it adds the block to do state => '1' instead of status => '0' and place it in a region, really nothing special about it.
Comment #53
plachOh, wonderful :)
Comment #54
plachTesting again the upgrade path coverage.
Comment #56
plachOk, the results look good now.
Comment #57
gábor hojtsyYay, I think this looks good, has good update test coverage and all the benefits outlined in the issue summary still stand. I think this looks good to go.
Comment #58
gábor hojtsyHas tests, so no need to tag needs tests.
Comment #59
dries commentedThis no longer seems to apply and may need a quick re-roll.
Comment #60
dries commented#54: language-1222194-54.patch queued for re-testing.
Comment #61
gábor hojtsyYes, unfortunately this is the kind of test which is going to fail to apply more and more as it is lingering :/ Attached a reroll with the apply fails fixed (and the newly extended tests in locale hopefully entirely updated). Looking for testbot feedback.
Comment #62
gábor hojtsyAll right then, applies again (for now :).
Comment #63
gábor hojtsyPatch still applied with offsets. Rerolling just to make sure we have a 100% applicable patch (and a fresh test result). There is absolutely no change so should still be RTBC (unless it fails with the current codebase).
Comment #64
dries commentedGive this another review and it still looks great. No more lingering around; committed to 8.x. Thanks Gabor.
Comment #65
gábor hojtsyChange notice added at: http://drupal.org/node/1450578 - removing sprint tag.
Comment #66
tim.plunkettDries, if you use single quotes the commit messages won't get messed up. Or, if you have to use double quotes because of apostrophes, don't use `git commit -m` and let it drop you into an editor.
This
- Patch #1222194 by Gábor Hojtsy, plach: Rename global $language to $language_interface().Became
- Patch #1222194 by Gábor Hojtsy, plach: rename global to ().Comment #67
andypostUpdate function for the d8 site with 3 languages are failed for me
Suppose this caused that I've visit site before running update and blocks already been rebuild so I have duplicates

Comment #68
andypostSuppose better to check is there any blocks and clean-up possible auto-created rows
Comment #69
plachPlease, can we have a separate line for the query to improve readability? Moreover a comment to explain why we are performing this check could be useful too.
If I'm not missing something the update should be outside the if statement as it should always be executed.
7 days to next Drupal core point release.
Comment #70
andypostI suppose that if there's no locale's blocks so no update needed
Comment #71
plachRight, I misread the test. It should really be on a separate line.
Comment #72
andypostAdded comment for db_delete()
db_query() changed to one line as all over core we have
Comment #73
andypostPrevious patch was wrong
Comment #74
plachCleaned up comments and readability, otherwise untouched.
Comment #75
gábor hojtsySo how can the new blocks be there if the old ones are not yet removed? If a block rebuild would happen, it should remove the old blocks not available anymore too, no? @andypost your block ids look suspicious since the new blocks are before the old? Hm.
Comment #76
andypost@Gábor Hojtsy it seems block_rehash still bogus.
Steps to reproduce
Comment #77
gábor hojtsy@andypost: ok, I guess that is because the language provider data is also cached and not yet updated. So I agree the patch looks good to solve the problem.
Comment #78
catchOK I asked Gabor in IRC why the updated didn't come with tests, but it's apparently only possible to hit this if you hit your site while also upgrading. The change is small enough and the bug obscure enough that I've gone ahead and committed this.
Comment #79.0
(not verified) commentedMistyped some stuff