Menu Item Save and Translate (MIST) is a small companion module to i18n_menu providing a Save and Translate button on a menu's Add link page when the menu translation mode is set to Translate and Localize.

The normal i18n_menu translation process requires manually finding again which menu link to translate, 3 clicks and 2 pages loads making the process very slow, painful and error prone.

MIST fixes that by cycling through all languages during link creation allowing a very fast translation process when manually adding menu links. When clicking on Save and Translate, MIST will load the "add link" form with the next language pre-selected, in weighted order.

UI configuration

MIST's default behavior is to cycle through all untranslated languages in their weighted order. There is a UI configuration to change this behavior and load the Translation overview page instead of the next language.

Similar modules

I was not able to find a module that did this, so I created it. While i18n provides a Save And translate button for taxonomies and blocks, it doesn't provide one for menu links.

Project links

Project page: https://www.drupal.org/sandbox/ptsimard/2403577

Git access: git clone --branch 7.x-1.x http://git.drupal.org/sandbox/ptsimard/2403577.git

Comments

ptsimard’s picture

Issue summary: View changes
ptsimard’s picture

Issue summary: View changes
ptsimard’s picture

Issue summary: View changes
PA robot’s picture

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

mihai_brb’s picture

Status: Needs review » Needs work

Hello ptsimard,

Manual Review

Individual user account
[Yes: Follows] the guidelines for individual user accounts.
No duplication
[Yes: Does not cause] module duplication and/or fragmentation.
Master Branch
[Yes: Follows] the guidelines for master branch.
Licensing
[Yes: Follows] the licensing requirements.
3rd party assets/code
[Yes: Follows] the guidelines for 3rd party assets/code.
README.txt/README.md
[No: Does not follow] the guidelines for in-project documentation and/or the README Template.
Code long/complex enough for review
[Yes: Follows] the guidelines for project length and complexity.
Secure code
[Yes: Meets the security requirements.]
Coding style & Drupal API usage
[List of identified issues in no particular order. Use (*) and (+) to indicate an issue importance. Replace the text below by the issues themselves:
  1. (+) Please add the path to module config in the info file.
  2. You do not need to set the variable in hook_install, just use the default value trough variable_get.
  3. I get the "Save and Translate" only for new menu items, could this be added to existing items?

This review uses the Project Application Review Template.

Thank you,

jepster_’s picture

Automated Review

Review of the 7.x-1.x branch (commit a35e618):

No automated test cases were found, did you consider writing Simpletests or PHPUnit tests? This is not a requirement but encouraged for professional software development.

Manual Review

Individual user account
[Yes: Follows] the guidelines for individual user accounts.
No duplication
[Yes: Does not cause] module duplication and/or fragmentation.
Master Branch
[Yes: Follows] the guidelines for master branch.
Licensing
[Yes: Follows] the licensing requirements.
3rd party assets/code
[Yes: Follows] the guidelines for 3rd party assets/code.
README.txt/README.md
[Yes: Follows] the guidelines for in-project documentation and/or the README Template.
Code long/complex enough for review
[Yes: Follows] the guidelines for project length and complexity.
Secure code
[Yes: Meets the security requirements.

This review uses the Project Application Review Template.

ptsimard’s picture

Status: Needs work » Needs review

Thanks for the feedback!

@mihai_brb:

From your feedback, I implemented the 2 following changes:

Please add the path to module config in the info file.

You do not need to set the variable in hook_install, just use the default value trough variable_get.

I also tweaked the readme a bit.

As for

I get the "Save and Translate" only for new menu items, could this be added to existing items?

I'm not sure I understand your issue. I tried to replicate it but I get the correct behavior (the button is there) when translating an existing menu item in a menu set to "Translate and Localize".

ptsimard’s picture

Also fixed a refactoring regression, see: commit eef614a

PA robot’s picture

Status: Needs review » Needs work

Git clone failed for http://git.drupal.org/sandbox/ptsimard/2403577.git while invoking http://pareview.sh/pareview/httpgitdrupalorgsandboxptsimard2403577git

Git clone failed. Aborting.

I'm a robot and this is an automated message from Project Applications Scraper.

ptsimard’s picture

Status: Needs work » Needs review

Got home PA robot, you're drunk.

stefan.r’s picture

I have installed this module and confirmed it works as described. Seems like it could be useful for content/menu managers!

Automated Review

[Review of the 7.x-1.x branch (commit 9ed9514):

No automated test cases were found, did you consider writing Simpletests or PHPUnit tests? This is not a requirement but encouraged for professional software development.

Manual Review

Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
Yes: Does not cause module duplication and/or fragmentation.

However: do you intended to submit this as a patch to i18n_menu once it's stable? (given that apparently blocks and taxonomies do have this functionality already)

Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements.
3rd party assets/code
Yes: Follows the guidelines for 3rd party assets/code.
README.txt/README.md
Yes: Follows the guidelines for in-project documentation and/or the README Template.
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
Yes: Meets the security requirements.

Just a nitpick: menu_link_load($_GET['translation']); <-- menu_link_load already does an is_numeric() check, but it's good practice to sanitize raw _GET input before feeding it to drupal core functions anyway.

Coding style & Drupal API usage
Upon review all the pointed out issues have been fixed! Just some nitpicks:
  1. "by adding a Save and translate button modes of operation" <-- spelling
  2. $translations = $form['translation_set']['#value']->get_translations(); <-- check that you can actually run the get_translations() method on the object, just in case the API changes in the future
  3. The button seems to only appear for new links, not when editing links (where it may also be useful)

This review uses the Project Application Review Template.

stefan.r’s picture

Status: Needs review » Reviewed & tested by the community
ptsimard’s picture

Thank stefan.r for your helpful review!

I want to let you know I improved the module greatly today and committed the changes. Here is a rundown of your comments and my improvements:

However: do you intended to submit this as a patch to i18n_menu once it's stable? (given that apparently blocks and taxonomies do have this functionality already)

Yes, I would like to do that eventually but I still want to submit this as an add-on module for now as it might be simpler to customize the behavior.

Just a nitpick: menu_link_load($_GET['translation']); <-- menu_link_load already does an is_numeric() check, but it's good practice to sanitize raw _GET input before feeding it to drupal core functions anyway.

Added a is_numeric($_GET['translation']) check in the conditional before the menu_link_load(). It should fail before getting to that function.

"by adding a Save and translate button modes of operation" <-- spelling:

Changed the text.

$translations = $form['translation_set']['#value']->get_translations(); <-- check that you can actually run the get_translations() method on the object, just in case the API changes in the future

Added a helper function checking that the method exists or logging to watchdog. Also helped streamline the code. Not certain if method_exists() is the recommended for this but it seems to work.

The button seems to only appear for new links, not when editing links (where it may also be useful)

Added the 'edit' mode functionality. The button will now appear when editing an existing link. This was a bit trickier than I expected and ad repercussion with my use of $_GET['translation'] elsewhere in the code. Added a stored value in form_state to mitigate that.

stefan.r’s picture

Cool, just reiterating RTBC status.

If you want one of the git admins to have a look at this, go get that Review bonus :)

cweagans’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for your contribution!

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.

ptsimard’s picture

Awesome! Thank you very much!

Status: Fixed » Closed (fixed)

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