How can I translate a taxonomy term programmatically in drupal 8? I found how to get the translated taxonomy term programmatically? but this is only related to d7.

2 Answers 2


In D8 you can translate entities with addTranslation().

This is an example for a taxonomy term:

$term->addTranslation($langcode, [
  'name' => 'translated term',

You can provide values for all translatable fields in the array.


Based on using the i18n API from other modules, the code should be the following one.

$term = taxonomy_term_load($tid); 
$translated = i18n_string_translate("taxonomy:term:$tid:name", $term->name);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.