translation

Translate

<h1>{{ 'Hello world'|t }}</h1>
<div class="mt-3 alert alert-warning">
    <p>{% trans %}Do you know how translation works?{% endtrans %}</p>
</div>

Using translate function with parameters:

{{ 'Last checked: @time ago'|t({'@time': time}) }}

 

 

{{ "Text to translate"|t({}, {'context' : 'Context name'}) }}

and

Fix translations for Drupal 9

$connection = \Drupal::service('database');
$connection->update('locales_target')
  ->fields([
    'customized' => 0,
  ])
  ->execute();

$connection->delete('key_value')
  ->condition('collection', 'locale.translation_status')
  ->execute();
$connection->update('locale_file')
  ->fields([
    'timestamp' => 0,
    'last_checked' => 0,
  ])
  ->execute();
 
Subscribe to translation