Needs work
Project:
Static field
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Mar 2013 at 15:28 UTC
Updated:
23 Mar 2020 at 20:03 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
zeppelinstudios commented@boran
Have you managed to find a solution?
Comment #2
boran commentedI didn't use this module, just used a node.tpl to solve the issue :-)
Comment #3
claudiu.cristeaStatic field works as expected and it doesn't have to be translated. If you still need translation, you are free to use the PHP code filter.
t()function and return it withreturnstatement -- everything inside<?php ?>tags.Comment #4
boran commentedEr, enabling the php is a drastic measure. It increases the security risk. I would not recommend that as a workaround.
Comment #5
claudiu.cristea@boran, I assume that users having access to configure fields know what they are doing. So, you should control who's able to use the PHP filter and who's able to administer fields.
Comment #5.0
claudiu.cristeaUpdated issue summary.
Comment #6
stolzenhain commentedA good way to resolve this is to rely on the Language Sections module which can handle several languages in the same input text – given you have a multiline textfield. It's much safer and faster than the aforementioned solution.
I agree though that it would be cool if these fields could be registered for the i18n module.
Comment #7
jimmyko commentedPHP filter is a really bad practice. I patched the module to make it work with i18n_string(). Hope it may help someone who looking for the similar thing.
@claudiu.cristea Please consider to commit it for enhancing the module. Thanks
Comment #8
jimmyko commentedI added the missing quotes for string and handled the deletion of translation set.
Comment #9
jimmyko commentedI realized that adding translation in form submit is not a good idea. I changed it into a more robust way.
Comment #10
jackalope commentedThanks for the patch, jimmyko! I've applied it but I still can't figure out how to translate the "Static field content;" it doesn't show up when I translate the interface (
/admin/config/regional/translate/translate). Where does the actual translation take place with your patch applied?Comment #11
jimmyko commented@jackalope
It would show new item on translate interface, but you have to load the page which contains the static field, which will add the string to translate interface for translation.
Comment #12
adinac commentedComment #14
Sriparna Khatua commentedComment #15
Sriparna Khatua commentedComment #16
noah commentedThe patch here didn't work for me, it actually caused the static field to stop appearing entirely in any language. In case it's of use to anyone, I worked around the issue by preprocessing static fields in a custom module and wrapping the markup in t() there:
Once this is in place, the contents of the static field should be translatable like any other string. The drawback of this approach is that if the text of the field is ever changes in the source language you'll have to go back into string translations and translate again, but it seems like the least heavy-handed workaround for this issue.