Questions tagged [i18n-l10n]

Use it in questions about adapting software to different languages, regional differences, and requirements of a target market (locale).

Filter by
Sorted by
Tagged with
1 vote
0 answers
29 views

URL aliases for non-translated content types revert to /es/node/nid in menu

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. ...
  • 470
1 vote
2 answers
417 views

How get webform translations programmatically?

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() ->...
  • 655
1 vote
1 answer
36 views

Machine-translate a node by menu link

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: ...
  • 17
1 vote
1 answer
216 views

How to add link to translated content in text field

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 ...
  • 147
0 votes
1 answer
25 views

Multi-lingual Webform, not entire website

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 ...
  • 433
0 votes
1 answer
383 views

How can I get a list of all languages translation that a node has?

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 ...
  • 1,093
2 votes
2 answers
147 views

Translation of a multilingual site into English

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 ...
  • 448
2 votes
1 answer
141 views

How do I create multilingual user path aliases?

I'm setting up a multilingual site, and I need the user path aliases to be multilingual. Users are set up as translatable: Language Detection: URL (path prefix) English: /en Japanese: No prefix ...
  • 16.4k
1 vote
0 answers
22 views

Generate same Path aliases for multi languages

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-...
2 votes
0 answers
219 views

How to use a module-relative path to translations in .info.yml

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/...
1 vote
1 answer
53 views

How can I tell, in hook_form_alter(), if a node form is for the node in its default language or a translation?

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.
  • 7,472
2 votes
0 answers
59 views

In the context of a multilingual site, what is considered "interface text" and what is "content"?

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 ...
  • 7,472
0 votes
1 answer
57 views

How to translate content but not backend interface?

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....
  • 105
0 votes
0 answers
138 views

get translation programmatically of field value in specific language

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 ...
-1 votes
1 answer
53 views

Custom translation function

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 ...
1 vote
4 answers
3k views

Error when updating translated content

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 ...
  • 27
0 votes
0 answers
29 views

Content Translation installation breaks the website (statistics module error + aliases not taken into account)

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 ...
  • 1
0 votes
1 answer
391 views

Translating Menu Item Programmatically?

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->...
0 votes
2 answers
100 views

Language switcher block is different on remote site

I'm working on a multilingual site and on my local version of the site I added the default language switcher. It show like this: <div class="language-switcher-language-url block block-language ...
  • 1,058
1 vote
0 answers
257 views

How translate custom email programmatically?

