Questions tagged as ['i18n-l10n']

Use it in questions about adapting software to different languages, regional differences, and requirements of a target market (locale).
Score: 0
bigboy avatar
How to get language prefix in URL for terms without translation?
gu flag

I have a multilingual website with taxonomy vocabulary, which terms are not translatable (company names).

But each term has translated meta tags and paths, depending on the selected site language.

For example, term paths:

  • /vocab-name/term-name (default, english)
  • /de/vocab-name/term-name
  • /es/vocab-name/term-name
  • /it/vocab-name/term-name
  • etc

I can access all of them, metatags are displayed in the c ...

Score: 0
Drupal 9 core multilingual: cannot translate main navigation menu - button translate missing on menu items
cn flag

I'm trying to catch multilingual features of Drupal 9 and have wamp64 local development server and clean Drupal 9.2.8 install.

I've enabled 4 multilingual core modules:

  • Configuration Translation,
  • Content Translation,
  • Interface Translation,
  • and Language.

Two languages enabled: en and ru.

I'm trying to translate Main Navigation Menu, but menu items don't have a "translate" button along with "edit" ...

Score: 1
How to translate the layout builder blocks of a node programmatically?
kr flag

I am translating the nodes programmatically. Everything works fine except the layout builder blocks.

When I try to translate it, it also changes on the source node.

I have created a node in language en. Now I am translating it to nl. Here is my code.

