We’re rewarding the question askers & reputations are being recalculated! Read more.

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
1answer
651 views

How to make content translation available for front page?

On my front page I have a language selector (English / French). The default language is French. The translation works only in the content of page (in the views) i want make the translation work in the ...
30
votes
5answers
27k views

Best practice for language key for “und” in hook_form_alter

I'm modifying in a form in my custom module. Code looks like: function my_module_form_alter(&$form, &$form_state, $form_id) { if ($form_id == "someID") { $form['...
6
votes
4answers
17k views

how to get the translated taxonomy term programmatically? [duplicate]

I have tried this $term = taxonomy_term_load($tid); and this: $term = i18n_taxonomy_localize_terms(taxonomy_term_load($tid)); Both return the default language (English) term I am using D7.
6
votes
4answers
17k views

Get current language in template

In Drupal 7 the current language is a global variable we can access with global $language; $langcode = $language->language; I want to know how can we access the current language in a Twig file ...
10
votes
5answers
18k views

How to get the translated term name by tid?

I'm looking for a working method to get the translated term name by tid. The following code returns the original term name but not the translation. global $language; $lang_name = $language->...
26
votes
5answers
9k views

Node translation vs. Entity (field) translation

I would like to know what you guys recommend for a multilanguage site. For example, consider the following case: A page and its content should be available in 3 languages (e.g. German, English, and ...
6
votes
3answers
8k views

How to Translate Content type name using i18n module?

I am developing a multilingual site that supports English and Norsk bokmal. I have set English as my default language. I wanted to translate the contents and the other things in the site. My real ...
14
votes
3answers
5k views

Is it always bad to pass a variable through t()?

I have a little helper function for my hook_schema: function _bbcmap_schema_asr_field($description) { return array( 'type' => 'int', 'unsigned' => TRUE, 'size' => 'small', // ...
9
votes
1answer
4k views

Do not translate the admin area / How can I set the language of the admin area to English?

I am building a multilingual site with 3 languages. Lets say English, Italian and German. English is the default language. Is it possible to leave the admin area untranslatable, even I am currently ...
14
votes
2answers
3k views

Multilingual content and single language admin interface

I want my site's content to be multi-lingual. I have a language switcher that can toggle between both the English and Spanish translations of a page. I want the administrative interface to always be ...
7
votes
2answers
9k views

How do I get a field translated in Drupal 8

I have a multilingual site in Drupal 8, and several node, some translated and others not. As I can programmatically get the translated field or by default they give it back from the original language. ...
5
votes
5answers
6k views

How to show translated taxonomy terms in a view?

I have used the Views module to create a view of taxonomy terms. The taxonomy terms are translated in the Greek language also (apart from English), using the typical i18n modules. But when I switch ...
6
votes
3answers
5k views

How can I set the language of nodes in bulk to existing content when making a site multilingual?

I'm making an existing site with a few thousand nodes multiligual. Source is English. How can I set all of the existing content to langauge:English instead of neutral all in one bulk command?
8
votes
1answer
5k views

create multilingual node programmatically

i'm trying to create a multilingual node using a php script. I'm doing this: $node = new stdClass(); $node->title = "Test ".mktime(); $node->type = "job"; $node->language = 'de'; // Or ...
7
votes
3answers
9k views

Menu links not being translated

I have installed Drupal 7 and also the internationalization modules. I am able to add a basic site and translate it. I can even opt to add localized url aliases which work fine when switching language....
3
votes
1answer
1k views

Programatically render a node in a specific language

I want to render a node display programmatically for sending it to a search engine. It works ok but is ignoring the language and renders the field labels in the source language (which is English). I ...
3
votes
3answers
2k views

Why is an untranslated string not showing up?

In my module I have some custom strings. I use these in the t() function. When I go to admin/config/regional/translate/translate and filter the untranslated strings my custom strings do not show here. ...
1
vote
1answer
1k views

Cache page based on cookie value and URL

I am working on a site that is multi-lingual as well as multi-country. This means that pages will show content differently depending on a country cookie that is set when the user first visits the site....
31
votes
6answers
46k views

How do I translate strings in Twig templates?

I am working on a (my first) Drupal 8 project witch is a multilingual site. Drupal 8 really delivers in terms of native support for content translation. However, I have a few strings set directly in ...
5
votes
5answers
7k views

How to translate a panel page title and a pane title

I want to ask if there is a way to translate the title of a panel and also its panes titles whatever content they are. I use panels to override user/%user page and there i putted as panel title the ...
6
votes
1answer
4k views

How do I get Views content items in “my language” but fall back to “default” if the content isn't translated?

This is probably very easy but endless searching has proved fruitless - there's lots of UI changes between the D7 and D8 versions of these modules it seems. What I want to do is create a blog in two ...
5
votes
2answers
4k views

Using Feeds to import multiple languages

I've already imported a data set of about 1500 articles, all in English. I have another set of the data with matching node ids but in different languages. Can I import a second file into Drupal 7 and ...
0
votes
2answers
3k views

How to use different domains for multilingual sites and keep users logged in?

I have a site that is in French and English. I am able to successfully setup so that users can switch back and forth between the two domains to view either language, however I cannot seem to keep ...
6
votes
1answer
7k views

Disable language code in URL for default language

I'm using drupal 7 and i18n module. I select the user language with the language code in the URL like this: mysite.com/fr/node/1 mysite.com/en/node/1 etc The default language is French. How could I ...
14
votes
1answer
9k views

How do I translate a view page title?

Is there a way to translate a view page title in Drupal 8? How can I achieve it, if it is possible?
7
votes
3answers
3k views

Use another language than “default” as standard

We're currently building a rather large website that will be release in swedish initially, but other languages later on. For this reason we've built everything in english and then translated ...
6
votes
3answers
6k views

How to create a multilingual node programmatically?

In the last days I tried to migrate a multilingual CSV file to Drupal 8 without success, so finally I decided to use a Batch Process to accomplish the task. At this moment I have the batch process ...
5
votes
1answer
1k views

Implementing i18n string translation in a custom module?

I have a custom module I've built which essentially acts as a repository of custom CTools keywords that users can arbitrarily define. The issue I'm facing is I need to be able to translate these user-...
4
votes
3answers
1k views

How to use traditional (national/native) dates and calendars? [closed]

How can use non-Gregorian dates and calendars? I adjust Drupal setting to my native language (fa) and native location (Asia/Theran) but month name and number of years also in Gregorian yet (however ...
4
votes
1answer
303 views

How to link a view to the current language with a no results fallback to the default language?

I've already figured out how to link views to content language by the Content: Language filter. I know that I can create a second view to use as the No Results fallback and use the Global: View area ...
3
votes
1answer
323 views

How to progragrammatically get NodeType translated value in D8?

Fetching node translation $node = Node::load($nid); $node->getTitle(); // returns title in en(default language). $translated_node = \Drupal::service('entity.repository')->...
2
votes
2answers
3k views

How to change default language for configuration entities

I made a mistake during development of my Drupal 8 site. Some time ago I changed the default language (to german) - but I continued to create the configuration entities (like fields and so on) in ...
0
votes
1answer
2k views

How to load translated entity values in Twig for SEO purpose?

How can I get access for the english values of my entity in the french version of my twig template. This is for a tracking task. Let say I want to print the node title en english on the french ...
7
votes
2answers
2k views

Translating paths in routing.yml

How do you translate the path portion of a module route? For instance you have: module_name.my_route_name: path: '/path/to/content' defaults: _controller: \Drupal\module_name\Controller\...
3
votes
2answers
382 views

Why do so many classes define a ::t() method?

I've encountered MANY methods substituting the translation function — forms, entities, plugins... What is the point when there is the global t() function that has exactly the same code return \Drupal:...
3
votes
3answers
2k views

Different front page per language

Is there any way to provide a different node ID per language for the front page setting in Drupal 8? We need a different front page for a specific language. In Drupal 7, this was easy.
2
votes
1answer
77 views

How can I search in another language?

I have 2 languages in my site and a search view for property search and I am using the Search API module. When I try to search in English (default language), the search is working. But when I try to ...
2
votes
1answer
126 views

Interface translation conflict / same EN word, different translations

I've created a custom module, that uses templates with hard coded strings. I've created the .pot and .po files and included them my module's YML file. The Twig tempatles translate those strings using ...
2
votes
2answers
5k views

How to redirect URL with language prefix to the same URL with no prefix (default language)

I have installed i18n module so two languages Japanese and English are available. I have set Japanese to the default language and also "language Language negotiation" to "path prefix only". So all the ...
1
vote
1answer
717 views

How to create an RTL CSS file (style-rtl.css) for Drupal modules

Say I have a "style.css" file for a module, and that file contains the following syntax: .myCalss1 { right: 10px; margin: 0 5px 0 0; } I then create an extra file, "style-rtl.css" with the ...
1
vote
1answer
2k views

How to associate programatically the translation of new term to the original existing term?

I've terms which share the same id in stored in field and I'd like to associate translation between them, so they're grouped on the same page at /taxonomy/term/%/translate So I've existing original ...
1
vote
1answer
512 views

How to alter and rewritte current path programmatically in Drupal 8?

Here is what I'm trying to achieve : I have a multilingual site with 2 languages (en, fr) but I I also have 4 iso_codes (us, gb, fr, be). I want Drupal to understand that /us and /gb for example is ...
1
vote
1answer
263 views

Create Nodes for multiple languages in webform?

I have a default Node for English, which will be translated when user logs in based on the user locale. Beside I need to create a separate node for ja(Japanese) like (mydomain.com/node/7). I created ...
1
vote
1answer
272 views

Select translation: where?

In Drupal 7 (i18n) there is a possibility to select an existing node as a translation of another node. In Drupal 8, is there also that possibility?
1
vote
1answer
813 views

When using the StringTranslationTrait in a service why should you inject the 'string_translation' service aswell?

I was reading the code comments in the StringTranslationTrait trait and saw the following: If the class is capable of injecting services from the container, it should inject the '...
1
vote
1answer
908 views

Translation mess up with fields which are not translatable used in views

Example set up: Content type news with fields Body (translatable) date (another date field beside node published date - translatable) type of news (list field - not translatable, the news should be ...
0
votes
2answers
495 views

How can I have a URL like www.example.com/about?language=ja to set Japanese for the page?

I've enabled the Locale and Content Translation module but am having trouble understanding how to do something that it seems should be working. Basically I have a page, we'll say '/about' and it's in ...
0
votes
1answer
172 views

Error when upgrading from 6.22 to 7.8 [closed]

I upgraded my Drupal site from 6.22 to 7.8 (before that i had upgraded from 5.9 to 6.22). After I start to run the update I had an error before it's started, apparently related to language: ...
0
votes
1answer
106 views

Language cookie module not working in Safari?

I use language_cookie module to safe the users preferred language with a cookie. E.g. The default site language is English. But i am from Holland so i want always the Dutch version of the site: http://...
16
votes
5answers
13k views

Import po-files using Drush

I have about 20 sites that have a common translation. I don't want to go into admin of each site each time the po-file is updated. Is it possible to import a po-file using Drush?