Skip to main content
Drupal 8

Main navigation

  • Home
    • Question And Answer
    • NEWS
    • Projects
  • Tutorials - Drupal
    • Android
    • Other
User account menu
  • Log in

Breadcrumb

  1. Home

Delete a source string and the target translations in Drupal 8

By editor , 23 December, 2015
Question

How to delete a source string and the translations of this string in Drupal 8 ?

As you haven't a Delete button on interface translation page, you can't do that from the translation interface. But you can do in a small custom module.

Example : Delete string ID 346, 'Home'

      $lid = 346;
      $con = \Drupal\Core\Database\Database::getConnection();
        $con->delete('locales_source')
            ->condition('lid', $lid)
            ->execute();
        $con->delete('locales_target')
            ->condition('lid', $lid)
            ->execute();

Note:

To get the lid,

  1. Goto User interface translation (/admin/config/regional/translate)
  2. Search your string
  3. Right click on the string to delete and click on 'Inspect Element' (On FireFox)
    • You have an ID like id="edit-strings-346-original"
    • The string ID is 346

Tags

  • Drupal 8
  • Code
  • Translation

Comments

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Links

  • Drupal.org
  • Drupal core release cycle
  • Drupal events with ease
  • Unit test with Drupal using PHPUnit (Drupal 10)
  • Tokens for file upload url
  • Tips for Docker
  • CKEditor inline image files usage for custom forms.
  • Install Docker on Linux Mint
  • Install PHP 8.1
  • Drupal Security Best Practices
  • Order and sort items with tabledrag
  • Add a custom service YAML container
  • Apply a patch with composer