Multi Lingual cat/alb/pic titles and descriptions (experimental) Multi Lingual cat/alb/pic titles and descriptions (experimental)
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Multi Lingual cat/alb/pic titles and descriptions (experimental)

Started by Abbas Ali, July 18, 2006, 08:47:25 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Abbas Ali

This plugin allows the admin to add titles and descriptions for albums/pictures/categories in multiple langauages. The visitor can then see them in mulitple langauges when he/she changes the language.

This plugin requires to add hooks in index.php and include/functions.inc.php files. For this you will need to edit these files

Detailed instructions on how to install and use the plugin are given in the readme.txt which is present in the attached zip file. Also i am attaching the readme.txt separately for newbies.

How to install

  • First enable the plugin from cpg config if they are disbaled. Then install the plugin from plugin manager page. (As you would do for any other plugin)
  • During installation you will be asked to select the languages you want to support i.e. langauges in which you want to input the titles and descriptions.
  • Move the mod_lang.php file which is present in the plugin directory to the coppermine root directory i.e. parallel to index.php of coppermine.
  • Then edit index.php and include/functions.inc.php to add hooks for the plugin. This is the most important step and should be done carefully.

How to Use

  • You should add titles and descriptions for categories/albums/pictures as you normally do.
  • After the plugin is installed and files have been modified open http://yoursite.com/cpg_folder/mod_lang.php in a browser. You need admin perms to access this page.
  • Before adding texts for multi languages you should always synchronize the categories, albums and pictures. There are links provided on this page for the same
  • Then chose the categories, albums and pictures, for which you want to add language texts, from the drop down provided.
  • Input the language texts and press submit. You can use bbcodes.
  • The visitors will then be able to see the titles and descriptions in the language they selected.(Provided you have entered the translation in that language)
  • Whenever categories/albums/pictures are added/edited/deleted, the language table needs to be synchronized. This can be done from mod_lang.php page. This is very important to make plugin work.

How to add hooks in index.php and include/functions.inc.php

Edit index.php

Add (in function get_subcat_data)


$subcat['description'] = CPGPluginAPI::filter('lang_convert', $subcat['description']);
$subcat['name'] = CPGPluginAPI::filter('lang_convert', $subcat['name']);


just after


