Problem/Motivation
When a custom string is created all other strings in form become in custom string
Proposed resolution
verify unchanged strings are not tagged as custom strings
Steps to reproduce
- Install the latest Drupal 8.x using the standard profile and built-in English language.
- Enable Language, and Interface Translation module.
- Go to '/admin/config/regional/language', click 'Add language', and choose 'German'.
- Go to '/admin/config/regional/translate/import', Choose German and add translation file 'drupal-7.17.de'. Don't touch that three checkboxes in this page.
- Go to '/admin/config/regional/translate/translate', choose language 'German', search in 'Both translated and untranslated', and click filter.
- Edit the first translated string at cloumn 'TRANSLATION FOR GERMAN', and click 'Save translations'.
- Still this page, Choose 'Translation language' at German, 'Search in' at 'Only translated strings', 'Translation type' at 'Customized translation', click Filter. We get *all* those strings that were on that page as customized. In fact , we edited only *one* string.
Remaining tasks
Create instruction to reproduce the problem(thanks! @smiletrl , from #15. )Create an initial patch to verity unchanged string are not tagged as custom string(from @Schnitzel in #13)Create an initial Simple test(from @Schnitzel in #13)- (medium) review test-only to see if tests are complete
- (novice) review patch. Review Task doc: http://drupal.org/node/1488992
- (novice) manually test the fix/patch. Manually Test Task doc: http://drupal.org/node/1489010
- (based on reviews and manual test) Improve fix/patch
- (novice) Coding Standards. Contributor task: Improve patch coding standards and documentation http://drupal.org/node/1487976
- (ongoing) update Remaining tasks as needed. This is in flux.
User interface changes
Changes in UI aren't required
API changes
Changes in UI aren't required
Original report by [username]
we saw this bug during Gabor's D8MI presentation at BADCamp, will check this myself, just keeping it as a reminder.
Comment | File | Size | Author |
---|---|---|---|
#30 | drupal-uncustomized_language_strings-1832614-tests.patch | 3.6 KB | smiletrl |
#30 | interdiff-13-29.txt | 3.31 KB | smiletrl |
#30 | drupal-uncustomized_language_strings-1832614-30.patch | 6.85 KB | smiletrl |
#26 | drupal-uncustomized_language_strings-1832614-14.patch | 3.25 KB | smiletrl |
#26 | interdiff-13-14.txt | 1.06 KB | smiletrl |
Comments
Comment #1
Gábor HojtsyComment #2
Schnitzel CreditAttribution: Schnitzel commentedattached a patch which fixes this issue: it does only save the strings if they are actually changed, not just a translation entered.
refactored the whole thing, as there where pretty confusing variable names.
Comment #3
Schnitzel CreditAttribution: Schnitzel commentedxposting
Comment #4
attiks CreditAttribution: attiks commentedPatch looks good, but don't we need a test?
Comment #5
Gábor HojtsyYes, definitely need tests.
Comment #6
Gábor HojtsyAs per coding standard this would need to be "elseif" and on a separate line.
Comment #7
-enzo- CreditAttribution: -enzo- commentedFirst initial version of patch for Simple Test
Comment #8
Schnitzel CreditAttribution: Schnitzel commentedwill finish these tests.
Comment #9
Gábor HojtsyWoot, thanks!
Comment #10
-enzo- CreditAttribution: -enzo- commentedAdding Issue summary template
Comment #11
-enzo- CreditAttribution: -enzo- commentedComment #12
Schnitzel CreditAttribution: Schnitzel commentedComment #13
Schnitzel CreditAttribution: Schnitzel commentednew version:
- fixed "else if" issue.
- added Tests to check that strings are only saved and marked as customized if they are actually changed.
Also patch with tests only, which should fail.
Comment #14
Gábor HojtsyThe proposed patch looks good, I only found one condition I think should be tested and some minor code fixes:
Should be shortened to one line if possible :) Eg.
"Tests that only changed strings are saved customized when edited."
"Query strings..." - no need to talk 3rd person here.
without
I would add a test that it actually shows up on a separate search for customized strings specifically.
"a string in the same format is created" instead of "the same strings are created", since we are only creating one string, right? :)
I can see that this is broken down to an if() and elseif() clause to delineate the two conditions. So maybe adding more docs to the second one, eg. "Newly entered translation." or somesuch would help underline the need for the two blocks of code (instead just one big condition).
Comment #15
smiletrl CreditAttribution: smiletrl commentedSteps to reproduce
Comment #16
smiletrl CreditAttribution: smiletrl commentedhmmm, did I missing something. After I applied this patch, this problem remains. Maybe I need a refresh install to test this?
Comment #17
Gábor Hojtsy@smiletrl: well, the tests were not complete above either, so the fix might not be complete either. I don't think you would need a fresh install, but trying again never hurts :) Your steps to reproduce seem spot on.
Comment #18
Gábor HojtsyBTW I believe @Schnitzel does not have capacity to work on this, so unassigning to make it evident that it is free to take. Need people to work on this :)
Comment #18.0
Gábor Hojtsyupdate Issue with report template
Comment #18.1
YesCT CreditAttribution: YesCT commentedUpdated issue summary remaining tasks to make it easier for people to find a part of the issue to do
Comment #19
YesCT CreditAttribution: YesCT commentedSome of the remaining tasks are novice, some medium (like reviewing the tests to see if they are complete). The tasks do not have to be done in order. This is a good one for a couple people to jump into.
Comment #19.0
YesCT CreditAttribution: YesCT commentedfix html
Comment #20
YesCT CreditAttribution: YesCT commented#13: 1832614-13.patch queued for re-testing.
Comment #21
rkjha CreditAttribution: rkjha commented#13: 1832614-13.patch queued for re-testing.
Comment #22
rkjha CreditAttribution: rkjha commented#13: 1832614-test-only-will-fail.patch queued for re-testing.
Comment #24
rkjha CreditAttribution: rkjha commented#7: 1832614-test.patch queued for re-testing.
Comment #25
rkjha CreditAttribution: rkjha commented#2: 1832614-1.patch queued for re-testing.
Comment #25.0
rkjha CreditAttribution: rkjha commentedUpdated issue summary to help novice people identify what they can do.
Comment #26
smiletrl CreditAttribution: smiletrl commentedSince the past patch failed automated test, I guess a better idea is to seperate the test code from fix code.
This attachment is devided from #13 only to fix the problem, not including test code, and it's been updated according to suggestions at #14.
To test the patch, we will need another fresh installment of drupal8, because it won't have effect on existing records in db. That's why I didn't see it work last time.
Let's see will this patch make drupal robot happy:) Will work on test code later.
Comment #27
Gábor HojtsyWell, the earlier tests looked pretty complete, so I think it is better to start looking if the test had issues, or it properly identified a bug with the fix itself. As opposed to starting to write a new test from scratch... Thanks for picking this up!
Comment #28
smiletrl CreditAttribution: smiletrl commentedThere're some bugs with the test code.
Firstly, before the last two test assertText, there's no search/filter action, like
There should be search/filter action, e.g,
after saving strings and right before assertion.
Secondly, in this issue's case, we need to create more than one translated and uncustomized strings(manually, we import .po file to do this), update one of them as customized, and then search the customized strings. I think we need assertText to find that customized string and assertNoText to make sure uncustomized strings are not saved as customized. This is also what suggested in #14.
Let me try to fix this:)
Comment #29
smiletrl CreditAttribution: smiletrl commentedComment #30
smiletrl CreditAttribution: smiletrl commentedThe first patch is the test code, and of course it will fail. It's been updated according to #29/#28, although there're some tweaks.
In this issue, when save unchanged translation strings, these strings are saved as customized. So
will fail. And the next search will fail too, because this search fails.
interdiff-13-29.txt indicates changes of test code between #13 and #29/#28.
The final patch is the whole patch, including fix code and test code. All these patches work fine in local tests. So, let's see will they satisfy drupal testbot~
Comment #31
Gábor HojtsySending for tests. @smiletrl: thanks!
Comment #32
Gábor HojtsyThe changes look good to me and testing the fixed functionality properly. Thanks!
Comment #33
Dries CreditAttribution: Dries commentedLong variable names, but committed to 8.x. Thanks.
Comment #34
Schnitzel CreditAttribution: Schnitzel commented@smiletrl thanks for jumping in! awesome :)
Comment #35
Gábor HojtsyWoot, thanks!
Comment #36
Gábor Hojtsy@smiletrl: thanks again! If you are looking for tasks on a similar scale #1853720: Hide language selection option is backwards or #1869328: Restore simplicity of language list are very good candidates :) Thanks for helping out :)
Comment #37.0
(not verified) CreditAttribution: commentedUpdate the reporducing steps with new drupal 8 release.