Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 08:28 am EDT

Geeklog Forums

Release: Static Pages With Multi-Language Support


Status: offline

arthur1

Forum User
Newbie
Registered: 11/07/03
Posts: 3
Hi-

I've been hacking at GL to create a site that can switch between English and Spanish _content_ on the fly. In order to do this, I've done quite a bit of modification. Because I've definately done this as more of a hack, I'm only releasing a modified version of the Static Pages plugin for the mean time. I want to see if there is interest and support to do this correctly application wide- though, you can see my dev area which does do this here:

http://red.eggplantmedia.com/tlc/public_html/staticpages/index.php?page=2004020223513791

basically what i have done is added fields to the content entry area for spanish titles and body text (for the articles, I also added the intro text). Based on the cookie's language setting, either english or spanish content is displayed.

you can download the WAY WAY beta release here:
http://eggplantmedia.com/~arthur/StaticPagesML-0.2.tgz

if you follow the readme, this will add a second static pages to your site and add the staticpages_ml to your database. You should not run this on a production site. It's not tested enough, and it's a hack. It's working for me, but you should play with it before you trust me.

I've posted the read me file here so that you can get a sense of things. I've never ever released anything before, so I don't really know how to do this. I basically just stole the whole structure of the existing static pages install and changed it around to fit my needs. If you play with this, let me know- I'd like to hear if this is useful for people.....





Static Pages With Multi Language Support version .2
----------------------------------------------
* This hack is based on: *
* Staticpages Geeklog Plug-in version 1.3.2 *
* September 12, 2003 *
----------------------------------------------

arthur@eggplantmedia.com did the work, but this is still a major hack.

This document has been modifed to reflect the multi language support

ML = multi language. Right now, this is main/spanish support, where main can be any language. ML support means that content changes based on cookie data- if the user chooses to display the site in spanish, and there is spanish content in the ML static page they are viewing, the spanish content will be displayed. If they choose another language, the default language will be displayed.


In This Document
----------------

Welcome
List of Files with Descriptions
License
Support
How To Help
Known Issues
System Requirements and Installation
Security Issues
Uninstalling
Special Thanks

Welcome
-------
This Staticpages Geeklog Plug-in is the source code and database that is used to
for creating multi language staticpages in Geeklog. Like Geeklog this
has is released under the GNU General Public License. It is a bona fide Open
Source / Free Software project.

The 1.3.x modification have been made by: Alex Richardson. alexx@eyedocgreg.com

Original Authors: Tony Bibbs - tony@tonybibbs.com
Tom Willett - twillett@users.sourceforge.net



LIST OF FILES WITH DESCRIPTIONS
-------------------------------

FILE: /path/to/geeklog/public_html/admin/plugins/staticpages/install.php
DESCRIPTION: Will modify your database for static pages with ML support

FILE: /path/to/geeklog/public_html/admin/plugins/staticpages/index.php
DESCRIPTION: Static page editor code. Has ML support

FILE: /path/to/geeklog/public_html/staticpages_ml/index.php
DESCRIPTION: This is the code to display multi-language static pages.

FILE: /path/to/geeklog/plugins/staticpages/functions.inc
DESCRIPTION: Implements the Geeklog Plugin-API and has any common functions

FILE: /path/to/geeklog/plugins/staticpages_ml/templates/admin/editor.thtml
DESCRIPTION: Template file for displaying the static page editor. Has been edited
for ML support

LICENSE
-------
Like GeekLog, the Static Page Plug-in is licensed under the: GPL. There should be an included LICENSE file
if it really interests you (or you having trouble sleeping) go ahead a read it.

In a nice gesture you could provide a link back to Geeklog and the Static Page Geeklog Plug-in:

http://geeklog.sourceforge.net/
http://sourceforge.net/projects/geeklogplugins

SUPPORT
-------
If you have questions abou my modifications, contact me at

arthur@eggplantmedia.com

Additionally the GeekLog home page is a good source of information at:
http://www.geeklog.net

