Gossamer Forum
Home : Products : Gossamer Links : Discussions :

multi-language with a twist

Quote Reply
multi-language with a twist
Ok, think I got how to do another language for templates understood. So that's not my question.

Rather, I was wondering if you are running 2 languages. Won't you have people posting links pointing to let's say to "English sites" and, if I were to have language 2, people posting to "Japanese sites" ???

Unless, I were completely bi-lingual this wouldn't be a problem but if you have people who aren't this would be a problem.

So, How can I prevent "english folk" from seeing "japanese sites" and "japanese folk" from seeing "english sites" for searches and if they want to be able to click on a link for continued searches in the other language or allow them to search for links in the other language ???



any help would be appreciated.



Quote Reply
Re: multi-language with a twist In reply to
1) Add a column called Language in the Links table:

Language (ENUM, 'English','Japanese')

Also add values in the %db_select_fields in the Links.def file.

2) Then in your search.html file, add the following codes in the FORM:

Code:

<input type="radio" name="Language" value="English"> English
<input type="radio" name="Language" value="Japanese">
Japanese


Same in the search_error.html file.

This will allow users to select a "language" of the links in your directory.

Now...if you have multiple templates working, you can add hidden fields in the appropriate search template files, like the following:

Code:

<input type="hidden" name="Language" value="English">


Of course, you will have to "update" all your links with the appropriate language value...

What you could do is set the "default" value of the column to the majority language in your directory.

And if you want to have "multiple" languages for each Link (1->M connection)...you will have to create another table (intersection) that contains the following columns:

LinkID (UNIQUE, DUPLICATES ALLOWED)
LanguageID (UNIQUE, DUPLICATES ALLOWED)

Call the table something like Language_Links

Then what you can do is create another table called Language with the following fields:

LanguageID
Language_Name

Yet, this could get complicated real quick since you would have to hack both add.cgi and modify.cgi to put the correct values in the LINKS and LANGUAGE_LINKS table. You would also have to hack the search.cgi to pull the appropriate records based on values in the Language_Links table.

I think that the easiest method would be the one I outlined above by simply adding another column in the Links table.

Regards,

Eliot Lee
Quote Reply
Re: multi-language with a twist In reply to
You'd need to pass a parameter in to search.cgi, such that it would add an "english" or "japanese" parameter to each search.

There may be a simple way to pass in the parameter from the form, but I think it might require a code tweak in search.cgi to set an added option parameter depending on whether "Language=English|Japanese|Both"

This would also require some field in your link record to know whether the link was in Japanese or English, say it's a "Language" field. If no parameter is passed in, Language is ignored, and both languages are returned. But if language is set, an additional parameter is passed in:

" AND Language = 'English'"

is set. I haven't hacked the search program enough, but I'm sure there is a way, and it might have actually been discussed :)

You don't want to pass in the field name "Language=English" for example, since that would restrict the search to that column only... that is _not_ what you want.

PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
Quote Reply
Re: multi-language with a twist In reply to
thanks I'll give it a shot.

wahoooo