Index: .buildpath =================================================================== RCS file: .buildpath diff -N .buildpath --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ .buildpath 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,7 @@ + + + + + + + Index: .project =================================================================== RCS file: .project diff -N .project --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ .project 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,33 @@ + + + pathauto + + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipse.dltk.core.scriptbuilder + + + + + de.loskutov.FileSync.FSBuilder + + + + + + org.eclipse.php.core.PHPNature + org.eclipse.wst.jsdt.core.jsNature + + Index: .settings/.jsdtscope =================================================================== RCS file: .settings/.jsdtscope diff -N .settings/.jsdtscope --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ .settings/.jsdtscope 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,12 @@ + + + + + + + + + + + + Index: .settings/de.loskutov.FileSync.prefs =================================================================== RCS file: .settings/de.loskutov.FileSync.prefs diff -N .settings/de.loskutov.FileSync.prefs --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ .settings/de.loskutov.FileSync.prefs 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,8 @@ +#Sat Oct 09 17:22:49 CEST 2010 +WARNING=DO NOT MODIFY THIS FILE IF YOU DON'T UNDERSTAND +defaultDestination=/home/pokurek/www/rwcms/sites/all/modules/core/pathauto +defaultVariables= +eclipse.preferences.version=1 +includeTeamPrivateFiles=false +map|0=/|,|,|,|, +useCurrentDateForDestinationFiles=false Index: .settings/org.eclipse.php.core.prefs =================================================================== RCS file: .settings/org.eclipse.php.core.prefs diff -N .settings/org.eclipse.php.core.prefs --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ .settings/org.eclipse.php.core.prefs 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,3 @@ +#Sun Nov 28 22:11:49 CET 2010 +eclipse.preferences.version=1 +include_path=0;/pathauto\u00052;/drupal\u00052;/simpletest Index: .settings/org.eclipse.wst.jsdt.ui.superType.container =================================================================== RCS file: .settings/org.eclipse.wst.jsdt.ui.superType.container diff -N .settings/org.eclipse.wst.jsdt.ui.superType.container --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ .settings/org.eclipse.wst.jsdt.ui.superType.container 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file Index: .settings/org.eclipse.wst.jsdt.ui.superType.name =================================================================== RCS file: .settings/org.eclipse.wst.jsdt.ui.superType.name diff -N .settings/org.eclipse.wst.jsdt.ui.superType.name --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ .settings/org.eclipse.wst.jsdt.ui.superType.name 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,1 @@ +Window \ No newline at end of file Index: pathauto.module =================================================================== RCS file: /cvs/drupal/contributions/modules/pathauto/pathauto.module,v retrieving revision 1.118.2.31 diff -u -r1.118.2.31 pathauto.module --- pathauto.module 7 Oct 2010 17:43:15 -0000 1.118.2.31 +++ pathauto.module 6 Dec 2010 22:58:55 -0000 @@ -100,12 +100,24 @@ $tokens['taxonomy']['catpath-raw'] = t('As [cat-raw], but including its supercategories separated by /.'); $tokens['taxonomy']['catalias'] = t('The URL alias of the taxonomy term.'); $tokens['taxonomy']['catalias-raw'] = t('The URL alias of the taxonomy term.'); + if (module_exists('i18ntaxonomy')) { + $tokens['taxonomy']['i18n-cat'] = t('Category name translated using i18n.'); + $tokens['taxonomy']['i18n-cat-raw'] = t('Unescaped category name translated using i18n. WARNING - raw user input.'); + $tokens['taxonomy']['i18n-catpath'] = t('As [i18n-cat], but including its supercategories separated by /.'); + $tokens['taxonomy']['i18n-catpath-raw'] = t('Unescaped [i18n-cat], but including its supercategories separated by /. WARNING - raw user input.'); + $tokens['taxonomy']['i18n-vocab'] = t('Vocabulary name translated using i18n.'); + $tokens['taxonomy']['i18n-vocab-raw'] = t('Unescaped vocabulary name translated using i18n. WARNING - raw user input.'); + } } if ($type == 'node' || $type == 'all') { $tokens['node']['termpath'] = t('As [term], but including its supercategories separated by /.'); $tokens['node']['termpath-raw'] = t('As [term-raw], but including its supercategories separated by /.'); $tokens['node']['termalias'] = t('The URL alias of the taxonomy term.'); $tokens['node']['termalias-raw'] = t('The URL alias of the taxonomy term.'); + if (module_exists('i18ntaxonomy')) { + $tokens['taxonomy']['i18n-termpath'] = t('As [i18n-term], but including its supercategories separated by /.'); + $tokens['taxonomy']['i18n-termpath-raw'] = t('Unescaped [i18n-term], but including its supercategories separated by /. WARNING - raw user input.'); + } } } if (module_exists('book')) { @@ -141,6 +153,9 @@ // This query is copied from @taxonomy_node_get_terms() $term = db_fetch_object(db_query_range('SELECT t.* FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.vid = %d ORDER BY v.weight, t.weight, t.name', $object->vid, 0, 1)); if ($term) { + // We only want to translate terms when for nodes that has a language selected as we + // wont really will be able to tell which language will be used for the token. + $term->language = $object->language; $values = array_merge($values, pathauto_token_values('taxonomy', $term, $options, 'term')); } else { @@ -164,13 +179,31 @@ if (isset($object->tid)) { $parents = taxonomy_get_parents_all($object->tid); $catpath = $catpath_raw = array(); + $i18ncatpath = $i18ncatpath_raw = array(); foreach ($parents as $parent) { array_unshift($catpath, check_plain($parent->name)); array_unshift($catpath_raw, $parent->name); + if (module_exists('i18ntaxonomy')) { + $i18n_term_name = i18nstrings("taxonomy:term:$parent->tid:name", $parent->name, $object->language); + array_unshift($i18ncatpath, check_plain($i18n_term_name)); + array_unshift($i18ncatpath_raw, $i18n_term_name); + } } $values[$label . 'path'] = !empty($options['pathauto']) ? $catpath : implode('/', $catpath); $values[$label . 'path-raw'] = !empty($options['pathauto']) ? $catpath_raw : implode('/', $catpath_raw); - + $values['i18n-' . $label . 'path'] = !empty($options['pathauto']) ? $i18ncatpath : implode('/', $i18ncatpath); + $values['i18n-' . $label . 'path-raw'] = !empty($options['pathauto']) ? $i18ncatpath_raw : implode('/', $i18ncatpath_raw); + + if (module_exists('i18ntaxonomy')) { + // i18ntaxonomy set this token values + if (strcmp($label, 'term')) { + $values['i18n-' . $label . '-raw'] = i18nstrings("taxonomy:term:$object->tid:name", $object->name, $object->language); + $values['i18n-' . $label] = check_plain($values['i18n-' . $label . '-raw']); + } + $vocab = taxonomy_vocabulary_load($object->vid); + $values['i18n-vocab-raw'] = i18nstrings("taxonomy:vocabulary:$vocab->vid:name", $vocab->name, $object->language); + $values['i18n-vocab'] = check_plain($values['i18n-vocab-raw']); + } // Token [catalias-raw] and [catalias]. $values[$label . 'alias-raw'] = drupal_get_path_alias(taxonomy_term_path($object)); $values[$label . 'alias'] = check_plain($values[$label . 'alias-raw']); Index: pathauto_taxonomy.inc =================================================================== RCS file: /cvs/drupal/contributions/modules/pathauto/Attic/pathauto_taxonomy.inc,v retrieving revision 1.39.2.5 diff -u -r1.39.2.5 pathauto_taxonomy.inc --- pathauto_taxonomy.inc 31 Jul 2010 15:57:16 -0000 1.39.2.5 +++ pathauto_taxonomy.inc 6 Dec 2010 22:58:55 -0000 @@ -36,11 +36,29 @@ if (sizeof($vocabularies) > 0) { $settings['patternitems'] = array(); $forum_vid = variable_get('forum_nav_vocabulary', ''); + if (module_exists('locale')) { + $languages = array('' => t('Language neutral')) + locale_language_list('name'); + } + else { + $languages = array(); + } foreach ($vocabularies as $vocab) { if ($vocab->vid != $forum_vid) { $vocabname = $vocab->name; - $fieldlabel = t('Pattern for all %vocab-name paths', array('%vocab-name' => $vocabname)); - $settings['patternitems'][$vocab->vid] = $fieldlabel; + if (function_exists('i18ntaxonomy_vocabulary') && (i18ntaxonomy_vocabulary($vocab->vid) == I18N_TAXONOMY_TRANSLATE || i18ntaxonomy_vocabulary($vocab->vid) == I18N_TAXONOMY_LOCALIZE) && count($languages)) { + $settings['patternitems'][$vocab->vid] = t('Default pattern for all %vocab-name paths (applies to all %vocab-name node types with blank patterns below)', array('%vocab-name' => $vocabname)); + foreach ($languages as $lang_code => $lang_name) { + if (!empty($lang_code)) { + $settings['patternitems'][$vocab->vid .'_'. $lang_code] = t('Pattern for all %vocab-name paths in @language', array('%vocab-name' => $vocabname, '@language' => $lang_name)); + } + else { + $settings['patternitems'][$vocab->vid .'_'. $lang_code] = t('Pattern for all language neutral %vocab-name paths', array('%vocab-name' => $vocabname)); + } + } + } + else { + $settings['patternitems'][$vocab->vid] = t('Pattern for all %vocab-name paths', array('%vocab-name' => $vocabname)); + } } } } @@ -56,6 +74,7 @@ function taxonomy_pathauto_bulkupdate() { // From all node types, only attempt to update those with patterns $pattern_vids = array(); + $vid_where = ''; foreach (taxonomy_get_vocabularies() as $vid => $info) { $pattern = trim(variable_get('pathauto_taxonomy_'. $vid .'_pattern', '')); @@ -75,12 +94,14 @@ } } } - $vid_where .= ')'; + if ($vid_where) { + $vid_where .= ")"; + } // Exclude the forums and join all the args into one array so they can be passed to db_query $forum_vid[] = variable_get('forum_nav_vocabulary', ''); $query_args = array_merge($forum_vid, $pattern_vids); - $query = "SELECT tid, vid, name, description, src, dst FROM {term_data} LEFT JOIN {url_alias} ON CONCAT('taxonomy/term/', CAST(tid AS CHAR)) = src WHERE src IS NULL AND vid <> %d ". $vid_where; + $query = "SELECT td.*, src, dst FROM {term_data} td LEFT JOIN {url_alias} ON CONCAT('taxonomy/term/', CAST(tid AS CHAR)) = src WHERE src IS NULL AND vid <> %d ". $vid_where; $result = db_query_range($query, $query_args, 0, variable_get('pathauto_max_bulk_update', 50)); $count = 0; @@ -102,6 +123,16 @@ */ function _taxonomy_pathauto_alias($category, $op) { $count = 0; + static $languages; + + if(!$languages) { + if (module_exists('locale')) { + $languages = array('' => t('Language neutral')) + locale_language_list('name'); + } + else { + $languages = array(); + } + } $placeholders = pathauto_get_placeholders('taxonomy', $category); @@ -114,9 +145,22 @@ } } else { - $source = taxonomy_term_path($category); - if (pathauto_create_alias('taxonomy', $op, $placeholders, $source, $category->tid, $category->vid)) { - $count++; + if(i18ntaxonomy_vocabulary($category->vid) == I18N_TAXONOMY_LOCALIZE && count($languages)) { + foreach(array_keys($languages) as $language_code) { + if (!empty($language_code)) { + $category->language = $language_code; + $placeholders = pathauto_get_placeholders('taxonomy', $category); + $source = taxonomy_term_path($category); + if (pathauto_create_alias('taxonomy', $op, $placeholders, $source, $category->tid, $category->vid, $category->language)) { + $count++; + } + } + } + } else { + $source = taxonomy_term_path($category); + if (pathauto_create_alias('taxonomy', $op, $placeholders, $source, $category->tid, $category->vid, (property_exists($category, 'language')? $category->language: ''))) { + $count++; + } } } return $count;