Page 1 of 1

Ideal multilingual blog - features/suggesstions

Posted: Fri Mar 31, 2006 2:09 pm
by nightly
Hi everyone,

I'd like to share my ideas on an ideal multilingual blog - and get your opinion on how good/bad some suggestions are, and how likely some of them are to be implemented in s9y?

Just to give you an example, the blog is running already - http://solaris.reys.net. It's in Russian, utf-8. I also have an English variant of the same blog found here: http://solaris.reys.net/english. All the functionality is based off the not-so-recent version of the multilingual plugin by garvin, with some tweaks. Most of my ideas/wishes are already implemented, but trust me, they're the ugliest hacks imaginable as I don't know all of s9y inner workings and am usually too busy to do things properly :( That's why I'm showing what it could be like and asking for your judgement, maybe some developers will find time to make it happen some day.


So, here's the list of features:

1) Default language of the blog is accessible at the main URL of the blog:
http://solaris.reys.net

2) Any secondary languages are accessible through meaningful customizable next level directories in the URL, like:
http://solaris.reys.net/english
http://solaris.reys.net/spanish

This /english or something for each language is the only thing different from the default language links. So, you can take ANY url found on the blog, stick /english at the beginning of the path in it, and it should open you the very same page, only in English language.

THE IDEA is that not only you should be able to select a language from the sidebar plugin (and then it will be stored in your current session variables), but you should be able to give permalinks with /english to someone else, and they will open the English page of the entry automatically.

3) It should be an option of a multilingual (or s9y) configuration to turn the behaviour of translation links when showing blog entries. So, it's a boolean value which means "when showing an entry in a particular language, please show links to all the rest existing translations of the same entry"

4) All the URLs are permalinks. For default language, it's just the permalink, like this:
http://solaris.reys.net/2006/03/new_features_on_my_blog
for other languages, it's with the same next level directory for the language:
http://solaris.reys.net/english/2006/03 ... on_my_blog

the KEY is that any secondary language permalink is EXACTLY the same as the default one, only with some directory name for the language.

Permalinks are used everywhere:
- in RSS
- in "other languages for the entry" links
- in comments/trackbacks

This is a lot of changes to the code, but it's vital to make site competitive enough in search engines optimization

5) Main blog title and subtitle exist in all the languages forms you have present. So, I have title/subtitle in Russian, and the same title/subtitle in English. They're shown accordingly on pages

6) Quick search (livesearch) for multiple languages - I've seen Garvin made it happen just few days ago, I've yet to check it out. But one of the things to be changed is to provide permalinks.


That seems to be it. I'll update this post when I remember more. It may seem to be a lot of work, but trust me it's not. After all, I'm redoing all of my hacks in just few hours every time I'm upgrading my blog. It's just that I can't do it properly and share it with you all, so it has to be some developer who makes these things happen once and forever, properly and most efficiently.

pS: yes, I'm obsessed with permalinks. If it seems like an overkill to some of us, let's make these permalinks more flexible - like, have few boolean flags to control where should permalinks be used - in comments, in feeds, etc. And where they're not used, then we'll see the usual links or archive links.

Thanks for your time and comments!
Nightly

Posted: Fri Mar 31, 2006 9:11 pm
by carl_galloway
ooh, be still my beating heart, nightly those are wonderful suggestions. If they could be fully integrated into serendipity I would be very happy. Hope Garvin agrees with you.

Posted: Fri Mar 31, 2006 10:16 pm
by garvinhicking
In fact I've had conversations with Nightly about this a few months ago. I do agree all can be solved with s9y's permalink functionality. I do agree those changes would be terriffic.

But sadly my time schedule and personal interests currently do not allow me to do that work; of course I could give as much feedback as I can.

Best regards,
Garvin

Posted: Mon Apr 03, 2006 11:26 am
by nightly
Garvin, I think if we at least agree on some points of my feature list, that's going to be a good progress already.

What I'm saying is that if we agree how exactly data should be represented (like how should different permalinks look for different languages), this would be enough.

The questions I have are these (you'll probably be able to answer most when you have time):

1) Is this a good idea to store various languages permalink bits in a separate table of the database? In the table which will connect the language code like en, ru or de to the bit added at the beginning of the perlmalink - like english, russian or anything else you want?


2) We want only 1 .htaccess rewrite rule to handle all the languages, don't we? Any ideas how we do this?

So far I have this, but that's only for English as you can see:
RewriteRule ^english index.php?serendipity[lang_selected]=en [L,QSA]


3) For the default language, it's REALLY important for me it has nothing at the beginning of the permalink. I guess that kind of conflicts with 2) above. Again, what options do I have? May I have it as a configurable option of something for the multilingual plugin?
As I said, it's already live and working on my blog - but I would really love to make it a standard feature so that I don't have to rewrite so much of the code every time I upgrade.


