Closed (fixed)
Project:
Internationalization
Version:
7.x-1.x-dev
Component:
Strings
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Jun 2014 at 17:20 UTC
Updated:
20 Dec 2022 at 16:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
espurnesHave you cleared the cache?
Have you refreshed the strings?
Comment #2
sicher commentedyes, i did both.
and it works with another content type as expected.
but i noticed:
but when clicking on "translate" the english version is shown and not the german:
Comment #3
sicher commentedSuccessfully refreshed 135 strings for Fields-> translate: E-Mail-Adresse
save -> okay
Successfully refreshed 135 strings for Fields-> delete cache
Comment #4
jasom commentedAfter string refresh it deleted also strings which were used and usefull:
Some translation of field names (labels) was deleted. It's a bug.
Comment #5
joseph.olstadPlease try the latest release 7.x-1.14
and if that doesn't resolve:
please try the latest dev 7.x-1.x-dev which is ahead of 7.x-1.14
make sure to run update database (drush updb if you use drush)
Comment #6
joseph.olstadmight be a configuration issue as well. Is this node translation or entity translation?
Comment #7
Garuggi commentedI'm facing the same issue.
I tried what Joseph said but it didn't work.
I noticed that in the first time that i refresh the string if the box "Clean up left over strings." checked it didn't remove my translation. It only remove my translation in the second time that i refresh the string with the box "Clean up left over strings." checked.
First Refresh:
- Performing cleanup for text group field, deleting 3057 left over strings.
- Successfully refreshed 4693 strings for Fields
- Deleted 3057 left over strings.
Second Refresh:
- Performing cleanup for text group field, deleting 1 left over strings.
- Successfully refreshed 4693 strings for Fields
- Deleted 1 left over strings. (This 1 string couldn't be deleted. It was translated)
Comment #8
joseph.olstad@Garuggi,
what module / label / entity type / field / are you having trouble translating?
Did you make sure the t() function is called for the label (in the code) and appropriate substitutions for variables.
also, is this a string in Javascript , if so, are you using the Drupal API to handle /insert your javascript (the t() function is available in javascript if you're correctly using the drupal api)
with your description, need more details
Comment #9
joseph.olstad#2829507: String refresh deletes field translations is possibly a duplicate of this issue. Not sure
Comment #10
joseph.olstadConfirmed bug, needs work
Comment #11
geek-merlinJust a quick note where i think the problem lies:
In i18n_field.i18n.inc:47 we have title, description and default_value:
While in i18n_field.inc:145 we only have default_value ("only for text types" seems reasonable).
So on string refresh titles and descriptions are deleted.
Fiddling together the 2 missing lines might make it work...
Comment #12
geek-merlinComment #13
geek-merlinCopied better summary from the dup.
Comment #14
Garuggi commentedI just found a similar bug that we had some years ago with the form fields. It may gives some clue for this current bug. https://www.drupal.org/node/1483942
Comment #15
Garuggi commentedHey guys any updated here?
Comment #16
rudi teschner commentedI have the problem as well. I first started to suspect Token module, but a relevant patch is already in version 1.7.
No matter what I do I cannot preserve the translations I've exported using features translations, but strangely not every installation is effected. While it works on one installation, on two others it's stating that "Source string not found" when I use the translation UI.
Another strange thing ... some descriptions are working. Example: 4 content types with the same field (i.e. title_field): article, teaser, event and topicpage. While description seems to work for the latter 3, its always lost for the first one.
Its not limited to title field. Same happens for entity reference fields, text fields, paragraphs field, lists, an so on.
Comment #17
joseph.olstadIf we can get detailed instructions on how to consistently repeat this observed behavior in a test environment then we can more easily find a solution. What language mode is the administration interface in when the translations are captured in a feature? And what language is the administration interface in when the strings are refreshed, not sure if that makes a difference.
The more detailed the steps the better. I have started making drush make files to capture core version, patches, contrib module and versions and patches and also libraries. For an example drush make for drush version 7.x or drush 8.x see my sandbox project bolstrap. In my project I have a make file in there.
So detailed steps, suggesting a make file with all dependences, then configuration, capture it in a feature and upload it to this issue.
Comment #18
joseph.olstadLikely is NOT an issue with the i18n module.
See a fix for an implementation of i18n_string
#1483942: String translations are being deleted on "Refresh strings"
I18n_string is provided by i18n
Comment #19
joseph.olstadComment #20
joseph.olstadActually, might be worthwhile making a patch based on #11 and running it through a simpletest
Comment #21
robertom commentedHi, sorry for my bad english.
This is the steps for reproduce the error.
Install:
- Drupal
- Field translation
- Menu translation
Go to admin/config/regional/language and
- add a language
Go to admin/config/regional/translate and
- take a note for the total number of strings for the fields and for the menus
Go to admin/config/regional/translate/i18n_string and
- select fields and menu
- select "clean up left over strings"
- refresh strings
Go to admin/config/regional/translate and
- check that the total number of strings has not been changed
Go to admin/config/regional/translate/i18n_string and
- select fields and menu
- select "clean up left over strings"
- refresh strings
Go to admin/config/regional/translate and
- you can see that the fields strings now are 0/0
To restore the original situation, go to the admin/config/regional/i18n/strings page and
- select "Text group handler default." for all text group in the fieldset
- save configuration (you need to save also if the radiobutton was "Text group handler default."... is needed for set some variables)
Go to admin/config/regional/translate/i18n_string and
- select fields and menu
- select "clean up left over strings"
- refresh strings
Go to admin/config/regional/translate and
- you can see that the fields strings now are 0/[original value]
To break even the menu strings (or other textgroups) go to admin/config/regional/i18n/strings page and:
- select "Text group handler which include persistent caching." for all text group in the fieldset
- save configuration
Go to admin/config/regional/translate/i18n_string and
- select fields and menu
- select "clean up left over strings"
- refresh strings (now we have populated the cache... is needed another refresh for break the strings. so...)
- select fields and menu
- select "clean up left over strings"
- refresh strings
The problem seems to be on the i18n_string_textgroup_cached class.
The difference in behavior between fields and other text groups is caused by different default values until you go to the admin/config/regional/i18n/strings page and save (even without modifying anything)
Attached a patch that standardizes the behavior between fields and other textgroups, making it work by default.
Unfortunately now I have no time to investigate the problem due to the selection of "Text group handler which include persistent caching."
Comment #22
robertom commentedI have closed the following issues #3034388: Refresh and cleanup strings removes all source strings #2801873: After string refresh module deleted also strings which were used and usefull: as duplicates of this issue
Comment #23
robertom commentedComment #24
durifal commentedI have the same problem, debug it and whole problem is that after updating translated strings, textgroup field cache is not reset. That is why it behave strange and it looks that some translated strings has been lost (but they appear correctly after clear cache).
I have tested patch submitted in #21 and it fixed the issue, but I think better approach is to add cache reset for field textgroup after translation update. So I attach the patch with this change.
Comment #25
klausiThanks, looks good to me! Just one minor comment nitpick, but can be fixed on commit.
Comments should end with a dot.
Comment #28
joseph.olstadThanks everyone for the fix, this has been an annoyance for a long while and good to be fixed.
Comment #29
joseph.olstadHere you go,
https://www.drupal.org/project/i18n/releases/7.x-1.32
thanks for the reviews and the patience!