Weird one here, unless I'm missing the obvious, which could very well be.

Have Transliteration enabled in Pathauto, but not character set reduction. Lots of nodes being created programatically via API scripts.

Example: Upon node creation in the script, I get something like this:

/Gehuse-Hartholz-gelt

If I edit that node via the D7 admin panel and save it, the transliteration then works properly.

/Gehäuse Hartholz geölt

If I run my create/update script the alias goes back:

/Gehuse-Hartholz-gelt

It seems that I am either doing something horribly wrong in my script, or perhaps there is a bug. Running the latest stable versions of Pathauto and Transliteration.

In my script, nothing fancy ... the basics:

$node = new stdClass();
node_object_prepare($node);
$node->type = 'mytype';
$node->promote = 0;        // Which doesn't seem to work for me, btw ... but whatever
$node->language = LANGUAGE_NONE;
$node->uid = 1;
$node->title = "Whatever";
// Load up a bunch of fields here
...
$node->path['pathauto'] = TRUE;
node_save($node);

I've also tried:

$node->path = array('alias' => '', 'pathauto' => TRUE);

Any ideas? I'm also running Pathauto Persist, not sure if that is a problem or not.

Cheers.

Comments

It doesn't appear that I can edit my original post ... above:

/Gehäuse Hartholz geölt

Should be:

/Gehäuse-Hartholz-geölt

I omitted the dashes/separators when I typed this in.

Status:Active» Fixed

I had the same problem with my importer. Problem is the language hinting goes wrong, so you need to explicitly set $language before you start processing nodes. Otherwise it's pure luck if the transliteration goes right.

Put this after your bootstrap call, where $lang is the current language of nodes you are importing.

$languages = language_list(); // get all languages
global $language;
$language = $languages[$lang];

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.