if ($node->hasTranslation($language)) {
  $translated_entity =  $node->getTranslation($language);
else {
  $translated_entity =  $entity->a ...
Score: 1
Sarah C avatar
URL aliases for non-translated content types revert to /es/node/nid in menu
za flag

I have Content Translate enabled and enabled translation on only our Projects content type. I've placed the Language switcher block on a Projects view and Project node page. This is working just fine.

My problem is, if I use the Language switcher on the Projects view for Project page, then click a link in the main menu to a pieces of non-Project content, the path has changed to /es/node/1 when it should ...

Score: 1
Giuseppe avatar
How get webform translations programmatically?
br flag

I'm on Drupal 9. I need to load the options labels of a Webform's option programmatically.

So far, I've managed to load the labels:

  $element = $webform_submission->getWebform()
      ->getElement($element_key, TRUE);

  $option_text = WebformOptionsHelper::getOptionText($element_value, $element['#options']);

However, I also need to get those labels for both the language of the site - en and

Score: 1
Machine-translate a node by menu link
cn flag

I have an "About us" main-navigation menu link.

I want to create several other main-navigation menu links, in languages other than English, which will link to that very webpage, for example:

  • เกี่ยวกับเรา (about us in Thai)
    • If the user clicked that link, the destination would be the same "About us" webpage, but the content would be machine-translated to Thai.

The English cont ...

Score: 1
How to add link to translated content in text field
cn flag

I need some help on a multilingual D9 site, trying to add links to translated node in text field. In German version should be a link to the English and French version of this node, as part of the node content.
And I need them absolute, because the nodes are used as newsletter content:
I created link with language part in url, but when I view the node, the links are re ...

Score: 0
Geat avatar
Multi-lingual Webform, not entire website
de flag

Our client does not need their entire website to be translated into multiple languages. However, they have a webform that provides a number of different languages in a dropdown, and would like the form labels to be displayed in the chosen language.

Creating multiple versions of the form would be a maintenance headache. Is there a way to tap into Webform and Drupal's localization facilities withou ...

Score: 0
Setting a domain on URL language detection configuration creates an error
in flag


I selected the "domain" option, and set my english to and my french to When I saved the page, I got the error, "Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it."

Even though I got that error, it seemed as though the pages were redirecting to the french domain,  ...

Score: 0
quantumized avatar
How can I get a list of all languages translation that a node has?
ng flag

I'm trying to get a list of language translations that a node has in theme_preprocess_node(). I have the node object and can check for a translation on a one-by-one basis, if I have the list of languages. What I need is a list of all the translations for the node.

Score: 0
zapico avatar
View with translation not working as expected
cn flag

I have a view that filters content (films) by category and it works as expected.

I've added a new language to the site and some categories are not applied in both languages to the same content, but the view returns all the films that have that category in the main language, even if it doesn't have that category in current language.

For example, if I have a film with these categories in English:

  • S ...
Score: 2
Baud avatar
Translation of a multilingual site into English
sa flag

Note: This question is only focused on strings inside source files (PHP files).

When you are creating a Drupal site in a non English country (let say France), you will create all your PHP files with French strings inside.

After that, you can translate this site, let say in Dutch. You will extract PO files, send them into translation an re-import them.

Until this point, everything is fine.

Now, your client ...

Score: 2
Jaypan avatar
How do I create multilingual user path aliases?
de flag

I'm setting up a multilingual site, and I need the user path aliases to be multilingual.

Users are set up as translatable: User Translation Configuration

Language Detection: URL (path prefix)

  • English: /en
  • Japanese: No prefix

Pathauto patterns:

  • English: /en/users/[user:name]
  • Japanese: '/users/[user:name]

Pathauto Patterns


  • Username: Admin

Expected paths:

  • English: /en/users/admin
  • Japanese: /users/admin


  • English: /en/user/1
Score: 1
Shakil Ahmad avatar
Generate same Path aliases for multi languages
ar flag

I have a content type Products. A pattern is defined via the Pathauto module for product CT. but my issue is that when I translate an entry/node it generates a translated path alias for Urdu in Roman-English(Urdu in English alphabet) But the spellings of that path are meaningless. When I uncheck "Transliterate prior to creating alias" It generates the aliases in pure Urdu which is unacceptable in my  ...

Score: 2
rickdenhaan avatar
How to use a module-relative path to translations in .info.yml
id flag

I'm new to using Drupal and am building a custom module to learn how it all works.

I'm building my module in modules/custom/my_module. I have a Dutch locale file in modules/custom/my_module/translations/

If I specify it like that in my .info.yml file, it works great:

name: My Module
description: Just testing
version: 0.1
package: Custom
type: module
core_version_requirement: ^8.8 || ^9 ...
Score: 1
sonfd avatar
How can I tell, in hook_form_alter(), if a node form is for the node in its default language or a translation?
in flag

I'm implementing hook_form_BASE_FORM_ID_alter() in a custom module. I'd like to know if my form is for the node in its default language, or a translation of that original node.

Score: 2
sonfd avatar
In the context of a multilingual site, what is considered "interface text" and what is "content"?
in flag

On the Language Selection and Detection configuration page (in the toolbar, Manage > Configuration > Regional and language > Languages > Selection and Detection), I see that I can detect and set "Interface text language" and "Content language" differently. But I don't see a clear definition of those terms anywhere.

I have a hardcoded heading within a node template:

<h2>{{ "Hello worl ...
Score: 0
Alimba avatar
How to translate content but not backend interface?
in flag

I'm trying to set up an English administrator back-end and a URL based front-end (anonymous user content) translation. I follow a guide on the subject, but I haven't been able to achieve what I wanted.

I also tried to set up /admin/config/regional/language/detection using various combinations of settings, but either I have the back-end in English along with the rest of the site, or everything is  ...

Score: 0
Rog Boy avatar
get translation programmatically of field value in specific language
ma flag

I have created a content type (pdf_form) to which I added a field_gender_languagetest with two options, male and female. I translated both the options in German using the translation tab.

Now I am generating a report of the data filled by users using that content type.

Is there any way to programmatically get that translation?

I am trying this code, but it doesn't work.

t('male', array(), array('langcod ...
Score: -1
Rog Boy avatar
Custom translation function
ma flag

I need own translation function in my custom module where i have defined language codes ('en','ja','de'....etc) Now i just wanted to pass word and language code as a parameter and it returns translation of that word according to language code.

I am trying this inside my translation but it doesn't work it is returning 'yes' instead i don't know why.

 $japanese_value = t('yes', array(), array('langcode' ...
Score: 1
hank avatar
Error when updating translated content
mx flag

I have fought for some time with the error below:

Non-translatable field elements can only be changed when updating the original language.

I have "inherited" a site a few years ago and been updating it so it's D8 up-to-date (8.9.16).

When the user tries to save a change in language version of a page (on many but not all pages), she gets the aforementioned error message (even if not changing anyt ...

Score: 0
Roi1001 avatar
How to export view's translation?
cn flag

I used view translate(/admin/structure/views/view/my_view/translate) to translate a filter's label and saved. When I refreshed the view, it worked. Then I went to /admin/config/regional/translate/export page to export the same language's translation, including customized and non-customized, as .po file. But I couldn't find the translation I made in the file.
So how should I export the view's transla ...

Score: 0
miststudent2011 avatar
How do I install Drupal with multiple custom languages using drush?
fr flag

I know I can install a new Drupal web site with single custom language using:

$ drush si standard \
    --db-url='mysql://[db_user]:[db_pass]@localhost/[db_name]' \
    --account-name=admin --account-pass=secret\
    --site-name=Example \ \

Similarly how can I pass multiple languages to locale key ?


doesn't work neither doe ...

Score: 0
Content Translation installation breaks the website (statistics module error + aliases not taken into account)
in flag

First, I would like to say I am a total noob in Drupal and PHP but possess some knowledge on other web frameworks/languages).

Here is my path to the errors:

I used the UI to install Content Translation and Configuration Translation modules from the multilingual core (other 2 modules were already installed).

This did not work properly as it totally broke the website:

  • aliases not respected (from "/co ...
Score: 0
Usman Manzoor avatar
Translating Menu Item Programmatically?
pk flag

I have been trying to translate menu items programmatically but upon saving it just adds the english field value to all my translations. Below is the code I am trying to execute:

 if ($entity->hasTranslation($language->getId())) {
      //For update
    try {
      $entity->addTranslation($language->getId(), ['title' =&gt ...