Possible change in $serendipity['languages'] array

Found a bug? Tell us!!
Post Reply
jemm4jemm
Regular
Posts: 15
Joined: Thu Apr 19, 2007 2:54 pm

Possible change in $serendipity['languages'] array

Post by jemm4jemm »

Currently $serendipity['languages'] array in serendipity_config.inc.php defines the list of translations to be offered. As the file is overwritten in every update, then that creates problems for those who have made a new translation, but are just testing it on their own site(s) and haven't relesed if for main code (or have any other reason to use appended list of languages).

Solution 1:
Rename $serendipity['languages'] to $serendipity['languages_global'] and create $serendipity['languages_local'] in serendipity_config_local.inc.php

And thereafter add into serendipity_config.inc.php
$serendipity['languages'] = array_merge($serendipity['languages_global'], $serendipity['languages_local']);

Solution 2:
Make the whole language list sql-based. It would be reasonable to use two tables - one for languages and another for the translations of languages names. That would lead to new benefits like the possibility to sort language names correctly in different languages but also a lot more trouble in keeping the whole thing in sync and updated.

In very simplified approach we could use this datastructure (or whatever else is reasonable):

CREATE TABLE languages (
languagecode character varying(5) NOT NULL,
codepage character varying(10) NOT NULL,
systemwide bool
);

CREATE TABLE languages_translation (
id serial NOT NULL,
fk_languages_id character varying(5) NOT NULL,
fk_languages_id2 character varying(5) NOT NULL,
name character varying(75) NOT NULL,
sorting integer
);

fk_languages_id - the translated language name
fk_languages_id2 - the language of the translation
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Possible change in $serendipity['languages'] array

Post by garvinhicking »

Hi!

I've just committed to SVN a patch so that $serendipity['languages'] can now be overriden from serendipity_config_local.inc.php (with a complete array). IMHO merging the arrays is not really required.

Solution 2 would be the nice one, but regarding performance this would simply impact too much.

Many thanks for bringing this issue up here,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
jemm4jemm
Regular
Posts: 15
Joined: Thu Apr 19, 2007 2:54 pm

Re: Possible change in $serendipity['languages'] array

Post by jemm4jemm »

garvinhicking wrote:I've just committed to SVN a patch so that $serendipity['languages'] can now be overriden from serendipity_config_local.inc.php (with a complete array).
Thanks. The amount of possible users is not so big and they probably will manage their language list also this way.
garvinhicking wrote:IMHO merging the arrays is not really required.
Well, the only benefit of using array_merge is that there will always be correct global list of supported languages as povided by s9y souce code. And with local list there will be the merged list. If new languages are added to source then it has to updaded manually into serendipity_config_local.inc.php, but with merged approach correct language list would be automatic.
jemm4jemm
Regular
Posts: 15
Joined: Thu Apr 19, 2007 2:54 pm

Re: Possible change in $serendipity['languages'] array

Post by jemm4jemm »

garvinhicking wrote:I've just committed to SVN a patch so that $serendipity['languages'] can now be overriden from serendipity_config_local.inc.php (with a complete array). IMHO merging the arrays is not really required.
Thought a while and there's interesting side-effect. This approach will probably used a lot for the purpose of having a shortlist of languages. For example just to show the most appropriate ones for that blog installation. With merged list one couldn't do this. I don't know if you are happy that the image of Serendipity as well translated blogengine may be lost at some blog sites.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Possible change in $serendipity['languages'] array

Post by garvinhicking »

Hi!

I agree, I also wanted this to be possible so that shorter language lists can be built by users.

This is a somewhat "pro-user" feature, so I'm fine if people restrict their installations to certain languages - they should be allowed to do that, but many thanks for bringing this detail to attention. :-)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply