Module Description
Development helper for translation management When developing a multilingual site, you might want to add new translatable strings and their translations in a hook_update_N(), hook_post_update_NAME(), Drush's hook_deploy_NAME(), or hook_install().
This module adds a service that can help you with that:
function hook_post_update_NAME(&$sandbox) { $tt = \Drupal::service('translate_tool'); $tt->add('horse', 'da', 'hest'); $tt->delete('horse');' } Or if you prefer a procedural interface (update and install hooks are procedural anyway):
function hook_post_update_NAME(&$sandbox) { translate_tool_add('horse', 'da', 'hest'); translate_tool_delete('horse');' } You can also add a context:
function hook_post_update_NAME(&$sandbox) { $tt = \Drupal::service('translate_tool'); $tt->add('horse', 'da', 'hest', 'my-context'); $tt->delete('horse', 'my-context');' } Using context in a procedural style:
function hook_post_update_NAME(&$sandbox) { translate_tool_add('horse', 'da', 'hest', 'my-context'); translate_tool_delete('horse', 'my-context');' } The default context is used if you don't specify one yourself.
This module adds a service that can help you with that:
function hook_post_update_NAME(&$sandbox) { $tt = \Drupal::service('translate_tool'); $tt->add('horse', 'da', 'hest'); $tt->delete('horse');' } Or if you prefer a procedural interface (update and install hooks are procedural anyway):
function hook_post_update_NAME(&$sandbox) { translate_tool_add('horse', 'da', 'hest'); translate_tool_delete('horse');' } You can also add a context:
function hook_post_update_NAME(&$sandbox) { $tt = \Drupal::service('translate_tool'); $tt->add('horse', 'da', 'hest', 'my-context'); $tt->delete('horse', 'my-context');' } Using context in a procedural style:
function hook_post_update_NAME(&$sandbox) { translate_tool_add('horse', 'da', 'hest', 'my-context'); translate_tool_delete('horse', 'my-context');' } The default context is used if you don't specify one yourself.
Module Link
Project Usage
429
Security Covered
Covered By Security Advisory
Version Available
Production
Module Summary
This module aims to solve the issue of managing translations for multilingual sites by providing a service that allows for easy addition and deletion of translatable strings and their translations in various update and install hooks.
Data Name
translate_tool