New answers tagged


Click "Add" on "Filter Criteria" on the left column. Then add a filter called Content: Translation language and set it to Content language selected for page


To get the path alias of specific language try with: $current_lang = \Drupal::languageManager()->getCurrentLanguage()->getId(); /** @var \Drupal\Core\Path\AliasManager $aliasManager */ $aliasManager = \Drupal::service('path.alias_manager'); $alias = $aliasManager->getAliasByPath('/node/10', $current_lang); If you want to get the language code ...


I was finally able to trace the problem. The migration code was expecting a value for the key nid. I was able to provide the appropriate value by overriding the function prepareRow. Here is the code I used in both MyMigrate.php and MyMigrateFr.php: /** * {@inheritdoc} */ public function prepareRow(Row $row) { $nid = $row->...


You can easy translate view header and footer text using the {% trans %} Twig tag in Drupal 8 Example: {% trans %} Text for translate {% endtrans %} And after that you will be able find text in user interface translation "admin/config/regional/translate"


It can take quite a while until you get all the naming correct. For people struggling with this, we've published a module with a working example here: This module provides an example of how to create a configuration form in a custom module and make it translatable out-of-the-box.


There are two possible translation methods for a base field, interface translation and configuration translation. Base fields are defined in code and translated by t(), which gets the translatable string from the core interface translation table. $translatableMarkup = t($label, [], ["langcode" => $langcode]); //optionally, render to string $...


One thing to also watch out is using $this->t or t() function on the method that is accepting string and than translating that string by default. Meaning, we are trying to run the string trough t() function twice. For example: $route->setDefault('_title', $this->t('some string')). No need to use t() function here because '_title' string is ...

Top 50 recent answers are included