Pages (2): 1 2   
Member
Member
NicoD   15-07-2008, 18:02
#1

Hi,

I would like to modify the database scheme to have the multilanguage support (2 languages in fact) for some fields of "albums" and "images" tables like the title and the description fields. I would like use the "dynamic-locale" plugins to switch between the 2 languages.

It's specify in the dynamic-locale documentation page that I have to create a set of custom functions to handle database strings and need a scheme for storing multiple versions of texts.

My questions...

1/ Is it possible to modify Zen Photo without lost the possibility to upgrade it in the futur ?

2/ In which file could I modify the database scheme and add title_fr and description_fr fields in the tables ?

3/ Where could I code a set of custom functions to handle database strings ?

Thank you by advance for your help.

Nico.

Member
Member
sbillard   15-07-2008, 19:21
#2
  1. Modifying the zenphoto core is always a risk. You can modify your database and add fields without much risk. Only problem would be if you happened to choose a field name that zenphoto eventually started to use.

  2. You modify the database schema directly with a tool like phpMyAdmin. You do have the "custom data" fields already in zenphoto that you could use for a second language. However that is just one field per object.

  3. You can create custom function in a file in your theme or you can create a zenphoto plugin (http://www.zenphoto.org/2008/04/zenphoto-plugin-architecture/) if the functions are to be generally used. Generally you can use the class get() and put() functions with any database field so your custom functions could do things like return $get('title_fr'); to return your French title.

Your biggest challenge is that there is no Admin support for editing your new fields. Perhaps you could consider the following idea:

Use the custom data fields that are already present. They can be edited with the admin interface. Setup a convention for how your data will be placed: for instance it could be:
title | description | ....

Then you can have your custom functions map the field into the appropriate destinations:

$translations = explode('|', getAlbumCustomData());
Then $translations[0] would be the title, $translations[1] the descriptions, etc.

Member
Member
NicoD   15-07-2008, 20:21
#3

Thank you very much sbillard for your answer, I will try to do it.

Member
Member
NicoD   16-07-2008, 21:33
#4

After a long reflection, I have decided to use unnecessary fields for my application (like credit and the city) for the translations FR/ENG concerning the title field and the descriptions field.

I have just changed the file admin.php of the zp-core to rename and move the labels for a better comprehension in the administration.

Member
Member
sbillard   16-07-2008, 21:45
#5

OK, but be aware that each upgrade the positions and names of these will revert.

Member
Member
NicoD   16-07-2008, 21:49
#6

Yes, I will have to redo the modifications each time I will upgrade ZP but there is not a lot of code changes.

I also have to code some functions like printImageCity() and getImageCredit() to have access to this informations from the image template. I have found it nowhere ... :/

Member
Member
sbillard   17-07-2008, 04:08
#7

When do you intend to go live? This discussion caused me to do some thinking. I am working on adding multi-lingual to the database items. I have a proof of concept working now, but not all fields are converted.

If you can wait, you may save a bit of effort.

Member
Member
NicoD   17-07-2008, 08:16
#8

It would be great if the title and the description fields could be translated. In fact they are the only fields that I need to translate...

With your work could I use the "dynamic-locale" plugins to switch between the 2 languages ?

If you publish it before the end of July, I could be interested by your modifications.

Member
Member
sbillard   17-07-2008, 09:03
#9

Just a little testing to do and these changes will be in the development build. Should make the end of July easily. I trust you will help with the testing!

Member
Member
NicoD   17-07-2008, 09:46
#10

Ok for the testing ;-)

Member
Member
sbillard   17-07-2008, 23:42
#11

The implementation has been released in [1969] and will show up in tonight's nightly build. To activate, find the "multi-lingual' checkbox next to the language selector on the admin gallery configuration tab. Check the box and you will have fields to enter translations for any of the zp supported languages. They do not all have to be populated. There is a fallback default whick will select the user's language if it exists falling back to the language specified by the language selector, falling back to the en_US string. (If none of these exist it will select the first non empty string.)

Please report problems through the ticket system so we can keep tabs on them. Remember that this is a brand new feature. There may be some things that don't quite work right. Let us know.

Member
Member
NicoD   18-07-2008, 07:37
#12

Thank you !
I have no time to test it before monday, so I will keep you in touch during the next week.

Member
Member
NicoD   21-07-2008, 20:13
#13

Could you please tell me the process to checkout (svn?) the revision [1969] to test it ?

Thank you by advance.

Member
Member
sbillard   21-07-2008, 20:35
#14

Visit http://www.zenphoto.org/trac/browser/trunk. At the bottom of the page is a link to download a zip archive of the revision. Revisions keep being made. This link is to the most current development release of zenphoto. You can also get what we call the "nightly" build. Visit this link http://www.zenphoto.org/files/nightly/ and pick the most recent.

Generally it is a better choice to use the nightly builds. In your case that is my recommendaton. All the language changes are in the build from 2008-07-20.

Member
Member
NicoD   22-07-2008, 17:45
#15

Thank you, for me it's a perfect job !
It's exactly what I need !

I will test more seriously and tell you if I found some problem.

Member
Member
sbillard   22-07-2008, 17:51
#16

Well, you were the inspiration for doing it. Just never had the right approach until this discussion.

Member
Member
suxab   22-07-2008, 19:48
#17

Hi all,

I am afraid that the multi-lingual titles interfere with the printImageStatistic() function. On albums whithout multi titles it works fine.

Administrator
Administrator
acrylian   23-07-2008, 16:53
#18

I have changed the function to work with the album folder as specific album parameter instead of the album title now. I also added the missing support for the multi language strings for the optional displayed titles and descriptions.

Member
Member
NicoD   29-07-2008, 15:19
#19

I have a question ... is it possible to activate only 2 languages in the BO and for the language selector in the Front ?

Administrator
Administrator
acrylian   29-07-2008, 16:45
#20

Simply deinstall the languages you don't need by removing them from the locale folder. (What is a BO?)

Pages (2): 1 2   
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.