When editing a menu-item right now, I have the input fields for title and descriptions in the standard form, and I have translations input-fields for all my defined languages above. That more or less means, I have 2 places to enter a string for the current locale.
Suppressing the input-field for the current locale is rather easy:

--- localizer/modules/localizermenu.module.orig 2007-01-19 18:16:43.000000000 +0100
+++ localizer/modules/localizermenu.module      2007-01-22 19:51:51.128463750 +0100
@@ -74,7 +74,7 @@
  * Implementation of hook_form_alter().
 */
 function localizermenu_form_alter($form_id, &$form) {
-
+  global $locale;
   $languages = localizer_available_uilocales();

   if ($form_id == 'menu_edit_menu_form') {
@@ -122,6 +122,7 @@
     );

     foreach($languages as $lang => $language) {
+      if($lang == $locale) continue;
       $form['translations']['localizermenu_' . $lang] = array(
       '#type' => 'fieldset',
       '#title' => t($language),
@@ -176,4 +177,4 @@
   }
 }

Haven't yet worked on the form-submission part ...

Principle question to that:
would it be a good idea, to store the string from the drupal-base language (english) always in the standard table, and only the translations to additional languages in the localizer table?
Or do we just ignore the string in the standard tables from the time we have localized entries?

Comments

Roberto Gerola’s picture

I have added also the fields of the current locale after a request.
The scenario was the following :
You have begun to build your website with English as default language
and have inserted all the translations for menu and taxonomy in English.
So, the default strings are in English.

No, you decide that your default language is German instead.
What does it happen ? All yours strings will appear in English
and you are not able to translate them to German because
your default language doesn't appear in the list of available translations
and the system consider the strings that you have inserted as default
in German language, while they are in English.

We have two options.
You could simply ignore the fieldset of the default language or
I could it make visible only by an option.

ray007’s picture

Not sure if it's doable, but I think the best solution is as follows:

  • if there's only one entry in the main menu-table and no translations exist, it's used for all languages
    don't write empty entries into the localizertranslations table (what are those for?)
  • when creating translations, we make sure to always write the english version into the main table, and only the translations into the localizer_translation table.
    that means when "creating an english translation", we copy the entries from the menu-table to the localizertranslation table, and overwrite the entries in the menu-table with the new "translated" strings
  • on the "edit menu item" page, the main-form fields should represent the value of the current locale, and we only have translations fields for the other languages.
    this needs some database magic in a form_submit hook to make sure all strings are in the rights db-tables
  • on the "edit node" page, the menu-strings are the strings for the current locale

do I make sense or is this all nonsense?

Roberto Gerola’s picture

Yes, I've thought too to a solution like your proposal.
It would be the best way to proceed.

I'll add also this to the list of the requests, that is becoming pretty huge, of course :-).

ray007’s picture

I'll try to help as time permits ... and will probably ask some stupid questions on the way ;-)

Roberto Gerola’s picture

You're welcome !
If you need I can grant you access to cvs also for commits.

sun’s picture

Status: Needs work » Closed (duplicate)

Marking as duplicate of http://drupal.org/node/113045