Today we've entered text in content types help textarea.
Finally we realized in l10n_client that these fields can't be translated.
Checking the code we see in i18ncontent_locale_refresh something like:
tt("nodetype:type:$type->type:description", $type->description, NULL, TRUE);
if ($type->help) {
i18nstrings_ts("nodetype:type:$type->type:help", $type->help, NULL, TRUE);
$type->help = '';
node_type_save($type);
}
While the first tt is perfectly normal i don't understand what you're doing with the second.
Finally help text is untranslateable.
Do you have an idea how to improve the situation?
Why don't we simply change the line to the simple tt code the same way as the ones before work?
Comments
Comment #1
nally commentedhaving the same issue. subscribing.
Comment #2
NaX commentedI have just run into the same problem.
I was not sure how things worked as it looks like a few things have changed since I last had to use i18n, so I investigated by walking through the code. I still don't fully understand, but based on what I have learned I think this is a bug.
What I found is that my node help text was being saved into locales_source but not into locales_target for any language so when
i18ncontent_help()tried to display the help texti18nstrings_ts()always returned nothing.What puzzles me even more is that when I search using "Translate interface" page I am unable to find the help text. The name, title and description come up but not help, even though I can find a record for IE: type:page:help in the locales_source table.
I don't fully understand the mechanics of how things work, but should the default help text not be displayed when their is no language.
Comment #3
NaX commentedOk, I think I worked more out.
i18ncontent_node_type()saves "nodetype:type:$info->type:help" using the default and the default language does not seem to get saved to the locales_target table.None of the other node type variables (Title, name, description) get saved using the default language, I don't understand why.
And
i18nstrings_translate_string()returns the passed in string if no translation is found andi18ncontent_help()does not provide a default string.I don't understand why
i18nstrings_translate_string()does not try and select from locales_source when nothing is found. Or maybeChanage the SQL of
i18nstrings_get_string()to use an outer join and then loop through the returned languages. Not as slick but could work.EG:
SELECT s.lid, t.translation, t.language FROM locales_source s LEFT OUTER JOIN locales_target t ON s.lid = t.lid WHERE s.textgroup = '%s' AND s.location = '%s'I hope that all makes sense. Please note that I don't understand the mechanics of it all, I am just throwing suggestions out there.
I really hope somebody proves me wrong and it ends up being some silly config problem so I can move on from this issue.
Comment #4
NaX commentedThe attached patch worked for me. I also made it display the node help in the node type edit form which seemed have the same issue hook_help had.
Comment #5
miro_dietikerThe patch looks very similar to what i thought once (since 6.x-1.5 redesign) would be needed to make this work again.
NaX - can you also confirm - will the field after be available to translate in l10n_client?
Comment #6
NaX commented@miro_dietiker
Yes I can confirm that the help is coming up in l10n_client. The only odd thing is that it is also coming up for the default language. This is the only text coming up for the default language in l10n_client. On all the other langauges every thing works for me as expected.
I think we need to do some sort of check for the default langauge and not to use i18nstrings_ts() when it is the default.
Comment #7
NaX commentedHere is an updated patch. Only 2 things have changed since the previous patch.
In
hook_form_alter()the help source is passed directly to the form instead of passing it throughi18nstrings_ts(). This would then be the same as if the help was stored in the node_type table.In
hook_help()the help source is passed throught()instead of18nstrings_ts().With these changes l10n_client works for me as expected in all languages including the default language.
Comment #8
miro_dietikerNaX - Using t() is strictly forbidden for user entered text. You completely change the mechanisms. (There are enough blog entries out there to read about the t() and i18nstrings() story - former tt().)
Note that i18nstrings has a function to check whether translation for a given language is active.
Just make sure the workflow is correct as for i18nstrings(). This concept has already been validated many times and we've learned a lot to finally do it exactly this way.
Comment #9
j0nathan commentedsubscribing
Comment #10
NaX commentedAn updated patch that uses i18nstrings() instead of t() as per miro_dietiker
Comment #11
boran commented+1
Comment #12
dpatte commentedThis may be a duplicate #793996: Content of 'Explanation or submission guidelines' can't be saved in edit mode.
I have applied the patch from #10 here, and it seems to work for our default language (english) after re-entering our submission guidelines. Havent tested other languages though.
Comment #13
boran commentedI tested the patch in the following context:
In an organic group content type, the field value for ‘Explanation or submission guidelines’ in the ‘Submission form settings’ was being ignored.
cd /modules/i18n/
wget http://drupal.org/files/issues/node_help_source.03.patch
patch -d i18ncontent < node_help_source.03.patch
Then enter the submission help text (in English), and use the Translate GUI to add a German string.
Both English and German strings now appear correctly.
So it worked fine.
When might this patch be rolled in to a dev or new release?
Comment #14
miro_dietikerOK looks fine.
Note that i've removed the function. I was right before removing the helper function.. we won't use it on other places and it only saves one line in two occurences..
I've left it finally.
I've committed it to 6--1 CVS version as attached.
Comment #15
anfrage commentedSorry, it's my first patch ;-)
What do I have to do on a Linux Suse 10 Server to get this work?
I have tried the following:
Downloaded the patch file from above and saved it in sites/all/modules/i18n/i18ncontent. And then
patch i18ncontent.module < i18ncontent_685788_nodehelp.patchresulted in the following error:
Please - can anybody help me? Thank you!
Comment #16
miro_dietikeranfrage, this was a bug which is fixed now. Don't change an issue in its type.
Just use the -dev version and you'll have i18n containing this patch.
There's a great document about handling of patch files.
http://drupal.org/patch
Comment #17
anfrage commentedOh, sorry, meant the type should show the type of only my enter and this surely "only was a harmless support request" and no bug report - my intention was not to push it up too high... ;-)
Thank you very much for your reply!
Comment #19
donquixote commentedsubscribe
waiting for next stable release!
Comment #20
palazis commentedDoes i18n 6.x-1.6 fix this?
Comment #21
dpatte commentedI should mention that the patch fixed this bug for me. But I recently pulled out i18n and replaced it with GTranslate, and the bug is back. Is it possible i18n had made some change that is causing it to re-occur?
I've reopened, because simply disabling i18n has cause the error to recur, and I suspect its related to this issue.
Comment #22
dpatte commentedComment #23
vcrkid commentedComment #24
miro_dietikerdpatte - "needs review" is commonly used to mark patches to review - not questions. Please follow the guidelines.
Closing as this is not the same issue.
Drupal core has several limitations here. We're trying to solve these core issues but there's always much left. However if you finally remove i18n you're back to the core situation and every different (potentially similar) module needs to solve it again on its own way.
Switching back to previous state.
Comment #25
anfrage commentedI have installed Internationalization 6.x-1.7 (within Drupal core 6.16). (In my environment) the problem isn't fully solved:
Now "Explanation or submission guidelines" can be filled for the first time and can be changed as often you want. And now each of the changes takes effect when creating new content. :-)
But when you edit existing content then no text is shown on the top of the page.
Would be very nice if it would be possible to create a new release including a solution for this problem. Thank you very much!
Comment #26
Isostar commentedI use internationalization 1.9 in combo with Drupal 6.22.
When I fill in 'Submission guidelines' (in English) and do "Translate Interface" > "Refresh strings", all Submission guidelines are emptied.
I verified this behavior on a clean install:
- Drupal 6.22
- i18n 1.9, no other languages activated
Comment #27
timos commentedHi
I just posted this issue :
http://drupal.org/node/1230278
i don't know if it can have something to do with the problem talked about here, but i think it's good to have the information in this issue.
Cheers.
Comment #28
tomsm commented#26
I have the problem: When I refresh the strings of the content types all submission guidelines are deleted.
I use the latest version 6.x-1.10.
Comment #29
mroycroft commentedI have the same issue as #26, and #28, where help text is being deleted when refreshing content type strings.
I've attached a patch file to address this issue.
Comment #31
mroycroft commentedNot sure why this is flagged as blocks. Shouldn't this be strings?
Comment #38
mroycroft commentedNot sure why it's not passing simple test. The patch is working great for our site. Feel free to use it if you need it.
Comment #39
joseph.olstad