1

I'm new to Drupal and a little bit confused.

I want to make entity_types translatable by using the i18n module. Content types are already perfectly translatable, but I couldn't find out how to duplicate that. I managed to use the hook_i18n_string_info() to kind of register entity_type to the translation module this way:

$groups['entity_type'] = array(
  'title' => t('Entity Type'),
  'description' => t('Translatable entity types'),
  'format' => FALSE,
  'list' => TRUE,
);

When I do this, under "Administration -> Configuration -> Regional and Language -> Translate Interface -> Overview" I now see the column "Entity Type" with "n/a" at the target language and "0/0" at the default language.

After switching to the tab "translate", under "Limit search to" I can select "Entity Type", but nothing is found (the message "No strings available." is displayed).

After switching to the tab "strings", I can select "Entity Tape", but after clicking on "refresh strings" it says "Cannot refresh strings for Entity Type." (5/5 items were processed, I suppose these are the standard entity types?!).

What I tried so far but without any effect was the hook_i18n_object_info():

$info['entity_type'] = array(
  'title' => t('Entity Type'),
  'class' => 'EntityType',
  'key' => 'id',
  'base path' => 'admin/structure/entity_type/edit',
  'placeholders' => array(
    '%entity_type' => 'name',
  ),
  'edit path' => 'admin/structure/entity-type/%entity_type/edit',
  'translate tab' => 'admin/structure/entity-type/%entity_type/translate',
  'string translation' => array(
    'textgroup' => 'entity_type',
    'type' => 'type',
    'properties' => array(
      'label' => t('Label'),
    ),
    'translate path' => 'admin/structure/entity-type/%entity_type/translate',
  ),
);

I did not find anything useful about this topic but this link: http://hojtsy.hu/blog/2011-jun-01/challenges-satisfy-translation-needs-drupal-and-how-do-you-code-it-now

I frequently emptied the cache with "drush cc all" and used "drush fra" also.

Thanks in advance!

Your Answer

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

Browse other questions tagged or ask your own question.