Created
July 23, 2014 15:36
-
-
Save citlacom/10ff1b4cb6566c7f2572 to your computer and use it in GitHub Desktop.
Programmatically set strings translations in hook_update_N()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_update_N(). | |
*/ | |
function hook_update_N(&$sandbox) { | |
$report = array( | |
'skips' => 0, | |
'updates' => 0, | |
'deletes' => 0, | |
'additions' => 0 | |
); | |
$translations = array( | |
array( | |
'src' => 'What is PayPal?', | |
'tr' => 'Was ist PayPal?', | |
'lc' => 'de', | |
), | |
array( | |
'src' => 'What is PayPal?', | |
'tr' => '¿Qué es PayPal?', | |
'lc' => 'es', | |
), | |
array( | |
'src' => 'How PayPal works', | |
'tr' => 'So funktioniert PayPal', | |
'lc' => 'de', | |
), | |
array( | |
'src' => 'How PayPal works', | |
'tr' => 'Cómo funciona PayPal', | |
'lc' => 'es', | |
), | |
); | |
foreach ($translations as $tr) { | |
_locale_import_one_string_db($report, $tr['lc'], '', $tr['src'], $tr['tr'], 'default', '', LOCALE_IMPORT_OVERWRITE); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment