Hi,

We have a multilingual website who use the taxonomy.
So we have many problems to translate the paths for each vocabulary terms.

For information we use a vocabulary in translation mode.
(Different terms will be allowed for each language and they can be translated).
We have translated the vocabulary name.

When we create a term with a different language (like french) the assigned language for the generated alias is always the "language none" (und)...

The first problem come with the path alias, because it's the same path for all languages.
ex: [mon-terme - taxonomy/term/2 - All] instead: [mon-terme - taxonomy/term/2- French]

In this case the path would be normaly available in french but with own problem it's available for all language.

The second problem come when you use the patche who allow to have a vocabulary path pattern for each language.
see : Support localized taxonomy (i18n)

Like the language is always "und". The path pattern used to generate the path is always the default pattern for all paths... The pattern for the right language is simply... ommitted.

Files: 
CommentFileSizeAuthor
#7 i18n-i18n-taxonomy-and-pathauto-2098975-2.patch2.95 KBdmaciej
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch i18n-i18n-taxonomy-and-pathauto-2098975-2.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#7 pathauto-i18n-taxonomy-and-pathauto-1993462-7.patch1.28 KBdmaciej
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch pathauto-i18n-taxonomy-and-pathauto-1993462-7.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#6 i18n-i18n-taxonomy-and-pathauto-2098975-1.patch2.95 KBdmaciej
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch i18n-i18n-taxonomy-and-pathauto-2098975-1_0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#6 pathauto-i18n-taxonomy-and-pathauto-1993462-6.patch1.28 KBdmaciej
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch pathauto-i18n-taxonomy-and-pathauto-1993462-6_0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#2 pathauto-path_alias_for_taxonomy_terms_always_created_in_default_language-1993462-2.patch491 bytesEchofive
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch pathauto-path_alias_for_taxonomy_terms_always_created_in_default_language-1993462-2.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#1 pathauto-path_alias_for_taxonomy_terms_always_created_in_default_language-1993462-0.patch491 bytesEchofive
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch pathauto-path_alias_for_taxonomy_terms_always_created_in_default_language-1993462-0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Comments

Echofive’s picture

StatusFileSize
new491 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch pathauto-path_alias_for_taxonomy_terms_always_created_in_default_language-1993462-0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

I think that I've the solution...

The problem come from the pathauto_entity_language who return (in own case) always a undefined language...

<?php
if (function_exists('entity_language')) {
 
$langcode = entity_language($entity_type, $entity);
}
elseif (
$check_language_property && !empty($entity->language)) {
 
$langcode = $entity->language;
}
?>

Own patch fix it like this:

<?php
if (function_exists('entity_language')) {
 
$langcode = entity_language($entity_type, $entity);
}
if (
$check_language_property && (empty($langcode)) && !empty($entity->language)) {
 
$langcode = $entity->language;
}
?>
Echofive’s picture

StatusFileSize
new491 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch pathauto-path_alias_for_taxonomy_terms_always_created_in_default_language-1993462-2.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Sorry,
Bad patch name...

blackandcode’s picture

Version:7.x-1.2» 7.x-1.x-dev
Priority:Major» Critical
Status:Patch (to be ported)» Active

Dear Echofive I tried this patch but It stil don't work.

Also I think this issue is duplicate of https://drupal.org/node/290421

Echofive’s picture

Hi blackandcode,

Thanks for your remark and your testing.
Did you remember what's wrong...

dmaciej’s picture

(pathauto v1.2)

I've written a patch for that and it works for me so far.

In pathauto.module you must find the line:

<?php
  pathauto_create_alias
($module, $op, $uri['path'], array('term' => $term), $term->vocabulary_machine_name, $options['language']);
?>

and replace it with the following code:

<?php
 
if ($term->language == LANGUAGE_NONE) {
    if (
module_exists('i18n_taxonomy')) {
     
$languages = i18n_language_list();
      foreach (
$languages as $language => $language_name) {
       
pathauto_create_alias($module, $op, $uri['path'], array('term' => $term), $term->vocabulary_machine_name, $language);
      }
    } else {
     
pathauto_create_alias($module, $op, $uri['path'], array('term' => $term), $term->vocabulary_machine_name, $options['language']);
    }
  } else {
     
pathauto_create_alias($module, $op, $uri['path'], array('term' => $term), $term->vocabulary_machine_name, $term->language);
  }
?>

I don't have a time to creating .patch file now.

dmaciej’s picture

StatusFileSize
new1.28 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch pathauto-i18n-taxonomy-and-pathauto-1993462-6_0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
new2.95 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch i18n-i18n-taxonomy-and-pathauto-2098975-1_0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Okay, I've completed the patch for the issue finally. I tested it and works pretty cool.
I created a issue on the i18n project issue list https://drupal.org/node/2098975

dmaciej’s picture

StatusFileSize
new1.28 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch pathauto-i18n-taxonomy-and-pathauto-1993462-7.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
new2.95 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch i18n-i18n-taxonomy-and-pathauto-2098975-2.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Tests with i18n taxonomy disabled and some fix...

SebCorbin’s picture

Status:Active» Needs review

Testbot enabled?

Status:Needs review» Needs work

The last submitted patch, pathauto-i18n-taxonomy-and-pathauto-1993462-7.patch, failed testing.

xpasi’s picture

Tried the patch, but it now says it generated 2497 aliases, instead of the 240 it should of and paths in other languages than the interface is set to are not generated at all.

Niels de Ruijter’s picture

Status:Needs work» Needs review

Status:Needs review» Needs work

The last submitted patch, 7: i18n-i18n-taxonomy-and-pathauto-2098975-2.patch, failed testing.

Carl Johan’s picture

Issue summary:View changes

I just submitted a tiny patch for i18n that fixes this problem for me.

Jose Reyero’s picture

Committed the i18n side fix (#13) give it a try.

mmncs’s picture

We have a multilanguage site where we use translated taxonomy terms, that is: localize:

Localize. Terms are common for all languages, but their name and description may be localized.

But when we create a new node the path is created using the current langauge instead of the node language. This means that we get english terms as path even though the node is in danish. We would like the path to be generated using the node language and not the user language and would like to know if any of these patches fixes this?

We are using the latest dev version.

Thanks for your time.

Status:Needs work» Needs review

Status:Needs review» Needs work

The last submitted patch, 7: i18n-i18n-taxonomy-and-pathauto-2098975-2.patch, failed testing.

quicksketch’s picture

Status:Needs work» Closed (duplicate)

Let's consolidate this with #290421: Support localized taxonomy (i18n). We've got at least 4 issues covering the same thing (several with patches). That issue has the most traction and working patch. If you'd like to get this in, review that patch. And although this issue is a "bug" and that one is a "feature", it would solve this issue.