Forked from citlacom/strings_translations_hook_update_N.php
Created
October 4, 2018 15:00
-
-
Save BramDriesen/b72b401c0503f0db48e0b52e4d010ece 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