foreach ($rowset as $subcat) {


then Add (in function list_albums)


$alb_thumb['description'] = CPGPluginAPI::filter('lang_convert', $alb_thumb['description']);
$alb_thumb['title'] = CPGPluginAPI::filter('lang_convert', $alb_thumb['title']);


just before


if (isset($cross_ref[$aid])) {


then Add (in function list_cat_albums)


$alb_thumb['description'] = CPGPluginAPI::filter('lang_convert', $alb_thumb['description']);
$alb_thumb['title'] = CPGPluginAPI::filter('lang_convert', $alb_thumb['title']);


just before


if (isset($cross_ref[$aid])) {


-----------------------------------------------------

Edit functions.inc.php

Add (in function build_caption)


$row['caption'] = CPGPluginAPI::filter('lang_convert', $row['caption']);
$row['title'] = CPGPluginAPI::filter('lang_convert', $row['title']);


just before


$caption='';


then Add (in function breadcrumb)


$category[1] = CPGPluginAPI::filter('lang_convert', $category[1]);


just before


$breadcrumb_links[$cat_order] = "<a href=\"index.php?cat={$category[0]}\">{$category[1]}</a>";


and Add


$CURRENT_ALBUM_DATA['title'] = CPGPluginAPI::filter('lang_convert', $CURRENT_ALBUM_DATA['title']);


just before


$breadcrumb_links[$cat_order] = "<a href=\"thumbnails.php?album=".$CURRENT_ALBUM_DATA['aid']."\">".$CURRENT_ALBUM_DATA['title']."</a>";


then Add (in function get_pic_data)


$album_name = CPGPluginAPI::filter('lang_convert', $album_name);


just after


       if ((is_numeric($album))) {
               $album_name_keyword = get_album_name($album);
               $album_name = $album_name_keyword['title'];


That's it. The plugin is now ready for the use.


Note: This is experimental plugin and is in a very early (alpha) stage. Also this is not recommended for large galleries where there are thousands and millions of pictures.


Abbas


[Edit GauGau 2010-03-05]
This plugin has been added to the subversion repository: http://coppermine.svn.sourceforge.net/viewvc/coppermine/branches/cpg1.4.x/plugins/

It has been updated as well to reflect the version checking routines in the plugin manager that are meant to make sure that galleries don't break because of plugins installed that aren't meant for that particular version of the gallery.

Download: https://sourceforge.net/projects/coppermine/files/Plugins/1.4.x/cpg1.4.x_plugin_multilingual_v1.1.zip/download
[/Edit]
Chief Geek at Ranium Systems

antisa33

I am going to test this plugin and i will tell my modifications
Thanks a lot

antisa33

Hello
It seems to be a great plugin, it is easy to setup and to use.
During the setup of plugin :
Select the languages you want to use :
No french file ?  ;)
Can you explain why we have to synchronize ?
My origin lang were english, i have to check "french" to add the french language, correct ?
Here mod_lang.php, in album, i see "select category" or "User gallery". How to add the french translation on a album ?
Because here there is not my album list.
To add a lang for an album name : I think it could be easier to have the lang in this modification album page modifyalb.php?album=13 in a drop-down list (choose the langage we have setup before and fill here the new translation)
Thanks
Isa

Abbas Ali

Quote from: antisa33 on July 18, 2006, 05:29:31 PM
Select the languages you want to use :
No french file ?  ;)

The lang files shown on configuration page are taken from the lang directory. So if french.php is not there in lang directory then french won't be shown for selection. Only those langs are shown for selection whose corresponding lang files are present in lang directory.

Quote
Can you explain why we have to synchronize ?

The translations are stored in a separate table. We need to add category/album/picture titles and descriptions to this new table. For this we need to synchronize the original tables with the translation tables.

Quote
My origin lang were english, i have to check "french" to add the french language, correct ?

Yes. You can check any number of langauges in which you want the titles to be translated.

Quote
Here mod_lang.php, in album, i see "select category" or "User gallery". How to add the french translation on a album ?

First synchronize the categories/albums/pictures. Then to enter translation for albums select the category from the middle drop down box. All the albums in that category will be shown and you can then enter the translations for the albums.

Quote
To add a lang for an album name : I think it could be easier to have the lang in this modification album page modifyalb.php?album=13 in a drop-down list (choose the langage we have setup before and fill here the new translation)

For this modifyalb.php will needed to be hacked. I wanted to create a plugin instead of hack hence nothing modified on modifyalb.php
Chief Geek at Ranium Systems

antisa33

Ok i understand how it works. I am very happy to have your plugin.
The first time i went on mod_lang.php, it was possible to choose the langage to add, after running it one time, is it possible to add langages more ?

- I can't modify any album name, i have a lot of english albums, i clic on the 3 synchronise button, it works, but in the middle albums dropdown list, i just see : Albums : I can choose between "Select category" or "user galleries", but i dont see any albums.
I have the lastest version of coppermine.

- Is it possible to say to the browser to autodetect the langage of the user ?
- Is it possible than when a french user will come on my website, that english and spanish comments dont show ?

Thanks very much Abbas Ali, when your plugin will works for me, Coppermine is the best gallery i have ever seen.
Thanks
Isa

Joachim Müller

You have originally requested this plugin on the paid support board (Mod Multi langage ?), so you might consider paying Abbas Ali a fee. Please discuss payment on the other thread I refered to. If Abbas should refuse to accept money, there are other methods of giving something back - see We need your help. Thanks.

antisa33

Sure, i know that i will pay Abbas or give something !
But before i would like the plugin to work, because now, i cant modify album name and picture titles
Thanks a lot

antisa33

May be i dont see my album list because i dont have any categorie ?
When i clic in the drop down list "Pictures of Album", i see the list of my albums, when i clic in one, there is nothing, i see Manage multiple language strings but nothing behind.
Thanks
Isa

Abbas Ali

@Isa: I forgot to include the zeroth category albums... that means you found a bug in the plugin ;). I will update my first post with the new plugin soon.

As far as comments are concerned, this plugin doesn't handles them. Also browser detection and things like that are not in the scope of this plugin.

Lastly (as of now) you cannot change the languages once the plugin is installed. If you want to change the languages then uninstall the plugin and while doing so it will ask whether to keep the database table or delete. Select the option to delete the database table. And then reinstall the plugin and choose the languages you want to support.
Chief Geek at Ranium Systems

Abbas Ali

I have updated my first post with new plugin. Replace current mod_lang.php with the new one from the zip file.

Also if you could PM me your cpg admin un/pass, i will also take a look.
Chief Geek at Ranium Systems

antisa33

Hello Abbas Ali !
Thanks for the no category support  :) ! It works very well !
It is ok, but i made a mistake, and i didn't select the right langage, i have to unintall the plugin and reinstall it  :-\
Do you think in the futur you will change this ?
Because, when i will have the time, i will translate all my cpg website albums name etc in an other langage, i a would be able to add a langage this moment.
If you cant made a modification, could you explain to me, how to add a langage in the table by the hand ? (without a script ) Is it possible ?
What about the comments ? How can we do for a spanish to dont see deutch comments for example ?
Thanks a lot, i send you a private message to discuss in PV.
Isa