4) What language selection variables are there? Which one should I depend on when translating entries? From the rule above it's seen that I'm using lang_selected.

Can someone give me a full list of all the language-specific variables, session wide ones included?

That's all I can think of. Once I know the answers, I will be able to transform at least some of the hacks of mine into something standard, and put them back into the source tree. It may not happen overnight, but at least I'll know some things are slowly getting done.

Posted: Mon Apr 03, 2006 12:30 pm
by garvinhicking
Hi!
1) Is this a good idea to store various languages permalink bits in a separate table of the database? In the table which will connect the language code like en, ru or de to the bit added at the beginning of the perlmalink - like english, russian or anything else you want?
I think this would be the best thing, yes. Then we would not need to swamp the serendipity_config table with those options, and give people the flexibility to use "/de" or "/german" or "/deutsch" or whatever for their language, and have absolute control over that.
2) We want only 1 .htaccess rewrite rule to handle all the languages, don't we? Any ideas how we do this?
Yes, precisely. Something along the lines of:

Code: Select all

RewriteRule ^(de|en|it)?/?archives([/A-Za-z0-9]+)\.html index.php?url=/archives/$1.html [L,QSA]
The rewrite rules does not need to do so much than just catch the pattern and throw it at index.php

Index.php then needs to preg_match the REQUEST_URI and then needs to extract the language.

It needs some constant prefix or so, because else if your language bit is "german" and you write an entry entitled "German" it should not match on the title, but just on the path string.

Like if my URL is /archives/german/english.html, the entry title is "English" and its written in German. So it needs to be matched. That's the reason why having a constant prefix like /archives/english/in/german.html would be nifty. Then matching on the "/in/XXX/" could be made easier.
3) For the default language, it's REALLY important for me it has nothing at the beginning of the permalink. I guess that kind of conflicts with 2) above. Again, what options do I have? May I have it as a configurable option of something for the multilingual plugin?
Having a default fallback when no "/in/XXX/" is found shouldn't be a problem. It could then just fall back to the default language.

Either way, when introducing the new language hooks, backwards compatibility needs to be maintained, because cool URIs don't change. So your feature request is actually an item that needs to be implemented, because I don't like to break compatibility with old links here. :)

What that prefix looks like, I can't decide. Since it needs to be backwards compatible, it should be prefixed to the "/archives" url. Something along the lines of just using "/german/archives/..."? The "/in/XXX/" looks nice, but is IMHO not so usable for endusers?
4) What language selection variables are there? Which one should I depend on when translating entries? From the rule above it's seen that I'm using lang_selected.
The languages that account for it should be:

$serendipity['lang'] / $serendipity['GET']['lang_selected'] / $serendipity['COOKIE']['serendipityLanguage'] / $_REQUEST['user_language'] - The currently used language. This language file will be included from Serendipity. Variables can come from user input.

$serendipity['charset'] - The charset ("" or "UTF-8/")

$serendipity['default_lang'] - The configured default language of the s9y blog

$serendipity['content_lang'] - Contains the user-selected language choice that may be different than the blogs configured default language.

Multilingual plugin:

$serendipity['GET']['lang_display'] - Multilingual plugin uses this to indicate the language for an entry

$_SESSION['last_lang'] - Indicates the last used language by a user for followup-page requests.

HTH,
Garvin

Posted: Mon Apr 03, 2006 2:46 pm
by nightly
Thanks a lot, Garvin! Everything I wanted to know, answered in the best way possible, as usual! :)

Posted: Thu May 11, 2006 2:31 pm
by nightly
Hello again.

Garvin, do you have any plans on making the permalinks functionality be part of the core s9y functions? After looking into code for a bit more, I don't think I can do this. But if you had the permalinks integrated, I then could make the necessary changes in other parts of s9y to bring us closer to the multilingual ideal :)

I'm just asking at this stage, if you had permalinks anywhere in your future plans at all.

Thanks,
Nightly

Posted: Thu May 11, 2006 2:45 pm
by garvinhicking
Hi!

I personally have no plans to do that myself. But if anyone did, and the implementation would work inside the core, I'd have no objections to put it into the core. As long as it has no severe performance drawbacks to people not using multilingual permalinks, and as long as the implementation doesn'T require people to alter their permalinks.

Currently, working on the permalinks is not really on my personal radar, I'm sorry. :-) Mostly this is because I'm having no personal motivations to use the feature. But I surely recognize this feature as being very important, so if there was any factual help I could do, or any part of code that I should look at, improve, comment, or specific functions to write, I would do that of course.

Best regards,
Garvin

Posted: Thu May 11, 2006 5:04 pm
by nightly
Thanks for this, Garvin!

We'll get there, one way or another! :)

Nightly