1

For example, i've a array contains string for each elements

$description[] = $discount->short_description;

foreach ($description as $value) { $line.= $value." "; }

the $line will be used in

  $output[$field_name] = array(
    '#theme' => 'field',
    '#title' => $instance['label'],
    '#label_display' => 'hidden',
    '#field_type' => $field['type'],
    '#field_name' => $field_name,
    '#bundle' => $node->type,
    '#object' => $node,
    '#items' => array(1),
    '#entity_type' => 'node',
    '#weight' => $display['weight'],
    0 => array('#markup' => t($line)),
  );

how can i make this $line will appear in admin/config/regional/translate/translate, so i can translate it?

1 Answer 1

1

Clear caches. Then, go to http://example.com/admin/config/regional/translate/i18n_string and hit "Refresh strings" button. This should do it.

Also, t() is known to cause problems if used on variables, not strings directly. But most of these problems affect tools that tries to extract strings into .po files, so there is a fair chance it will work for you. But think twice if you really need a variable there.

If it happens to you that your string aren't recognized by panel, you can use one more method. Write your own .po file. Structure is as follows:

white-space
#  translator-comments
#. extracted-comments
#: reference...
#, flag...
#| msgid previous-untranslated-string
msgid untranslated_string
msgstr translated_string

Repeat this (in one file) for all strings. Create one file per language you want to translate to. Then go to http://example.com/admin/config/regional/translate/import and import your files. From now on, strings will be available for translation in interface.

7
  • should i check the box (Rules Contact forms Fields Node types Menu Taxonomy Blocks) in string refresh admin page?
    – hkguile
    Dec 5, 2013 at 8:39
  • @hkinterview if in doubt, check everything. It doesn't hurt, it'll only make you wait longer.
    – Mołot
    Dec 5, 2013 at 8:46
  • still not apprear in translate panel.
    – hkguile
    Dec 5, 2013 at 8:52
  • @hkinterview answer updated
    – Mołot
    Dec 5, 2013 at 9:01
  • do you know what is the criteria that a string will be appear in admin/config/regional/translate/translate?
    – hkguile
    Dec 5, 2013 at 9:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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