Edit String Translation Programmatically
-
I would like to change the translation of a string for a particular language programmatically.
Let’s assume a string has been registered (default EN):
pll_register_string("my_string_domain", "House");
In another part of the code I know the original registered string, the language in that the translation should be changed and the translation.
$originalLang = "en"; $original = "House"; $targetLang = "de"; $translation = "Haus";
I’ve looked through the API and could not find any matching function, except of “pll_save_term_translations”. But that one is working with an associative array of “lang_code” => “term_id”. Since the translation is new, it has no “term_id” yet. So I cannot use it in this case. Maybe, someone has an idea for another approach to this problems?
Best regards,
ronhard.
- The topic ‘Edit String Translation Programmatically’ is closed to new replies.