Advanced search  

News:

cpg1.5.46 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter recently discovered vulnerabilities. It is important that all users who run version cpg1.5.44 or older update to this latest version as soon as possible.
[more]

Pages: [1] 2 3   Go Down

Author Topic: Multi Lingual cat/alb/pic titles and descriptions (experimental)  (Read 70521 times)

0 Members and 1 Guest are viewing this topic.

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems

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)

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

just after

Code: [Select]
foreach ($rowset as $subcat) {

then Add (in function list_albums)

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

just before

Code: [Select]
if (isset($cross_ref[$aid])) {

then Add (in function list_cat_albums)

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

just before

Code: [Select]
if (isset($cross_ref[$aid])) {

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

Edit functions.inc.php

Add (in function build_caption)

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

just before

Code: [Select]
$caption='';

then Add (in function breadcrumb)

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

just before

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

and Add

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

just before

Code: [Select]
$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)

Code: [Select]
$album_name = CPGPluginAPI::filter('lang_convert', $album_name);

just after

Code: [Select]
       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]
« Last Edit: March 05, 2010, 07:42:52 am by Joachim Müller »
Logged
Chief Geek at Ranium Systems

antisa33

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 181
    • Free french kids coloring
Re: Multi Lingual cat/alb/pic titles and descriptions (experimental)
« Reply #1 on: July 18, 2006, 02:28:06 pm »

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

antisa33

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 181
    • Free french kids coloring
Re: Multi Lingual cat/alb/pic titles and descriptions (experimental)
« Reply #2 on: July 18, 2006, 05:29:31 pm »

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
« Last Edit: July 18, 2006, 05:35:27 pm by antisa33 »
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Multi Lingual cat/alb/pic titles and descriptions (experimental)
« Reply #3 on: July 19, 2006, 07:31:28 am »

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
Logged
Chief Geek at Ranium Systems

antisa33

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 181
    • Free french kids coloring
Re: Multi Lingual cat/alb/pic titles and descriptions (experimental)
« Reply #4 on: July 19, 2006, 04:53:49 pm »

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
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Multi Lingual cat/alb/pic titles and descriptions (experimental)
« Reply #5 on: July 19, 2006, 05:10:32 pm »

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.
Logged

antisa33

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 181
    • Free french kids coloring
Re: Multi Lingual cat/alb/pic titles and descriptions (experimental)
« Reply #6 on: July 19, 2006, 08:21:10 pm »

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
Logged

antisa33

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 181
    • Free french kids coloring
Re: Multi Lingual cat/alb/pic titles and descriptions (experimental)
« Reply #7 on: July 19, 2006, 10:43:38 pm »

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
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Multi Lingual cat/alb/pic titles and descriptions (experimental)
« Reply #8 on: July 20, 2006, 07:12:53 am »

@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.
Logged
Chief Geek at Ranium Systems

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Multi Lingual cat/alb/pic titles and descriptions (experimental)
« Reply #9 on: July 20, 2006, 07:45:20 am »

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.
Logged
Chief Geek at Ranium Systems

antisa33

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 181
    • Free french kids coloring
Re: Multi Lingual cat/alb/pic titles and descriptions (experimental)
« Reply #10 on: July 20, 2006, 01:35:46 pm »

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
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Multi Lingual cat/alb/pic titles and descriptions (experimental)
« Reply #11 on: July 20, 2006, 01:53:52 pm »

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.
Logged
Chief Geek at Ranium Systems

antisa33

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 181
    • Free french kids coloring
Re: Multi Lingual cat/alb/pic titles and descriptions (experimental)
« Reply #12 on: July 20, 2006, 02:16:05 pm »

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
« Last Edit: July 20, 2006, 02:36:45 pm by antisa33 »
Logged

antisa33

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 181
    • Free french kids coloring
Re: Multi Lingual cat/alb/pic titles and descriptions (experimental)
« Reply #13 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

// 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 -->
Logged

antisa33

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 181
    • Free french kids coloring
Re: Multi Lingual cat/alb/pic titles and descriptions (experimental)
« Reply #14 on: July 31, 2006, 03:36:11 pm »

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.

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Multi Lingual cat/alb/pic titles and descriptions (experimental)
« Reply #15 on: July 31, 2006, 08:30:53 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.
Logged

antisa33

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 181
    • Free french kids coloring
Re: Multi Lingual cat/alb/pic titles and descriptions (experimental)
« Reply #16 on: September 08, 2006, 01:23:08 am »

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
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Multi Lingual cat/alb/pic titles and descriptions (experimental)
« Reply #17 on: September 08, 2006, 07:08:00 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.
Logged
Chief Geek at Ranium Systems

antisa33

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 181
    • Free french kids coloring
Re: Multi Lingual cat/alb/pic titles and descriptions (experimental)
« Reply #18 on: September 08, 2006, 02:01:18 pm »

Yes but it will delete my french and english translations if i desinstall the plugin ?
« Last Edit: September 08, 2006, 02:22:00 pm by antisa33 »
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Multi Lingual cat/alb/pic titles and descriptions (experimental)
« Reply #19 on: September 08, 2006, 02:19:57 pm »

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.
Logged
Chief Geek at Ranium Systems
Pages: [1] 2 3   Go Up
 

Page created in 0.024 seconds with 22 queries.