Questions tagged [i18n-l10n]
Use it in questions about adapting software to different languages, regional differences, and requirements of a target market (locale).
1,907
questions
2
votes
1
answer
97
views
Should I use t() in hook_update_N() or admin UI in a custom module?
Background / motivation
Many implementations of hook_update_N() and hook_install() in contrib and core modules in D7 and D8/D9 contain calls to the t() function. In general, I think it is considered a ...
1
vote
1
answer
177
views
With Commerce Product taxonomy term view, is there a way to have page title set to the translated term title?
The only way to have the taxonomy term name in the title of a taxonomy term Commerce Products view page I've found so far is the example view in the estore theme (I still don't get how tid which ...
2
votes
2
answers
703
views
Translate configuration values in custom webform handler
I created a Custom Webform Handler, which uses the email and name data from the form input to subscribe the user to a newsletter service through the vendors API.
Ich created a configuration form with ...
1
vote
0
answers
36
views
On the password_confirm widget, how do I change the text of "Password"? [duplicate]
By default, the password change form on the user account page looks like this:
Current password
Password
Confirm password
This is bad usability because it is not clear to users that "Password&...
2
votes
0
answers
40
views
Need help to find right language detection configuration
We are developing a site with 10s of thousands of nodes and 12 interface and content languages. Having spent hours trying different configurations for language detection, I cannot find one that meets ...
0
votes
1
answer
1k
views
How to get taxonomy term reference fields value translated in twig
I have a taxonomy vocabulary with terms.
In a content type, I have a referenced field with this taxonomy.
I can get the taxonomy term in twig like this :
{% for item in node.field_lorem %}
{{ ...
0
votes
0
answers
26
views
Two languages JS files
In my default/files/languages folder I have two JS files:
es_BW4ZdvqK9tDPZ0JRAIb4Da2ATqVPvi01H1gYXugKgWo.js
es_iXHy-aczd8O7uaoQze0vEQJL0ROMrskX7l3yWYGxC9r.js
They are very similar, but one has some ...
0
votes
1
answer
75
views
Alphabetically ordering vocabulary terms in a translated
I have 5 English-Italian terms in a views exposed filter:
Academic | Accademico
American Studies | Studi americani
Medieval Studies | Studi medievali
Music | Musica
Reviews | Recensioni
The English ...
0
votes
1
answer
121
views
How do I make multilangual content synchronization between two sites?
I'm trying to figure out how to synchronize content between 2 sites. Before migration to D8 I was using views data export on site1, and feeds import on site2. My problem is, that in D8 I'm not able to ...
0
votes
1
answer
28
views
How do I create a view with mixed languages, showing the node's original language by default?
I have a site with mixed languages, Spanish and English. Some content was originally created in English, then translated into Spanish. Other content was originally created in Spanish, then translated ...
1
vote
1
answer
293
views
Pretty-printing JSON as preformatted text in translatable string passed as argument to method?
LENGTHY PREAMBLE:
In a Service class, I'd like to display onscreen debug info for users with a specific permission.
In my_custom_module.permissions.yml:
'view debug info':
title: 'View debug info'
...
1
vote
1
answer
283
views
How do I retrieve a plugin block field's translated value?
I created a module that installs a block with some fields when installed. I added a schema file, and altered the blockSubmit() function so that the translation is saved in the schema.
Here is my ...
1
vote
1
answer
1k
views
Paragraph's fields value loaded in a custom controller are in the default language instead of the current language
I made a custom controller that load a paragraph field from a node and then render some part in a template. The paragraph field field_title and field_description are translatable.
The translation ...
1
vote
0
answers
797
views
How do I translate a programmatically-created custom block?
I am searching from long hours about this problem. I created a block programmatically, in my custom module, with hook_block_info(). I create its fields in hook_block_configure() and save values of ...
1
vote
0
answers
41
views
How to add translation of terms to a search API index?
I have some media in the site default language, it is tagged by terms and the terms are translated. The media is not. How could I add the translated terms to the search index so it's possible to find ...
0
votes
1
answer
29
views
Create language locales in D8
I am attempting to create/enable the UI to allow users to create translations in D8, and I need to create locales (e.g. en-us, en-gb, en-ca for English, es-mx, es-es for Spanish, etc). I've gone ...
1
vote
0
answers
67
views
Different node parent menu for per language
My struggle with Drupal 8 continues as I moved onto i18n settings. I've enabled and configured content translation and now I'm facing issue of menu displaying untranslated pages. Popular suggestions ...
0
votes
1
answer
30
views
How to sort translation under Translate tab?
I need to sort these translated language names alphabetically. I want to sort these irrespective of these languages weight and hierarchy. How can I do that?
2
votes
1
answer
211
views
How do I change the current language in a Kernel test?
I'm writing a test for something that returns a Url from an entity. This should be language-aware, so the test needs to change the current language.
I started off writing a Kernel test for this, ...
1
vote
1
answer
167
views
How do I translate the weekday in a date?
I created a view from a JSON file; the dates in that file follow the 2020-07-28 20:00 format. I do a rewrite of the date to <span>{{ value_1|date("l d/m/Y") }}</span> and I get ...
0
votes
1
answer
458
views
How to allow the translation of menu links provided by my_module.links.menu.yml
I have the Configuration Translation module installed in a multilingual site and I am able to translate any menu created with the UI.... This is fine!!
I have a module which is creating some menus ...
0
votes
1
answer
37
views
How to translate the author line "Submitted by ... on ..."
I've created a custom content type in Drupal 8.9.1. Each content post automatically renders the line
Submitted by author_name on 08.07.2020 - 18:21
Even though my Drupal system language is set to ...
1
vote
1
answer
196
views
How can I show a date in Urdu?
I am working on printing dates in more than a language. With Drupal 7, I used the following code.
<span class="arabic-date">
<?php
$arrayurdudays = array('', '', '', '', '', '', ...
2
votes
1
answer
534
views
Restrict translation and editing of node to one language
Edit
I found this in Workbench Access issue queue:
https://www.drupal.org/project/workbench_access/issues/2982941#comment-12670744
It seems as if I need to deactivate the translate *bundle* *node* ...
0
votes
1
answer
137
views
Tokens missing in Webform Emails after upgrading
Currently running Drupal 7.69 / PHP 7.3 (+ CiviCRM)
I have recently updated some Modules : Webform, Views Bulk Operations, i18n, and Content Access.
Since then, my Webform Emails do not show the ...
5
votes
0
answers
426
views
How to add translation to Inline Entity Form + Entity Browser
Situation
I've got a special "Dashboard" node that consists of entity references to other node types. In dashboard form mode all widgets are configured to use Entity Browser to display an (Inline ...
1
vote
1
answer
37
views
Change sort order of SOURCE STRING list at User interface translation page to alphabetical instead of date created
At the User interface translation page (/admin/config/regional/translate) the SOURCE STRING list seems to be ordered by creation date/time (it is for strings I add). Is there a "good" (non-hackish) ...
0
votes
1
answer
785
views
Render custom twig in a specific language
I need to specify the language,
which the drupal renderer uses,
when generating a custom render array.
$renderArray = [
"#theme" => "DNMBE_email",
"#body" => [
"#theme" => "...
1
vote
0
answers
33
views
Migrating UI strings
Is there an automated migration for UI strings (Locale module) from Drupal 7 to Drupal 8?
I have a Drupal 7 site in English and French. Some of the French strings used in the user interface have been ...
0
votes
2
answers
100
views
How to check if a Vocabulary is translatable?
In Drupal Core, I found the following code:
$entity instanceof TranslatableDataInterface && $entity->isTranslatable()
But it looks like it is not working for the Taxonomy vocabularies
2
votes
2
answers
1k
views
Delete any path alias by language
We are running Drupal 8.8.5. I can see duplicate aliases when I look at /admin/config/search/path.
Unfortunately, there are many duplicate aliases on our website with 6000 URLs. The /node/1 node has ...
2
votes
1
answer
615
views
How to translate node programmatically with correct revision translation affected value?
I have a question about create node translation programmatically.
First of all, the following is the database screenshot when we use drupal UI to create the translation.
The ...
0
votes
1
answer
168
views
Get interface translation LID (Locale Id?) using source string value
I'm using User interface translation in English to override system strings like Drupal 7's String Overrides module did. Works great. However, in my custom module, as I edit strings that run through ...
3
votes
1
answer
83
views
Where do I fetch myself complete definition for a bundle?
I can fetch entity-type definition...
$entityType = \Drupal::entityTypeManager()
->getDefinition($this->entityType);
and I can fetch myself some of the bundle specific information...
if ($...
0
votes
1
answer
62
views
Message (from message stack) not translated into the preferred language of the recipient
Here is a code which can be pasted into devel/php (run php code) if the message template new_user_register exists with a user reference field called field_user_reference
This message should be sent ...
0
votes
1
answer
396
views
Language code and country code on the URL
I've been trying to achieve this:
I have a multilingual site with 8 languages (en, fr, es, de, etc) and I want to make all those language available for all countries.
I want Drupal to understand ...
1
vote
1
answer
16
views
View page not filtering content according to its language
I used devel to generate dummy content for a content type named recipe, and at the moment I have 10 recipes. 5 in English and 5 in Portuguese.
I create a view(page view) that shows all the recipes ...
0
votes
0
answers
109
views
How can I hide a page for a specific language?
I think I may be missing something obvious here. I need to completely hide a specific page for a specific language. Blocks have a language visibility setting put pages and menus do not have anything ...
1
vote
1
answer
234
views
How do I detect the language using node alias
I know to get the current language of a website:
$current_lang = \Drupal::languageManager()->getCurrentLanguage()->getId();
However, given that I have a node alias
$alias = \Drupal::service('...
2
votes
2
answers
523
views
External content migration translation problem
I am trying to import content into Drupal 8 from an external source (not previous Drupal version). I have crawled the original site and placed the content in a database. I am then writing a custom ...
2
votes
1
answer
1k
views
How do I get translated label for a base field definition?
As mentioned here and here, there is a (complicated) way, to get can get a translated labels for bundle fields.
use Drupal\field\Entity\FieldConfig;
// Override language before loading field ...
1
vote
0
answers
330
views
How do I programmatically translate a webform?
Is it possible to add translation for webform programatically in Drupal 8. We have a webform with more than 100 questions and radio options. It is very difficult to manually add translation each time ...
0
votes
1
answer
185
views
How to translate the month name in a date select list field?
I have created a date field in user account fields. In manage form display, I have selected Select list as widget.
I want to translate the month names which is displaying a select list.
I checked it ...
1
vote
0
answers
17
views
Use default language domain when editing translated content
I have a multi-lingual site setup that uses two domains:
example.com (Primary/Default English domain)
example.mx (Spanish translation)
When editing translated content the user is forced to 'example....
0
votes
0
answers
26
views
Longer text doesn't translate in custom module
I have built a simple module that contains several modules.
Each shows a page with some descriptive text, a form and a result table. The result table is populated using the input and some calculations ...
-2
votes
1
answer
77
views
Can we get the title by node ID in a template file?
Is it possible to retrieve the title by node ID, based on the interface language.
I found drupal_url('/node/101', {absolute: true}).
I wish to have a similar function that returns a title passing a ...
0
votes
0
answers
466
views
how to get translated content in twig [views.view.unformatted]?
I am trying to get translated node title in my custom views-view-unformatted twig file.
Here is the way I am retrieving my node title in twig file
<div class="col-md-6 title">
{% for row ...
1
vote
1
answer
1k
views
How to enable configuration translation on custom module
I wrote a module where I using a form for editing my module's configs. My current goal to be able to translate some of my config field's values with configuration translation. I already implemented ...
1
vote
0
answers
31
views
Different code when translation is added & another when save button is clicked
Is there a way for me to add a code when i first add a translation and a separate code when the save button is clicked. at the moment i am using form _alter to trigger my custom code when adding, My ...
0
votes
0
answers
58
views
How can I hide/disable a specific menu item and a specific page (node) from all non-default languages?
Drupal 8 / Muli-Language Site:
There is a specific page that we need to hide/disable along with its menu link if the current site language is not the default (English).
How can this be done?