Hi

I am trying to build a site in english and danish

I use i18n & Variable
Content translation & Locale

When going to /search/node

And in danish the "Only of the type(s)" & "Languages" are not translated

I have at /admin/config/regional/translate/translate
all those with the same name as in content types and "English" & "Danish"
I have refreshed the string for contenttypes/Nodetypes
And cleared all cache

A testsite can be seen here http://a5.pafla.dk/da/search/node

How can i get this translated?

Pafla

CommentFileSizeAuthor
#4 advancedsearch.png13.9 KBjhodgdon

Comments

jhodgdon’s picture

Status: Active » Fixed

Hm.... The code in node.module looks correct where it is building the Advanced Search form -- it is attempting to translate these strings:

    $form['advanced']['type'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Only of the type(s)'),

....
      $form['advanced']['language'] = array(
        '#type' => 'checkboxes',
        '#title' => t('Languages'),

And if you go to localize.drupal.org and search for the string "Languages" it looks like it should be translated as "Sprog", while "Only of the type(s)" is translated as "Kun af typen". These both look like good Danish translations to me (I used to know a bit of Danish, and I think they're OK), so if you have imported Danish translations from localize.drupal.org, it should be working.

So I do not think there is a code bug here.

For further help....

I'm sorry, but although you can create issues in Drupal Core and mark the category as "support request", we don't really handle support requests in the Drupal Core issue queue as a regular practice (that option is mostly there for filing support issues for contributed modules and themes).

There are several support options listed if you click on "Support" at the top of Drupal.org, which will take you to:
http://drupal.org/support

There you can find out about the Drupal IRC channels, and the Forums, which are our two main support mechanisms in the Drupal community.

Good luck with your issue!

And if you do figure out this is a code bug in Drupal Core, please change the category to "Bug" and explain what the problem is. Thanks!

pafla’s picture

Maybe you misunderstood me?

And if you go to localize.drupal.org and search for the string "Languages" it looks like it should be translated as "Sprog", while "Only of the type(s)" is translated as "Kun af typen". These both look like good Danish translations to me (I used to know a bit of Danish, and I think they're OK), so if you have imported Danish translations from localize.drupal.org, it should be working.

This is translated correctly

But below (The options):
Poll is "Afstemning" - OK
And below here is not translated
Article should be "Artikel" - From core
Basic page should be "Simpel side" - From core
Content should be "Indhold" - Contenttype i created
Forum topic should be "Forumemne" - From core
Popup & Video is the same in english and danish

Danish should be "Dansk"
English should be "Engelsk"

jhodgdon’s picture

Title: Translate contenttypes and languages » Advanced search form doesn't translate languages and node type names
Version: 7.28 » 8.x-dev
Category: Support request » Bug report
Status: Fixed » Active
Issue tags: +Needs backport to D7, +D8MI

Oh, OK. These are two separate problems.

a) For the translations of the content type names, the problem is apparently that the function node_type_get_names() is not translating the content type names. We'll need to investigate more on that one.

b) For the translations of languages, the problem is that the Search module is using language_list() to get the names of the languages, and probably it needs to be using locale_language_list() if the Locale module is enabled (this function translates the language names, whereas language_list() doesn't).

So... We'll need to investigate problem (a) further, and figure out what to do. Meanwhile, I'm changing this into a bug report. Probably we will need to test and see if we can verify the problem and make a straightforward "Steps to reproduce", so we can write a test. And then also we'll need to see if it is still a problem in Drupal 8, and fix it there if so.

I'm provisionally moving this to Drupal 8, since Drupal 8 issues get faster action. If someone tests and finds it is not an issue in 8, we'll move it back to 7.

jhodgdon’s picture

StatusFileSize
new13.9 KB

I tested this in 8.x today with these steps:

a) Install with standard profile in English.
b) Turn on Language, Interface Translation, and Config Translation modules
c) Add Spanish language on admin/config/regional/language (I prefer to test with Spanish in place of Danish). I was testing on simplytest.me with the 8.x branch, and my translation was not imported, so I also had to go to localize.drupal.org, download a Spanish translation file, and import it into my site on admin/config/regional/translate.
d) Add a new content type on admin/structure/types, called "My type".
e) Click "Translate content type" and click "Add" next to Spanish (admin/structure/types/manage/my_type/translate/es/add), translate the content type name to "Mi tipo" and title field label to "Titulo".
f) On admin/structure/block, add the Language Switcher block to the first sidebar.
g) Go to search/node. Form is in English.
h) Click the language switcher link for Spanish (es/search/node). Page is mostly in Spanish. But:
- The content types that the Standard profile set up were not translated.
- The language names are not translated.
Screen shot (note that in Spanish, "Idiomas" means Languages and "Tipos" are the content types.
Advanced search form for Drupal 8

So... let's see. I was able to fix the content types part by translating them -- the Basic Page and Article content types were not automatically translated, because they are configuration. So I went to structure > content types > Article > Translate, added a Spanish translation, cleared the cache, and went back to the Search page and now Article appears as Articulo.

This is not good. "Basic page" is part of the UI translation I imported, as was "Article", but although they have been translated on localize.drupal.org and the translations are imported, they are not being used for display, either on the search/node page or on node/add. But it looks like the search module in 8 is working consistently.

For the languages... Again, it looks like I can go to admin/config/regional/language/edit/en/translate and add a Spanish translation for the language name (which I shouldn't have to do at all). But even when I do this, the language is not shown correctly on the advanced search form.

So... conclusion: For Drupal 8, there are two bugs:

a) Languages on Advanced Search are not shown localized/translated (like in 7).

b) Importing translations from localize.drupal.org does not give you configuration translations for core configuration. This is a separate issue, much broader than just the advanced search form. This is a separate issue: #2311859: Configuration and Javascript translation not created/updated in .po translation import

