[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Fedora Websites development help

I did some thinking about the first issue this weekend.  If mod_negotiate would allow you map languages by directory structure instead of file name, the issue of running on an unconfigured site would go away.  For example, http://fedoraproject.org/en/get-fedora maps to DOCUMENT_ROOT/get-fedora.html.en.  If it could instead map to DOCUMENT_ROOT/en/get-fedora, the site would work  with unconfigured servers.

With that in mind, I did some tinkering using mod_rewrite and had some success implementing this behavior:

# If the browser prefers a language, set the prefer-language environment variable accordingly
SetEnvIf Accept-Language ^.*(ar|bal|ca|de|el|en|es|fa|fi|fr|he|id|it|ja|nl|pl|ro|ru|sk|sr).*$ prefer-language=$1

RewriteEngine on

# If the query string contains ?lang=[lang], set prefer-language and redirect
RewriteCond %{QUERY_STRING} ^lang=(ar|bal|ca|de|el|en|es|fa|fi|fr|he|id|it|ja|nl|pl|pt_BR|ro|ru|sk|sr|zh_CN)$
RewriteRule ^(?:/(?:ar|bal|ca|de|el|en|es|fa|fi|fr|he|id|it|ja|nl|pl|pt_BR|ro|ru|sk|sr|zh_CN))?(/.*)$ /%1$1? [E=prefer-language:%1,R=301]

# Pick a language directory based on prefer-language
RewriteCond %{REQUEST_URI} !^/(ar|bal|ca|de|el|en|es|fa|fi|fr|he|id|it|ja|nl|pl|ro|ru|sk|sr|static)(/|)
RewriteRule ^(/.*)$ /%{ENV:prefer-language}/$1

# If a page is missing for a non-English language, fall back to the English page
RewriteCond %{REQUEST_URI} !-U
RewriteRule ^/(ar|bal|ca|de|el|es|fa|fi|fr|he|id|it|ja|nl|pl|ro|ru|sk|sr|)/(.*)$ /en/$2

There are potentially some issues with this solution, but it at least provides some food for thought.


2008/6/12 Ricky Zhou <ricky fedoraproject org>:
Wow, thanks for all of the resposes to Max's call for volunteers!

So here's a summary of what we're looking to do with the buildscript.

Right now, we have a general process for creating the website, but it's
not pretty.  Basically, we have a build script which goes through and
just runs each page through genshi.  Unfortunately, when we throw
translations into the mix, it gets a bit complicated.

Right now, we handle translations (and the language selector) through
some Apache + mod_negotiate magic (see the bottom of
So one immediate problem here is that it's not easy for somebody to
make some changes and just scp them to their fedorapeople space (or
anywhere without some specialized apache configs present).  I have some
ideas for making this better (which would involve some modifications to
the buildscript).  Overall, the goal is to just make our process
friendlier and easier to get started with.

The other general issue that I'd like to discuss is what kind of
workflow we can establish for working with translators.  Right now,
we're just pushing English changes up immediately (which means that many
pages can be untranslated, or even partially translated).

Anyway, if anybody wants to take a look at some of these issues, you can
get the source of the website with:

git clone git://git.fedorahosted.org/git/fedora-web.git

Feel free to ask any questions on-list (or we have an IRC channel,
#fedora-websites on irc.freenode.net).  We also have weekly meetings
(see http://fedoraproject.org/wiki/Websites/Meetings for the schedule).


Fedora-websites-list mailing list
Fedora-websites-list redhat com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]