Finally, you can try the Geeklog Mailing list at:
http://lists.sourceforge.net/mailman/listinfo/geeklog-devel.


SYSTEM REQUIREMENTS AND INSTALLATION
------------------------------------
You must install this plugin-in with Geeklog version 1.3.8.x. This plug-in was
developed on 1.3.8-1 and has not been tested on earlier versions. THIS PLUGIN IS INCOMPLETE.
I HAVE NOT DONE EXTENSIVE TESTING it works for me, but your milage my very.

Geeklog 1.3.8 includes Staticpages 1.3, This distribution includes only the files needed

to upgrade from 1.3 (or 1.3.x) to 1.3.3.



UPGRADING (As noted above, this package is only used to upgrade from 1.3.x to 1.3.3)

---------
To install:

1) BACKUP YOUR EXISTING FILES FIRST. DO A DATABASE BACK UP. NOT JOKING!

2) After unziping the package, replace the following files with the files in this package.

3) Move the admin/staticpages_ml/index.php and admin/staticpages_ml/install.php files to
/path/to/geeklog/public_html/admin/plugins/staticpages_ml/
NOTE: you must use that directory name

4) Move the public_html/staticpages_ml/index.php file to /path/to/geeklog/public_html/staticpages_ml/
NOTE: you must use that directory name

5) Move: plugins/staticpages_ml/functions.inc
plugins/staticpages_ml/config.inc
plugins/staticpages_ml/language/
plugins/staticpages_ml/templates/

to /path/to/geeklog/plugins/staticpages_ml/
NOTE: you must use that directory name


6) Add the following to /path/to/geeklog/system/lib-database.php

// the ML static pages plugin
$_TABLES['staticpages_ml'] = $_DB_table_prefix . 'staticpages_ml';

you should be able to see where this fits in- there is a list of lines that are
extremely similar to this- tag it on just underneath the normal static pages entry.

7) That's it!



SECURITY ISSUES
---------------
It is up to you to properly secure your database, web server and host
settings. If you are looking for information in securing your system
some starting points that are recommended are:

http://www.php.net
http://www.mysql.com
http://www.apache.org
http://www.devshed.com
http://www.securityfocus.com
http://www.linux.com

ENJOY!







 Quote

Status: offline

amckay

Forum User
Full Member
Registered: 03/23/02
Posts: 180
I've developed websites that were multi-lingual (English, French, German) on-the-fly, and I do wish GL had features for this. But I don't think your approach is very robust - the way you added separate fields to the staticpages table. what if you want to support 3 languages? 4? 5?

I would do 1 of two things - add a separate table with a id, language and pointer to a static page. When you go to /staticpages/index.php?page=somename then have this actually look up "somename" in your table, then redirect to the proper static page based on language.

Or I would simply adopt a standard with maybe a 2 or 3 character representing each language. Use the standard ISO codes. Then when someone goes to /staticpages/index.php?page=somename it redirects to /staticpages/index.php?page=code-somename

I think the first option is most robust since the 2nd option would not allow "somename" to be multilingual.

The static pages should also automatically show links in the top right to any other versions of this page which exist in other languages.
 Quote

Status: offline

arthur1

Forum User
Newbie
Registered: 11/07/03
Posts: 3
True enough. As I said, this is a hack. I wanted to see what the interest level is to see if it justifies the time to do it right...

Basically, if there's support, what I want to do is create a language plugin which manges a seperate table of 1) languages 2) parts of geeklog that have been modified 3) names of the fields associated with each plugin. This way users would be able to add languages and set a default display language.

What I'd like to see is an abstraction of the calls to the content areas in the database- moving from $a['title'] to $a[$title_lang] which would allow a move toward real multi-language support. Then this could be done application wide, which would be a major step forward I think....

Thanks for the feed back. If you have any interested on working on development of this, I'm all ears- I know what I did isn't perfect, but I think it's a place to start a converstation....
 Quote

All times are EDT. The time is now 08:28 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content