Re: Model advice, i18n and content

2007-12-12 Thread Antoni Aloy

Just an issue, I've lots of problems with Django i18n and cachés. So
if you decide not to use different urls for the language and just take
the page language from the browser or let the user to change it
manually, be careful with per-view-cache as far as I know is not i18n
friendly.

-- 
Antoni Aloy López
Binissalem - Mallorca
http://www.trespams.com
Soci de Bulma - http://www.bulma.cat

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Model advice, i18n and content

2007-12-12 Thread yml

Hello Remco,

A subset of what you are looking for is provided by this library:
  * http://code.google.com/p/django-multilingual/

I found it very easy to work with hand I was able to modify flatpage
(since this was what I was looking) in a very small amount of time.
What it will bring to you :
  * a nice admin interface to handle your multilingual content
  * The right language will be served to your user
An exemple of it can be found there : http://yml.alwaysdata.net
The content is available in 2 languages french and english.
  * I am also missing some icons to see the current language and other
languages available. Of course you could jump from one to the other by
clicking on it

I hope that will help you.

What it will not do :
 * easy to connect the same article in both languages (no idea on how
to do that)
 * the language in the url (also they were some discussion about it
there : 
http://groups.google.com/group/django-multilingual/browse_frm/thread/b05fc30232069e1d)
The output is not yet completely clear to me
  *


On Dec 12, 4:46 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> Hi Remco,
>
> ...
>
>
>
> > Now, the question. I see two obvious way to model this. Say my blog has an
> > 'Article' model.
>
> > Then:
>
> > - Either two different versions are separate Articles, the article has a
> > language code, and it has optional fields 'this_article_in_dutch' and
> > 'this_article_in_english', that lead to the other version, if it exists.
>
> > or
>
> > - One article holds both versions; they share a creation date, and have
> > separate fields for 'context_dutch' and 'content_english', same for title
> > and slug.
>
> > I think it should be the first. But I was wondering what other approaches
> > others have taken, I can't be the first one with this sort of issue.
>
> Another way of modeling this:
>
> class ArticleContainer(Model):
> "Language neutral container for an article"
> slug = SlugField(unique=True)
>
> class Article(Model):
> "Language specific article"
> container = ForeignKey(ArticleContainer)
> lang = CharField(max_length=2, db_index=True)
> #title = ...
>
> class Meta:
> unique_together = (('container', 'lang'),)
>
> def other_versions(self):
> return self.container.article_set.exclude(pk=self.pk)
>
> def comments(self):
> return self.container.comment_set.all()
>
> > Comments are an issue. In principle I'd want comments to one article also
> > appear under the other, language doesn't matter. But I'm not sure.
>
> class Comment(Model):
> "Comments are common to all language flavors of an article"
> container = ForeignKey(ArticleContainer)
> #comment = ...
>
> It's also possible to turn the Article.lang field into a ForeignKey to
> a Language reference object if you foresee needing to hang other
> objects off of a particular language.
>
> -Rajesh
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Model advice, i18n and content

2007-12-12 Thread Remco Gerlich
Hi,

Let's say I want to create yet another blog app, and I want to write
articles in multiple languages - English and Dutch, in this case.

Some articles will be English-only, some will be Dutch-only. Many articles
will be available in both languages.

People browsing in one language should see indexes, lists of articles,
categories, 'newest posts' things etc only for that language.

But it should be easy to connect the same article in both languages - if I'm
looking at an article and switch languages, and if it has a version
in the other language, the result should be to see that page.

I want to have the language code in the URL, because they're separate pages.
e.g. mysite.com/blog/en/2007/12/12/some-slug/ and
mysite.com/blog/nl/2007/12/12/een-of-andere-slug , or at some
other place in the URL (I'm totally undecided, from using the subdomain for
this to having it as the last part of the URL).

Somewhere in the back of my mind is that I might want to add a language
sometime in the future, but it's vague enough and uncertain enough that we
can ignore that possibility for now.

Comments are an issue. In principle I'd want comments to one article also
appear under the other, language doesn't matter. But I'm not sure.

Now, the question. I see two obvious way to model this. Say my blog has an
'Article' model.

Then:

- Either two different versions are separate Articles, the article has a
language code, and it has optional fields 'this_article_in_dutch' and
'this_article_in_english', that lead to the other version, if it exists.

or

- One article holds both versions; they share a creation date, and have
separate fields for 'context_dutch' and 'content_english', same for title
and slug.



I think it should be the first. But I was wondering what other approaches
others have taken, I can't be the first one with this sort of issue.

Greetings,
Remco Gerlich

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---