As you know by default Pathauto creates alias only for one language or for all languages one alias.
This module provides functionality to create aliases for each language.

Example

When you create node without pathauto_i18n:
English alias: en/articles/first_article
Italiano alias: not exist
Deutsche alias: not exist

When you create node with pathauto_i18n:
English alias: en/articles/first_article
Italiano alias: it/articolo/first_article
Deutsche alias: de/artikel/first_article

The same for taxonomy and users.

This module contains 3 submodules pathauto_i18n_node, pathauto_i18n_user and pathauto_i18n_taxonomy which allows enable separate modules for each entities.

How to use

  1. Enable multilingual support for nodes(needs only for nodes)
  2. Configure alias patterns on page admin/config/search/path/patterns
  3. Create entity with option "Generate automatic URL alias for other languages"

Sandbox link: https://drupal.org/sandbox/sanchiz/2090333
Git repository: http://drupalcode.org/sandbox/sanchiz/2090333.git
Drupal Version: 7.x

git clone --branch 7.x-1.x http://git.drupal.org/sandbox/sanchiz/2090333.git pathauto_i18n

Reviews of other projects

1. Ubercart Paymill Integration (module)
https://drupal.org/node/2095819#comment-7894585
2. Contentaccess Roles (module)
https://drupal.org/node/2077293#comment-7933087
3. Save Redirect On Delete
https://drupal.org/comment/8558735#comment-8558735

Comments

sanchiz’s picture

Status: Active » Needs review
sanchiz’s picture

Issue summary: View changes
sanchiz’s picture

Issue summary: View changes
rosk0’s picture

Status: Needs review » Needs work
    .
  1. Function names should not be in continuous tense - pathauto_i18n_processing_entity()(pathauto_i18n.module:11), also this is a good style to include documentation to your code that could be used outside of your module
  2. Why do you skipping only node entities if language is undefined? - pathauto_i18n.module:38
  3. Why function is called pathauto_i18n_field_configuration() when is basically a form builder? Something like pathauto_i18n_configuration_form() would be more appropriate - pathauto_i18n.module:56
  4. It's better to use condition() method instead of where() for simple IN conditions(condition('entity_id', $ids)) - pathauto_i18n.module:101
  5. Wrong function name, implementation for hook_node_load() in pathauto_i18n_node module should be called pathauto_i18n_node_node_load() - modules/pathauto_i18n_node/pathauto_i18n_node.module, check all node hooks
  6. pathauto_i18n should have taxonomy as dependency
  7. Wrong hook implementation function name - modules/pathauto_i18n_user/pathauto_i18n_user.module

Don't forget to review other requests and participate in Review bonus programm.

m1r1k’s picture

1) pathauto_i18n schema should have complex unique key: entity_id and entity_type, as you use single table for all entity types
2) If you don't need second variable here list($entity_id, $entity_vid, $bundle) - just skip it list($entity_id, , $bundle)
3) Add additional comments to pathauto_i18n_field_configuration() to avoid misunderstanding like @RoSk0 got, at least add some @see references
4) Can you add some comments for // Remove current user language.
$account->language = LANGUAGE_NONE; because it looks bad :)

sanchiz’s picture

Thanks RoSk0!

1. Fixed.
2. I also added skipping for taxonomy term. We can't to skip creating alias for LANGUAGE_NONE node and term, because they have fields which based on entity language. See pathauto_field_attach_form() in Pathauto module.
3. Fixed.
4. Fixed.
5. Fixed.
6. Fixed.
7. Fixed.

sanchiz’s picture

Thanks m1r1k!

1. Fixed.
2. Fixed.
3. Fixed.
4. Removed redundant code. Improved handler.

sanchiz’s picture

Status: Needs work » Needs review
sanchiz’s picture

Issue summary: View changes
Issue tags: +PAreview: review bonus

Added review bonus.

danepowell’s picture

Just to clarify, although Pathauto already supports path patterns for multilingual nodes, it only works for fully multilingual nodes- it doesn't work for nodes with only partial translations, or for other types of entities (according to sanchiz). This is the gap that this module fills. It would be good to include this information in the project description.

The code looks pretty good. I would write a unique @file block for each of the modules better describing their purpose. For instance, it seems like the main module doesn't actually do anything on its own, so the @file descriptor should say so- i.e. "Provides common functions and callbacks for pathauto_i18n submodules. Does not contain any hooks or provide functionality on its own."

sanchiz’s picture

Thank you, Dane Powell!

Improved @file descriptions and module description.

danepowell’s picture

Status: Needs review » Reviewed & tested by the community

Cool beans. I don't know if it's my job to mark this RTBC or not, but there you go...

sanchiz’s picture

Any updates here?

klausi’s picture

Status: Reviewed & tested by the community » Fixed

Review of the 7.x-1.x branch:

  • Coder Sniffer has found some issues with your code (please check the Drupal coding standards).
    
    FILE: /home/klausi/pareview_temp/pathauto_i18n.module
    --------------------------------------------------------------------------------
    FOUND 6 ERRORS AFFECTING 6 LINES
    --------------------------------------------------------------------------------
      5 | ERROR | Doc comment short description must be on a single line, further
        |       | text should be a separate paragraph
     24 | ERROR | There must be exactly one blank line before the tags in a doc
        |       | comment
     61 | ERROR | Paramater tags must be defined first in a doc commment
     64 | ERROR | Paramater tags must be grouped together in a doc commment
     67 | ERROR | Paramater tags must be grouped together in a doc commment
     70 | ERROR | Type hint "array" missing for $form
    --------------------------------------------------------------------------------
    
    Time: 234ms; Memory: 6.5Mb
    

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

But otherwise looks good to me, so ...

Thanks for your contribution, sanchiz!

I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

sanchiz’s picture

Thank you, klausi! I'm really happy! Thanks to all reviewers for helping!

Status: Fixed » Closed (fixed)

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