0

I am trying to get a default value loaded programmatically into every body field when we add translate from english, but it doesn't seems to work using form overwrite fields

I tried using $form[][] = 'value'; but not working

as I also unable to pull the default value that is already set via field_translations.

I used form_alter for the options

can anyone please point me some clue of which method I used for the custom module

thank you!

2 Answers 2

1

eventually, I fixed it myself by using the hook form alter and custom db_query to load the locales tables and then match the LID to get the source and target language and then manually overwrite the default language for every new translated language.

so my problem is solved, thank you guys for helping out.

0

If you are using Internationalization Module for translation, then using Synchronize translations Module you can do it.

From project page

The Synchronize translations module, part of the Internationalization (i18n) package, allows you to synchronize fields and other node elements across translations of a given node. This is available for content types where multilingual support, with translation, is enabled.

3
  • not quite working, because I am using multilingual with field translation, and I made the body default value for each language will have its own default value, the problem is that when adding new translation the default value for the new language is not loading the default "translated language value" instead its loading the "english default language"
    – Boby
    Oct 17, 2015 at 11:00
  • in hook_form_alter() are you getting any attributes of orginal node(like nid, any reference) that help to load orginal node ..???
    – Abin
    Oct 17, 2015 at 11:06
  • I get the original node translated one, but the default value per language are not respecting, its always defaulting to english, that is why I wanted to load the field translation and overwrite the body content but that doesnt seem possible in the add translation form
    – Boby
    Oct 17, 2015 at 11:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.