I am trying to set up a bilingual (english/spanish) website where the URLs are driven by a taxonomy. For demonstration purposes and testing I created a very simple version locally with minimal modules, content, and simple taxonomy terms as follows:
Animals
-Birds
-Dogs
-Cats
Colors
-Red
-Blue
-Green
I set up pathauto to alias taxonomy terms as follows:
animals
animals/birds
animals/cats
...
colors
colors/red
colors/blue
Nodes tagged with these terms are aliased as follows:
animals/general-article-about-animals (this node is tagged only with the animal parent term)
animals/birds/specific-article-about-birds (this node is tagged with only the bird child term)
This works fine for English. However, when I translate the taxonomy terms as follows:
Animales
-Pajaros
-Perros
-Gatos
Colores
-Rojo
-Verde
-Azul
The paths are set as follows:
animales
animals/pajaros (note 'animals' is not translated to 'animales')
animals/perros
...
colores
colors/rojo ('colors' is not translated to 'colores')
colors/verde
The parent taxonomy term path is translated, but the parent in the child's path is not translated - this is how I would like it to display:
animales/pajaros
animales/perros
...
colores/rojo
colores/verde
Also, for nodes tagged with these terms, none of the terms are translated in the paths:
animals/general-article-about-animals in spanish is aliased as animals/artículo-general-sobre-animales
animals/birds/specific-article-about-birds in spanish is aliased as animals/birds/artículo-específico-sobre-aves
I tested this on the most basic of installs I could do for my use case, running the following:
Drupal 7.56
Title 7.x-1.0-alpha9
Entity Translation 7.x-1.0-beta6
Entity API 7.x-1.8
Entity Tokens 7.x-1.9
Pathauto 7.x-1.3
Token 7.x-1.7
Is this something that Entity Translation can do? Here is a screenshot of how I set up my patterns:
as well as the basic configs I did via Entity Translation:
Comment | File | Size | Author |
---|---|---|---|
#8 | enabled translation.png | 27.63 KB | kbrinner |
#8 | title field.png | 15.16 KB | kbrinner |
#8 | title fields.png | 65.83 KB | kbrinner |
entity translation configuration.png | 52.61 KB | kbrinner | |
url-alias-patterns.png | 68.45 KB | kbrinner |
Comments
Comment #2
kbrinnerMinutes after I posted this I came across https://www.drupal.org/node/1114016 which has a section "Using both i18n Taxonomy translation and Entity Translation to translate your taxonomy and generate multilingual URL aliases". Will test out their solution to see if it resolves my issue.
Comment #3
joseph.olstadYou are not using the right title token.
Provided that your title field is correctly configured / upgraded using the title module then you can use the field title token in the path pattern instead of the regular title token
Comment #4
joseph.olstadAlso you might want to try using the latest dev versions of those modules as lots of maintainers seem to slack on tagged releases, often many bugs fixed in dev branch that rarely get tagged releases as often as they should
Comment #5
joseph.olstadI think what you might be missing is this patch:
https://www.drupal.org/files/issues/entity_translation-pathauto_update-2...
from this issue:
#2743685: Pathauto update for all translations for a single node
Comment #6
joseph.olstadComment #7
stefanos.petrakis@gmail.comHey @kbrinner,
How did you do so far with exploring the alternative you mentioned (#2) ?
I just tested your use-case and got the translated parent/top-level term name as part of the URL (as expected):
The versions I used are the same as yours, (with the exception of Entity Tokens which is probably a typo since 7.x-1.9 doesn't exist yet):
Comment #8
kbrinnerThanks for the comments - I'll respond to them one by one first:
Comment 3 - incorrect title token
I updated the title tokens to use the title field:
Comment 5 - patched Entity Translation
Did this.
Then cleared cache, deleted all aliases at admin/config/search/path/delete_bulk and then regenerated all aliases via admin/config/search/path/update_bulk
Now my English paths are:
/animals (taxo term)
/animals/bird (child taxo term)
animals/bird/info-about-birds (node)
and the corresponding Spanish paths are:
/es/taxonomy/term/1 (taxo term)
/es/taxonomy/term/8 (child taxo term)
/es/animals/bird/información-sobre-los-pajaros (node)
I confirmed (since it's been a couple of weeks) that I am using the Title Field for the nodes, and that translation is enabled:
Will do some more testing and post back again shortly.
Comment #9
joseph.olstadkbrinner , please make sure to update your entity_translation , beta7 was released a couple days ago and has many fixes.
you might want to try these versions
Entity Translation 7.x-1.0-beta7