|
Posted by Frits van Leeuwen on 10/19/06 20:19
"Rik" <luiheidsgoeroe@hotmail.com> schreef in bericht
news:55659$45371900$8259c69c$25733@news1.tudelft.nl...
> linda wrote:
>> Hi Frits and welcome
>> to the wonders of php. I too am new to php.
>
> And Frits is battling with the same page since februari this year (or
> earlier?)... Not exactly new, but takes on a lot of known difficulties ;-)
Yes, it's a long time. First, I was start in a wrong way and second, I have
not so many time .
> To maybe give Frits a few pointers (I do admit I haven't read this thread,
> so possibly there's an overlap with other posts/possibly better
> solutions):
Sometimes I start a new thread. That's becaurse I'm not sure if someone
helps me in the way i understand and like.
> - I use TinyMCE to give users the possibilities to edit pages. Do not try
> to let them be translated tag by tag. If the users put a 'chunk' of text
> (however formatted) on your page, they should be able to format the other
> language equally.
I like to create a database. with texts and users. I know hou to handle a
database, but I do not know how I can use it in php.
> - Offcourse, on a dynamic page, there a reason for it's dynamic, and you
> have other database fields that have different translations, otherwise
> you'd be better of including static html-files.
I like to put a HTML text into a database.
> - I created a seperate table for system messages, like 'Login is
> incorrect'.
> - Determine which fields exactly have to be translated.
> - create a table with possible languages, and possibly other info (money
> formatting, dns, postal code formatting etc.)
> - create a table translations with:
> id id of row in specific table of which it is a translation
> table table name of text to be translated
> field field name of text to be translated
> language language identifier
> value translation (with or without HTML-markup, that doesn't matter)
I like to do this, but do you know a free database program to do this? What
database program can I use for users and texts?
Thanks for help for so far.
The rest of your help, Rik, is for the next pass. (how to say in good
English?) When I can create a database, I'll learn how to use it in php.
> Now, to build your page, first determine what language the user wants. I
> use, in order of precedence:
> - GET value (often obfuscated in an url, like
> http:/example.com/nl/rest/of/path/to/file.php, which is parsed by
> mod_rewrite on apache)
> - cookie (on a GET value a cookie is set/changed offcourse)
> - logged in users preference (on a change in preference offcourse a cookie
> is set)
> - HTTP header fo accepted languages (not always available for every
> browser)
> - when possible, trying to determine by referrer or remote adress suffix
> what country, and possibly what language, the user prefers.
> - is all else false, use default language
>
> Now I set the constant LANGUAGE to preferred language.
>
> On building the rest of the page, I can use queries with the set constant
> LANGUAGE that the user prefers. For instance:
>
> mysql_query'("SELECT
> x.product_id AS id
> IFNULL(y.value,x.name) AS name
> IFNULL(z.value,x.desc) AS description
> FROM products x
> LEFT JOIN translations x
> ON x.product_id = y.id
> AND y.table = 'products'
> AND y.field = 'name'
> AND y.lang = '".LANGUAGE."'
> LEFT JOIN translations z
> ON x.product_id = z.id
> AND z.table = 'products'
> AND z.field = 'desc'
> AND z.lang = '".LANGUAGE."'");
>
> True, your queries are a bit longer, but in most servers the extra time
> needed for the query is negligible.
>
> You could even add your own logic to 'degrade' to some languages by
> preference as indicated by the user (set a preference per available
> language).
> --
> Grtz,
>
> Rik Wasmus
--------------------------------------------------------------------------------
Mijn Postvak In wordt beschermd door SPAMfighter
4017 spam-mails zijn er tot op heden geblokkeerd.
Download de gratis SPAMfighter vandaag nog!
Navigation:
[Reply to this message]
|