I'm on a D9 Site. I've created a module, where I define a hook_mail, a hook_theme and a preprocess for swiftmailer twig: function my_project_breakout_rooms_theme() { return [ '...
  • 655
1 vote
2 answers
566 views

Translate tab missing

I am working on my first multilingual Drupal 9 website, and I face a challenge. I can't seem to get my contact webform elements translated. I am using Webform Version: 6.0.2. I have enabled ...
  • 63
0 votes
0 answers
94 views

translatable content: how to set default original language

I've a D9 site, configured with two languages: Italian (default) and English. Some content types of the site are translable, the configuration under admin/config/regional/content-language for them is ...
  • 655
0 votes
1 answer
367 views

Programmatically add a translation with proper content moderation state

I am trying to add a node translation programmatically when a node is created (using hook_ENTITY_TYPE_insert). My code works fine except that the translation doesn't really have a content moderation ...
  • 33
1 vote
1 answer
119 views

How to allow user to manually change language when using "Browser" Detection as a detection option?

We have a site with multiple languages and have been using the Language Switch Dropdown menu to allow users to change languages on the site. But when we add "Browser | Language from the browser's ...
  • 1,093
1 vote
1 answer
454 views

How to print the paragraph field translation value in twig template

I am trying to access the nested paragraph field inside my twig template. {% for items in item['#paragraph'].get_aw_title_details%} {{ item.entity.field_award.value }} {% endfor %} When I am using ...
4 votes
1 answer
66 views

What is the difference between Translation language, Translation source, and Original language?

Would anyone be able to explain to me what the difference is between "Original language", "Translation language", and "Translation source"? I think I have a pretty good ...
1 vote
1 answer
265 views

Disable menu link for certain languages

I'm looking for a way to disable a single link in a menu for a certain language. From my understanding with similar issues, I'd like to activate translation for the menu link field Enabled since this ...
  • 11
1 vote
1 answer
145 views

Create link to node in specific language

So I need to create links to specific translations of a node but am having issues. This is my code: foreach($entities as $entity) { $urls[] = Url::fromRoute('entity.node.canonical', [ 'node' =&...
  • 348
1 vote
1 answer
61 views

Editing a node deletes body content reproducibly if Locale module enabled

I am experiencing a pretty serious problem leading to data-loss in D7. Editing any existing node leads to empty body content and newly created nodes have no body content whatsoever. Update: The error ...
  • 381
2 votes
0 answers
40 views

At creation time, why are shortcut titles translated, but menu link titles are not?

The idiom that the community points to for creating menu links usually looks like this (from \Drupal\Tests\language\Functional\LanguageSwitchingTest::testLanguageSessionSwitchLinks()): // Add a link ...
0 votes
0 answers
155 views

How can I delete a field translation in node?

I am using a complicated melange of paragraphs with asymmetric translation, and in a few my nodes there is a stubborn translation that somehow is stuck. Its a node that used to be translated, but then ...
  • 41
4 votes
0 answers
336 views

Configuration export via drush randomly change the value of labels\other content in multilanguage sites

I've a multilanguage site, with Italian set as default and English as secondary language. When exporting the configuration via drush - drush cex command - sometimes the labels of other kind of content ...
  • 655
0 votes
1 answer
110 views

How to use addTranslation() on an entity's multi-value paragraph?

I'm trying to programmatically update a multivalue paragraph field and add a translation. In the code below field_product_description is the paragraph's field that I'm updating and ...
  • 1,093
0 votes
0 answers
48 views

How can I create a Node Paragraph's image translation programatically?

I'm trying to create a translation on a node's paragraph field whose paragraph contains a text field and an image field. The code below updates the text field as expected but the image field is always ...
  • 1,093
3 votes
1 answer
1k views

How do I set a Node's Paragraph field in a different language programmatically?

I have a node that has different translations already and I'm trying to populate Paragraph fields in different languages programmatically. I can edit the node and update the paragraph fields manually ...
  • 1,093
1 vote
1 answer
358 views

Enable language selector for Paragraphs Library

I am using paragraphs on a multilingual Drupal 9 page. Everything is working fine, I can translate basic pages with paragraphs to get a multilingual node. I have now enabled the Paragraphs Library sub ...
1 vote
1 answer
1k views

How do I programmatically translate a string? [duplicate]

I am working on one custom module to alter the fields labels of user login form for visitors. I created a module to alter the labels in the user login form. The French language is enabled on the setup....
1 vote
0 answers
47 views

How to make the language of the subscriptions be the currently language in Simplenews

I'm implementing simplenews on a Drupal 8 Website, and I currently came across a problem with the anonymous user subscriptions to the newsletters. According to the documentation of simplenews, when ...
0 votes
0 answers
45 views

Content translation not working on the front page

I have a translation problem on my site in drupal 9.1.3. I have a content type for my homepage that contains two fields: field_slides which is an EntiyReferenceRevisionFieldItemList to a Paragraphs ...
0 votes
0 answers
336 views

Get node translation from JSON:API

I have over a dozen languages on my site and we use Json:Api since it's a decoupled drupal. Problem is that I can't figure out how to get the translated node values from the Json:Api response. The ...
  • 348
2 votes
1 answer
63 views

What can I use as a unique identifier between a node and its translation now that the "tnid" field is no longer available?

We are upgrading our site from D7 to D8 and a part of this includes sending data out to another resource, specifically, Nodes. When we send data to the 3rd party resource, it's expecting something ...
1 vote
1 answer
759 views

what is the difference between Drupal.formatPlural() and Drupal.t()?

what is the difference between : Drupal.t(string, arguments, options ) and Drupal.formatPlural() Drupal.t() is used in the javascript part to translate the string and it can accept a set of arguments ...
0 votes
0 answers
22 views

Language Hierarchy module bug or is it me?

Not sure if this is the right place to go with this question: However, before I file an issue with this, I'm wondering if it is something I'm missing or doing wrong. The problem. Given a language (...
  • 954
1 vote
0 answers
72 views

How to work with translations on a date?

I am trying to render a translated date coming from an API and I am wondering what's the best way to do it. The value coming from the API is formatted as "February 13, 2007" I would love to ...
  • 732
0 votes
1 answer
25 views

How to autoexpand everything on a view translation edit form?

To fully translate a view into one language I have to expand dozens of collapsed panels, most of them with only one or two subelements. I've reported it here. But is there a quick workaround, like a ...
  • 261
0 votes
1 answer
353 views

How to display the user's preferred language in a User profile page

In a Drupal 8/9 site, I can select the User's preferred language. In the "Manage form display" page (for user's fields), there are two rows which are about language: Language settings (...
  • 448
-3 votes
1 answer
46 views

How do I completely translate a page?

I want to develop a site in two languages. How do I completely translate a page? For example, the menu tab and other places cannot be translated. I just can translate using the Translate tab. In the ...
2 votes
1 answer
1k views

Translate dynamic variable that is an array in twig or using t()

How do I translate this in twig? I have this variable in twig that is an array: $array = [ ['number' => 7, 'name' => 'foo'], ['number' => 8, 'name' => 'bar'], ['number' => 10, '...
0 votes
0 answers
43 views

How can programatically translate an non-English country name to English?

I have a webform hook that processes some conditionals depending on a country name dropdown on the webform. The conditionals need to compare to the English name because there are many various ...
  • 1,093
1 vote
1 answer
87 views

How do I change the original language of a product type?

On a multilingual site with commerce project I've created a product type while having one language selected as default but now I want to switch it to a different one. On /admin/commerce/config/product-...
  • 261

1
2
3 4 5
39