CVS edit link for wadmiraal

I wrote a module that tries to improve on this: http://drupal.org/node/313276 . It's cumbersome and not very effective to create one book per language.

This module (which would still be in Beta, obviously) allows users to translate book pages in any given language, withouth adding the translation to a new book outline.

When viewing the translated node, the module checks wether the original node is in a Book outline, reconstructs the Book navigation (Book navigation in block and in node footer). It then uses this navigation tree to construct a new one with links to the translated nodes, in identical order. It then shows this tree in the footer book navigation and inside a new Book navigation block.

Thus, we have a fully multilingual book, with just one outline to manage.

This module came to be because we wrote some custom code for a client who wanted to translate the entire site's content in 6 different languages by importing CSV files. Because the book module is heavily used, creating a new outline for each language was not really an option. It had to be done automatically, and the client only had to manage one outline. It is still in alpha though, as the site won't launch before a few months.

We hope this will help some other people.

Kind regards,

Wouter Admiraal

Comments

wadmiraal’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new4.12 KB

Here it is.

avpaderno’s picture

Issue tags: +Module review

Hello, and thanks for applying for a CVS account. I am adding the review tags, and some volunteers will review your code, pointing out what needs to be changed.

wadmiraal’s picture

Up !

No one interested in a module that handles book translations effectively ?

wadmiraal’s picture

StatusFileSize
new4.8 KB

New version, with some better memory usage.

Hope someone will take the time to review this. I really think it can be very helpfull for many people with multilignual websites out there. Just one book outline to manage, for as many languages as you want !

svendecabooter’s picture

  • .module line 10 & 11: title and description shouldn't be run through the t() function
  • Use Coder module to make sure your module follows Drupal coding standards.
  • Add an .install file that implements hook_uninstall, to perform the necessary variable_del() calls to clean up variables set by your module
  • Preferably add the settings page in a separate file to avoid unnecessary code execution. Also make use of system_settings_form to save variables.

    In short:
    - change hook_menu:

      return array(
        'admin/settings/i18n-book-navigation' => array(
          'title' => t('i18n Book navigation'),
          'description' => t('Settings'),
          'page callback' => 'drupal_get_form',
          'page arguments' => array('_i18n_book_navigation_settings_form'),
          'access arguments' => array('access administration pages'),
          'type' => MENU_NORMAL_ITEM,
          'file' => 'i18n_book_navigation.admin.inc',
        )
      );
     

    - add i18n_book_navigation.admin.inc and move function _i18n_book_navigation_settings_form() there
    - at the end of _i18n_book_navigation_settings_form(), use return system_settings_form($form); instead of return $form;
    - remove function _i18n_book_navigation_settings_form_submit() as it's obsolete now

Kind regards,
Sven

avpaderno’s picture

Status: Needs review » Needs work

I am changing status as per previous comment.

wadmiraal’s picture

Status: Needs work » Needs review
StatusFileSize
new5.37 KB

Hi Sven, and thanks for the review and tips.

Here's a new version with the changes you suggested.

wadmiraal’s picture

Up...

wadmiraal’s picture

Up...

wadmiraal’s picture

Up again...

drupalshrek’s picture

Status: Needs review » Needs work

Hi,

Yes, it's quite quiet here I know. I'm just doing a bit of basic module review whilst...waiting to have my module reviewed.

A couple of things I noticed:
a) module should include a README.txt. This for me is the most important file because 90% of users won't be able to read the code. I'd suggest to look at other README.txt files to see what they include. I would suggest: what the module does, how to install [assume yours is the first module anybody has ever installed], how to administer, how to use.

b) I see you use t() on #title strings:

  $form['i18n_book_navigation_settings'] = array(
    '#type' => 'textfield',
    '#title' => t('Generate different navigation blocks'),

I don't think this is needed. Can anybody else clarify?

avpaderno’s picture

Status: Needs work » Needs review

Form field titles need to be passed to t(); it's the menu titles and descriptions that don't need to be passed to that function.
The README.txt file is preferable, but it is not required (nor is it reported in http://drupal.org/node/539608).

wadmiraal’s picture

Thanks to both for taking some time :-).

I hope to get back to reviewing some modules as well, but I'm really busy lately.

drupalshrek’s picture

Ha, ha! Yes, that's the problem. We're all busy folk. Too many folk who want their module reviewed and not enough who want to give their time to reviewing :-(. Hooray at least for kiamlaluno!! If it weren't for him, I think this queue would pretty much stop.

WebNewCastle’s picture

Ditto on the Kudos for Kiamlaluno. Awesome work and commitment. :-)

wadmiraal’s picture

I should mention that this does not work with node access modules (yet).

Meaning, links to nodes for which the user has no access rights will be visible (but obviously it will see an "Access denied" message when clicking). This will be in the to do list as soon as the CVS account get's approved. The thing is it rebuilds a menu tree from scratch, so node access modules are not aware of it (yet).

Cheers to all.

avpaderno’s picture

Status: Needs review » Fixed

Welcome on board!

jvieille’s picture

subscribe

wadmiraal’s picture

Project created.

Go to the project page

Status: Fixed » Closed (fixed)
Issue tags: -Module review

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

avpaderno’s picture

Component: Miscellaneous » new project application
Assigned: Unassigned » avpaderno
Issue summary: View changes
Status: Closed (fixed) » Fixed

Status: Fixed » Closed (fixed)

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