Last active
November 15, 2018 09:48
-
-
Save flesheater/46f85dd7e00bf3f56db2db25a769483b to your computer and use it in GitHub Desktop.
Load translation string
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
$locale_storage = Drupal::service('locale.storage'); | |
$f_name_string_source = $locale_storage->getStrings(['source' => 'First name'], []); | |
if (!empty(reset($f_name_string_source))) { | |
$f_name_string_source = reset($f_name_string_source); | |
$f_name_string = $locale_storage->getTranslations(['language' => 'ro', 'lid' => $f_name_string_source->lid], []); | |
if (!empty(reset($f_name_string))) { | |
$f_name_string = reset($f_name_string); | |
if (!$f_name_string->isNew()) { | |
$f_name_string->setString('Prenume')->save(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment