Closed (duplicate)
Project:
Localizer
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
22 Jan 2007 at 19:20 UTC
Updated:
31 Mar 2007 at 22:17 UTC
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
Comment #1
Roberto Gerola commentedI 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.
Comment #2
ray007 commentedNot sure if it's doable, but I think the best solution is as follows:
don't write empty entries into the localizertranslations table (what are those for?)
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
this needs some database magic in a form_submit hook to make sure all strings are in the rights db-tables
do I make sense or is this all nonsense?
Comment #3
Roberto Gerola commentedYes, 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 :-).
Comment #4
ray007 commentedI'll try to help as time permits ... and will probably ask some stupid questions on the way ;-)
Comment #5
Roberto Gerola commentedYou're welcome !
If you need I can grant you access to cvs also for commits.
Comment #6
sunMarking as duplicate of http://drupal.org/node/113045