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
- Enable multilingual support for nodes(needs only for nodes)
- Configure alias patterns on page admin/config/search/path/patterns
- 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
Comment #1
sanchiz commentedComment #2
sanchiz commentedComment #3
sanchiz commentedComment #4
rosk0.- 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
- Why do you skipping only node entities if language is undefined? - pathauto_i18n.module:38
- 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
- It's better to use condition() method instead of where() for simple IN conditions(condition('entity_id', $ids)) - pathauto_i18n.module:101
- 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
- pathauto_i18n should have taxonomy as dependency
- 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.
Comment #5
m1r1k commented1) 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 itlist($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 :)
Comment #6
sanchiz commentedThanks 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.
Comment #7
sanchiz commentedThanks m1r1k!
1. Fixed.
2. Fixed.
3. Fixed.
4. Removed redundant code. Improved handler.
Comment #8
sanchiz commentedComment #9
sanchiz commentedAdded review bonus.
Comment #10
danepowell commentedJust 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."
Comment #11
sanchiz commentedThank you, Dane Powell!
Improved @file descriptions and module description.
Comment #12
danepowell commentedCool beans. I don't know if it's my job to mark this RTBC or not, but there you go...
Comment #13
sanchiz commentedAny updates here?
Comment #14
klausiReview of the 7.x-1.x branch:
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.
Comment #15
sanchiz commentedThank you, klausi! I'm really happy! Thanks to all reviewers for helping!