So we need to fix (a) in 8.x, and then we can go back to 7.x and see what needs to be done.

jhodgdon’s picture

The node types should probably be fixed now, need to retest.

Fixing the languages: when #1879930: Language selectors are not showing localized to the page language is resolved, we can probably use the same method used there to fix the language list problem.

anybody’s picture

I can confirm that in the latest Drupal 7 versions the node type labels are not translated in advanced search. I can not find a reason or way.

I'm using

  • i18n
  • i18n_node
  • translation
  • The content types are translated (using translation_table.module and translated via the normal translation form)

Can you confirm that this issue is still unfixed in Drupal 7? Tell me if I can help testing.

jhodgdon’s picture

Right, this issue is still open for both Drupal 7 and Drupal 8. In Drupal 8, I believe the node types are now translated (if you want to test that, please do!), but not the languages. In Drupal 7, I believe both are still broken.

francescosciamanna’s picture

Hopefully someone can fix ASAP. My site users(chinese) are not able to understand a single word of english!

jhodgdon’s picture

Well, if you'd like to work on this issue, it might get fixed sooner!

jhodgdon’s picture

Version: 8.0.x-dev » 7.x-dev
Issue tags: -Needs backport to D7, -D8MI

I have just verified that for Drupal 8, the patch on #1879930: Language selectors are not showing localized to the page language fixes this problem. With that patch applied, as long as you have translated the content type names and language names, they are displayed in the correct language on the Advanced Search form.

So I think we should just move this bug back to 7.x and attempt to fix it there.

jhodgdon’s picture

As a note: The Drupal 7 Core Search module does not currently have an active maintainer. So if people want this to be fixed, someone from the community will need to work on it. Sorry... that's just how it is for Open Source projects sometimes.

luison’s picture

... This should be fixed from day one...
In order to fix this, edit node.module in /modules/node. Go to line 754:

    if (!isset($_node_types->types[$type_db]) || $type_object->modified) {
      $_node_types->types[$type_db] = $type_object; 
      $_node_types->names[$type_db] = $type_object->name;
[...]

And add the following lines:

    if (!isset($_node_types->types[$type_db]) || $type_object->modified) {
      $_node_types->types[$type_db] = $type_object;
      //Miramos si existe el módulo de traducción, si existe, traducimos el nombre
      if (module_exists("i18n_node")) {
            $_node_types->names[$type_db] = i18n_node_translate_type($type_object);
      }
      else {  
            $_node_types->names[$type_db] = $type_object->name;
      }

I have hidden my languages from advanced search, but I suppose with languages should be the same.
My css for advanced search is:

.search-form .criterion .form-type-checkbox.form-item-type-poll {
display:none;
}
.search-form .criterion .form-type-checkbox.form-item-type-page {
display:none;
}
.search-form .criterion .form-type-checkbox.form-item-type-panel {
display:none;
}
.search-form .criterion .form-type-checkbox.form-item-type-book {
display:none;
}
.search-form .criterion .form-type-checkboxes.form-item-language {
display:none;
}
luison’s picture

Priority: Normal » Major
jhodgdon’s picture

Again, if someone would like to make a viable patch for Drupal 7.x, we could get this fixed... so far there hasn't been a patch.

luison’s picture

I think I'm not understanding you well... Are you saying that no one wants a patch? :/

Well, at least here is the code for others.

jhodgdon’s picture

No, I am saying that there is not anyone who is the official Maintainer of the Drupal Core Search module for Drupal 7.x. So if the community wants this problem to get fixed in Drupal Core, someone in the community needs to make a viable patch, with a test. So far, no one has done that.

Status: Active » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.