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
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['...
27
votes
5answers
41k 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 ...
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 ...
23
votes
5answers
9k views

Search only for the currently active language

How can I restrict the results from a default search in Drupal 7, to bring only the nodes that are in the current language? My website has a three language switcher; the user chooses what language he ...
20
votes
3answers
2k views

Why is it not recommended to change the default language?

I have a fresh installation of Drupal 8.2.5 and want to use it for mostly Spanish content, but keeping the admin interface in English. /admin/config/regional/language says, It is not recommended to ...
18
votes
4answers
8k views

Access denied occurs after translate menu link

I want to translate my menu, I have installed internationalization, variable and locale modules but on my menu items when I click on translate : An access Denied page is displayed : What am I doing ...
15
votes
4answers
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?
15
votes
1answer
1k views

What is the difference between “Language: Not specified” & “Language: Not applicable”?

What is the difference between Language: Not specified and Language: Not applicable in Drupal 8 In the context of multilinguality ? There was no such distinction in Drupal 7 (and 6, IIRC) and it ...
15
votes
2answers
2k views

How to set multiple domains for one language

I have a multilingual site with Drupal 7 using subdomains like en.example.com to detect the language. Everything works like expected, but I have a mobile version of the website witch I want to be ...
15
votes
3answers
2k views

Restrict editor user to only edit contents in one specific language

I'm trying to create a role for editors where one editor only has access to edit English contents and the other only has access to contents in another language. I've been researching for quite a ...
14
votes
1answer
8k 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?
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', // ...
14
votes
1answer
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 ...
14
votes
4answers
3k views

How to make strings from templates translatable on all pages they appear?

I have some calls to t() in *.tpl.php files. For the sake of example, let's say I'm talking about products and product.tpl.php file. Strings in templates are not recognized until the first time they ...
12
votes
1answer
3k views

Export multilingual settings with features

I'm using features to export 10 content types, but I don't get the multilingual settings. My question is, whether this is even possible, maybe with strongarm or I'm stuck having to change those ...
12
votes
3answers
1k views

Move Multi-lingual Content with Migrate Module

I've got a single MySQL table with mixed english/french content in each row. I'm trying to figure how to migrate this into a proper i18n configured Drupal site. I can get Migrate to import the ...
11
votes
5answers
2k views

Should I use t() in a hook_menu's description?

I have always used t() for hook_menus title and description like this: $items['some-path'] = array( 'title' => t('My Page Title'), 'description' => t('This is a description about what ...
11
votes
1answer
3k views

What is the difference between {{ |t}} and {% trans %}?

I notice that Drupal 8 support {% trans %} which, according to the Symfony documentation (The i18n Extension), adds gettext support to Twig. {{ |t }}, as far as I know, is the legacy way to add ...
11
votes
5answers
5k views

How to get the taxonomy translated in URLs?

I have a bilingual site with localized taxonomy terms used as categories. I would like to achieve this: http://www.mysite.com/about/pageinenglish http://www.mysite.com/apropos/pageinfrench (A ...
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->...
10
votes
7answers
14k views

How to get the path to the translated node?

I've set up a multilanguage site in Drupal 7. In a template I need to add a link to a specific content node. This node has translations and path aliases like so: node/42 = pathalias_de (german ...
9
votes
3answers
6k views

Retrieve translated taxonomy term in current language programatically

How do I retrieve a specified taxonomy term translated (if translation exists for this term) from the current language context programmatically with D8?
9
votes
1answer
10k views

Block body translation for Full HTML content

After block creation and put HTML content in body field I can't translate this content because of: The string blocks:block:1:body for textgroup blocks is not allowed for translation because of ...
9
votes
3answers
7k views

How do I get translated strings into Drupal.locale.strings?

So I'm trying to use the Drupal.t() function in some of my custom Javascript code (in my theme). How do I get the strings I need populated in the Drupal.locale.strings object? I see some strings in ...
9
votes
5answers
4k views

How can I deploy user interface translation?

Strings that I translate at "User interface translation" /admin/config/regional/translate are not exportable by "Configuration management" /admin/config/development/configuration for me. Am I missing ...
9
votes
1answer
1k views

Why would the body field's language not save as the same language as the node?

I am having a problem where the user is creating new nodes and entering body text, but setting the nodes to "language neutral" for the language. Yet when it saves the node the body field's language ...
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 ...
8
votes
3answers
6k views

How to change the behaviour or display of the language switcher?

On translated pages the language switcher shows links to translated languages, but for untranslated languages there is no link, but the name of the language without a link. In the case, that there is ...
8
votes
2answers
10k views

Accessing $language inside node content in drupal 7

Normally I would use $language to get the active language on my drupal 7 page. Now I'm doing some changes to a node content (set to PHP code) and I can't seem to get any variables working? I badly ...
8
votes
4answers
6k views

How to: Multilanguage site, but single language backend?

I have almost completed my first Drupal 7 multilanguage test site. As long as I'm not logged in, I can browse through all pages and switch languages. When logged in, my first issue was that the ...
8
votes
2answers
686 views

How to avoid Drupal redirecting my multilingual Views pages?

I've got a Views page in a multilingual website where I need a different url for each language, ie: es: mysite/apartamentos. en: mysite/appartments. fr: mysite/appartements. ru: mysite/arendu. I ...
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 ...
8
votes
2answers
2k views

Programmatically add node translation

I am using i18n module. How can I programmatically create node translation?
8
votes
1answer
201 views

How to translate plural strings with Drush?

If we want to translate a plural string in Drupal we can use the format_plural() function. If you are programming drush commands you can use the dt() function to translate strings, but if you want to ...
8
votes
2answers
8k views

How do I translate the Webform module form?

I really see no way of translating the Webform module. Is anyone else facing this issue? I know it is possible with locale (for the same node), or creating another node, but I really want to use the ...
8
votes
2answers
2k views

Change drush language

Suddenly my drush has switched language and displays error messages in my native language, which is unfortunately not convenient if one tries to search for solutions on these errors. Do you know how ...
8
votes
4answers
4k views

Views 3, contextual filter on language - allow for multiple languages

So for this site I'm building I need to be able to do the following. When user views the site in English show all English articles When the user views the site in Dutch, show all Dutch articles - but ...
7
votes
5answers
16k views

How to get custom field labels translated

I want to get the labels and descriptions of custom fields translated in Dutch, but no matter what I try they always remain in English (the language I use for creating them). I hope my steps below ...
7
votes
2answers
6k views

Passing variables that contain HTML through the t() function - ! placeholder has been removed

In Drupal 8, it appears that using the ! (exclamation mark) placeholder with the t() function has been removed. I have a variable that contains HTML: <span class="fullname_wrapper"><span ...
7
votes
5answers
12k views

How to remove language indicator in content region?

It took me a while to figure out how to remove the language switches from the bottom of each page. Eventually the switch was in a somewhat logical location (Multilanguage settings > Article options). (...
7
votes
2answers
4k views

Best practice: $this->t() versus t()

I'm looking for a best practice: should contributed modules use $this->t() or t()?
7
votes
5answers
3k views

Proper way to get the base path when including an image from a module?

When using just drupal_get_path() to include an image from a module directory, this produces non-existent urls when using language prefixes. I've seen a couple of modules prepend base_path() to deal ...
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....
7
votes
2answers
2k views

how to load RTL style in RTL language

I have a multi language website, one of languages is a RTL language, in Drupal 7 I put my CSS in style.css and RTL CSS to style-rtl.css and by default drupal also load style-rtl.css file, Now in ...
7
votes
2answers
908 views

URL-Alias for language neutral content

I have a page with 8 languages. Most of the content is translated and have a language assigned. But there is one part of the page, where I need language neutral content to show in each language. If ...
7
votes
1answer
2k views

I18n translation of site_name not working

I have installed i18n, changed settings.php according to this guide, set language detection to url and cleared cache. Then on site config page, I set the url prefix to English and all UI changed to ...
7
votes
3answers
4k views

How to translate “New custom content” in a panel?

I have a lot of panels to which I have added bits of text/HTML using the "New custom content" option of the Panels module. By default, such text does not show up on the Translate Interface screen. ...
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\...
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 ...
7
votes
2answers
5k views

Multi-language menu's / menu-items setup

I might not understand Drupal 8 and the different Multilingual approach completely, but I'm bumping into all sorts of issues. What I simply want, is a single Menu , containing links from 2 different ...