Closed (fixed)
Project:
Localizer
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
30 Dec 2006 at 10:24 UTC
Updated:
1 Feb 2007 at 14:38 UTC
Jump to comment: Most recent file
Translation support for variables like : mission, footer, and so on
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | localizer_settings.png | 23.08 KB | restyler |
| #5 | localizer_0.patch | 925 bytes | restyler |
| #1 | localizer.patch | 898 bytes | restyler |
Comments
Comment #1
restyler commentedI'm creating localizervars.module to get site variables translated.
I'm using localizer d5 v1.6
Function localizer_get_objstrs() doesn't work, and it seems to me that no modules use it.
Is it the correct function to get all 'variable' objects from `localizertranslation` by one db query ?
I've fixed the function and now I think it works like it _should_ work, though I'm not 100% sure :)
Comment #2
Roberto Gerola commentedThank you very much.
But which version are you using ?
Can I ask you to use the latest cvs version for writing patches ?
The code in your patch has been already changed.
It seems to me that the code patched is a bit old.
Download from the cvs the sources with the tag DRUPAL-5,
if you want to contribute.
Thanks again.
Comment #3
Roberto Gerola commentedFor a variable, because we have to translate only its value, it would be sufficient to use :
localizer_get_objfieldtr($object_name, $object_key, $object_field, $locale)
or
function localizer_get_currobjfieldtr($object_name, $object_key, $object_field)
to read the value in the current locale.
The variables are stored in global variable $conf.
We need also a configuration section where to specify which variables
need to be translated.
Thanks
Comment #4
restyler commentedThank you for fast reply.
localizer_get_objfieldtr() is the function that can get only one variable. I don't want to overload the db by these unnecessary queries, so I think it will be a good idea to use simple
$result = db_query("SELECT * FROM {localizertranslation} WHERE object_name = 'variable' AND locale='%s'", $locale);
I need the localizervars.module really urgently, that's why I was going to take the i18n way of variable translation interface... do you have any other ideas?
Comment #5
restyler commentedpatch to fix localizer_get_objstrs(), against cvs version.
I'm not sure if I should change the status of the thread, but I'll do that..
Comment #6
restyler commentedHere is the alpha version. Roberto, I hope you can check it and tell if everything is in the 'right' way :)
http://russianwebstudio.com/other/localizervars-5.x-0.1-dev.zip
Comment #7
Roberto Gerola commentedThank you very much for your effort.
I'll take a look to you code during the next weekend and hope to be able to integrate it
very soon.
I have to check the cvs because the function you are patching it seems to me
a bit old. I'll try to download the sources again from the cvs and I'll verify
they match with my development version.
This is the last cvs version of localizer.module file for branch DRUPAL-5
http://cvs.drupal.org/viewcvs/drupal/contributions/modules/localizer/loc...
As you can see the definition of the function has been already corrected some time ago
Comment #8
Roberto Gerola commentedI have taken a deeper look to your code for variables support.
It is a very good start point. Thanks.
As user I don't like to specify the variables to translate
in the settings.php.
I think that perhaps the best solution would be to prepare a translation
interface similar to that used for menus.
I mean, something like this : http://www.speedtech.it/files/images/localizer_menuitem.png
but implemented in the general settings page.
I would like also to integrate the proposal of Ray for this type of translation interfaces :
http://drupal.org/node/111773
I think we have to subsitute the init hook with the menu hook, otherwise
we could encounter some errors on some installations.
Take a look here :
http://api.drupal.org/api/4.7/function/hook_init
This hook is already present in localizermodule.
I'll add you code there, so we have an unique place
where all the initializations have effect.
Let me know what do you think !
Comment #9
restyler commentedI think it will make the settings page really huge.. and you'll need to check variables size/type to generate translation fields.
Yes, I think it's a good idea. The Drupal caching way just seems a bit vague for me.. that's why I've tried to make it simpler ;)
May be you can suggest better way? I think it's the most flexible way for now. You can't append controls to each variable to enable/disable variable translation... there is the way to let user insert variables list somewhere in localizer settings, but he needs to know variable names, at least.
Comment #10
Roberto Gerola commented>I think it will make the settings page really huge.. and you'll need to check variables size/type to generate translation fields.
Yes the size/type would be hardcoded, but also the variable on settings page are fixed and hardcoded.
Simply a fieldset collapsed.
The best way would be to have a tabbed interfaces.
>May be you can suggest better way? I think it's the most flexible way for now.
Yes. An interface under localizer settings where the user can select which variable he/she want to translate.
And also a generic management console where the user can manage all the translations of all the variables,
menus, taxonomy and so on.
Comment #11
restyler commentedI think that this approach is a bit better than approach with collapsible fields
Comment #12
Roberto Gerola commentedYes, absolutely.
It should work like the switching block.
I'll take a look at the Forms API to see what we can do.
Comment #13
Roberto Gerola commentedI've taken a look also to Ray patch for menu.
It goes in the same direction you propose : switch language and you can insert the translated strings.
So, I think that I'll follow this way.
It simplify the interface a lot and reduce the confusion for the user.
We can work on the menu input filed on node page in the same manner :
"overriding the input field".
Comment #14
Roberto Gerola commentedComment #15
Roberto Gerola commented