I am using Drupal commons. I am using I18n and other related modules for my website as it is created in English but is being used in French also. I am using translations provided. My issue is that I have string translations but for some strings, text is not being translated, although the translations are available in the drupal. enter image description here

UPDATE After going through code, I found that this "Request Message" field is not a normal form field, but it is being rendered using

     field_attach_form('og_membership', $og_membership, $form['membership_fields'], $form_state);

The issue is with this "field_attach_form()". Do ANYONE have any idea what can be done for this??

  • Which strings? The first step is to isolate where the strings that are not being translated are being provided from (are they hard-coded into a module? added through the Views UI? etc.) Nov 6 '15 at 14:04
  • those strings are mostly hardcoded in modules.. those are mostly GUI options, like I am using Organic Groups and there is registration for the groups. In add-user page of group I have fields, some are getting translated while some are not, like request message field label and description is not getting translated
    – Dev
    Nov 6 '15 at 16:39
  • I hope you getting what I mean or I will attach a screenshot soon
    – Dev
    Nov 6 '15 at 16:40
  • Try refreshing strings and clearing caches. Nov 6 '15 at 16:58
  • yes I tried that too but nothing worked
    – Dev
    Nov 6 '15 at 16:59

Although I know this solution is not best and structural method and is better solve this issue but sometimes we just need a solution and want save the time(maybe it be some issue with commons distributes.
Sometimes I do this trick in some projects

if you want translate all keystring in every where use

 $('body').html( $('body').html().replace(/keystring /g, "TranslateString"));

and also if you want only some specified(with specified class and page class) string use

$('.checkout-review .field-name-phone-mobile .field-label').html($('.checkout-review .field-name-phone-mobile .field-label').html().replace(/keystring /g, "TranslateString"));

You just need put one of them in JS file.

  • Yes, this solution is not best, but din't get any other solution, so have to use this only. Thanks, it was quick trick, accepting your answer.
    – Dev
    Nov 24 '15 at 6:22
  • @Drupaler your welcome, I know this is not best solution but sometimes we should save our times ;)
    – Yuseferi
    Nov 24 '15 at 7:08

Drupal's language translation can be hit or miss sometimes. Often times its silly little pieces like the part that you mentioned that dont get translated while 95% of the rest of the page translate without issues. Google to the rescue!! I recommend the Gtranslate module to get you started and of course you can place the google translate api directly into a tpl or module file to get the full monty!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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