Abbas Ali

Ok i will try to modify the plugin so that languages can be changed later. But this will take time...

As i told you earlier comments won't be that easy to handle. It is difficult to know in what language the user entered the comment. So for now comments are not supported.
Chief Geek at Ranium Systems

antisa33

Hello Abbas,
For the comments, i think the user choose a flag at the begin, so we know what langage he is using.
I have add some translations now, but if i clic on synchronise button, will it delete my translations ? ==> No it is ok, it keep all translations
Why the synchronise buttons are not automatically loaded ?
Thanks a lot
Isa

antisa33

If somebody want to add the mod_lang.php in admin menu, in your theme.php in

// HTML template for gallery admin menu

add

Quote
<!-- BEGIN lang -->
                                <td class="admin_menu"><a href="/mod_lang.php" >Translation</a></td>
<!-- lang -->

Just after

Quote
<!-- BEGIN documentation -->
                                <td class="admin_menu"><a href="{DOCUMENTATION_HREF}" title="{DOCUMENTATION_TITLE}" target="cpg_documentation">{DOCUMENTATION_LNK}</a></td>
<!-- END documentation -->

antisa33

I found an other futur request for this great plugin.
When a user want to uload a picture on the website (/upload.php), he doesn't see his album names in his langage.
The title and description that he is adding is not store in the correct langage.
The correct flag is selected at the begin of the website, so we know what is the user langage, to store informations with good langage.


Joachim Müller

Quote from: antisa33 on July 20, 2006, 02:34:23 PM
If somebody want to add the mod_lang.php in admin menu, in your theme.php in
[...]
Will not work for all themes - this is theme-dependant.

Please don't clutter this thread with feature requests.

antisa33

Hello Abbas, i have done my french and english translations.
How can i add a langage now in the plugin  :-[
Is it possible ?
I can do it in the database if need...
Thanks

Abbas Ali

Quote from: Abbas Ali on July 20, 2006, 07:12:53 AM
Lastly (as of now) you cannot change the languages once the plugin is installed. If you want to change the languages then uninstall the plugin and while doing so it will ask whether to keep the database table or delete. Select the option to delete the database table. And then reinstall the plugin and choose the languages you want to support.
Chief Geek at Ranium Systems

antisa33

Yes but it will delete my french and english translations if i desinstall the plugin ?

Abbas Ali

Yes it will delete your current translations. I will look into it and let you know how to add a new language in few days.
Chief Geek at Ranium Systems