We use this module together with Page title module. In page title module we use the [term-title-raw] token to set the page title of term pages. We also have i18n to have all terms and titles translated.

When a term title is defined, the translated string is returned correctly.
When no term title is defined, it returns the untranslated term name. I think the problem is at function taxonomy_title_token_values().
A check is made to see if a title is defined and if not the $category->name is returned untranslated.

$values['term-title-raw'] = ($title) ? $title : $category->name;

I'm not sure this is the place to translate the term name, but with a quick test we made, everything worked perfectly. We replaced the above line with:

$values['term-title-raw'] = ($title) ? $title : i18nstrings("taxonomy:term:$category->tid:name", $category->name);

I'm not creating a patch, because as I said, I'm not sure that this is the way to go.


Members fund testing for the Drupal project. Drupal Association Learn more


jenlampton’s picture

@miraclegr I'm not sure this is the best way to go either, but since it's the only method we have right now, I'm tempted to go this route until we find a better solution.

jenlampton’s picture

Status: Active » Needs review
1 KB

Here's a patch that allows the standard category names to be translated when used in tokens.

jenlampton’s picture

Lets try that again. with no syntax errors this time :/

Dave Reid’s picture

Maybe a better solution would to be to use the new hook_token_values_alter() (introduced with #1157058: Add hook_token_values_alter() to allow altering of tokens) in the i18nstrings module instead of having to build this optional support from each and every contrib module.

jenlampton’s picture

i wonder if it should be i18n that's altering my tokens... :/
or me that should be altering token's tokens.
or i18n that's altering my tokens altering token's tokens.
bedtime, methinks. :)

jenlampton’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

Closing this issue since there's no active development on the 6.x branch anymore.