Re: Internationalization and localization

2012-01-22 Thread Daniel Gerzo

On 21.1.2012 22:53, Radek Valachovic wrote:

but thats developer edition not released yet


well you can use https://github.com/brocaar/django-i18nurls instead 
(which is basically the same thing which was imported into django) until 
1.4 is released.



you need django 1.4 and i18n_patterns:

https://docs.djangoproject.__com/en/dev/topics/i18n/__translation/#django.conf.urls.__i18n.i18n_patterns




--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Internationalization and localization

2012-01-21 Thread Radek Valachovic
but thats developer edition not released yet

On Fri, Jan 13, 2012 at 3:21 AM, Daniel Gerzo  wrote:

> On Tue, 6 Dec 2011 16:40:42 -0800 (PST), rentgeeen wrote:
>
>  But what I want to achieve is if I give somebody link:
>>
>> it/sample/
>> en/sample/
>>
>> it will show that page in that language, now I have to choose language
>> and then go to the page and see it in that language...
>>
>
> you need django 1.4 and i18n_patterns:
> https://docs.djangoproject.**com/en/dev/topics/i18n/**
> translation/#django.conf.urls.**i18n.i18n_patterns
>
> --
> S pozdravom / Best regards
>  Daniel
>
>
> --
> 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 django-users+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Internationalization and localization

2012-01-13 Thread Daniel Gerzo

On Tue, 6 Dec 2011 16:40:42 -0800 (PST), rentgeeen wrote:


But what I want to achieve is if I give somebody link:

it/sample/
en/sample/

it will show that page in that language, now I have to choose 
language

and then go to the page and see it in that language...


you need django 1.4 and i18n_patterns:
https://docs.djangoproject.com/en/dev/topics/i18n/translation/#django.conf.urls.i18n.i18n_patterns

--
S pozdravom / Best regards
  Daniel

--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Internationalization and localization

2012-01-12 Thread Radek Valachovic
Thats what I was also thinking about to do it like that, I have couple
websites in django but still beginner learning, with django_easymode I
created entire website that translates itself just
by switching between languages /en/ /it/ etc... so I can add
unlimited...but I would like to know also your way that pretty much better
for me because I don't need to depend on 3rd party plugin..

is there a way you could send me a zip of small working example?

thanks

On Sun, Jan 1, 2012 at 7:49 AM, francescortiz wrote:

> I always create multilingual sites. What I do is inspired by django-
> modeltranslation, but I find awkward that it leaves a "default"
> language field and I prefer to have all my fields defined inside my
> models.
>
> 1. Create a field for each language and a function that returns the
> field corresponding to the client language:
>
> class MyModel(models.Model):
>title_ca = models.CharField(max_length=255)
>title_en = models.CharField(max_length=255)
>title_es = models.CharField(max_length=255)
>def title(self):
>return getattr(self, 'title_%s' % get_language())
>
> 2. In templates call the fuction that detects the language:
> {{object.title}}
>
> 2. Then, urls.py looks like this:
>   (r'^$', 'home'),
>(r'^(?P\w{2})/$', 'home'),
>
> 3. And views.py:
>
> from myapp.utils import enable_language
>
> def home(request, language=None):
>
># We don't want urls without language prefix in order to prevent
> duplicate content
>if language is None:
>return
> HttpResponseRedirect(reverse('isaweb.views.home',kwargs={'language':get_language()})
> )
>
>enable_language(request, language)
>
>return render_to_response('home.html',
> {},context_instance=RequestContext(request))
>
> 4. This goes into utils.py:
>
> def enable_language(request, language):
># Language only gets updated if it changed or is not set.
>try:
>if request.session['django_language'] != language:
>request.session['django_language'] = language
>translation.activate(language)
>request.LANGUAGE_CODE = translation.get_language()
>except KeyError:
>request.session['django_language'] = language
>translation.activate(language)
>request.LANGUAGE_CODE = translation.get_language()
>
>
>
>
> On Dec 7 2011, 3:14 am, kenneth gonsalves 
> wrote:
> > On Mon, 2011-12-05 at 19:00 -0800, rentgeeen wrote:
> > > What I want to how to translate stuff from DB, all at django official
> > > say is about static content, what I have only found is this:
> >
> > django-modeltranslation
> > --
> > regards
> > Kenneth Gonsalves
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Internationalization and localization

2012-01-01 Thread francescortiz
I always create multilingual sites. What I do is inspired by django-
modeltranslation, but I find awkward that it leaves a "default"
language field and I prefer to have all my fields defined inside my
models.

1. Create a field for each language and a function that returns the
field corresponding to the client language:

class MyModel(models.Model):
title_ca = models.CharField(max_length=255)
title_en = models.CharField(max_length=255)
title_es = models.CharField(max_length=255)
def title(self):
return getattr(self, 'title_%s' % get_language())

2. In templates call the fuction that detects the language:
{{object.title}}

2. Then, urls.py looks like this:
   (r'^$', 'home'),
(r'^(?P\w{2})/$', 'home'),

3. And views.py:

from myapp.utils import enable_language

def home(request, language=None):

# We don't want urls without language prefix in order to prevent
duplicate content
if language is None:
return
HttpResponseRedirect(reverse('isaweb.views.home',kwargs={'language':get_language()})
 )

enable_language(request, language)

return render_to_response('home.html',
{},context_instance=RequestContext(request))

4. This goes into utils.py:

def enable_language(request, language):
# Language only gets updated if it changed or is not set.
try:
if request.session['django_language'] != language:
request.session['django_language'] = language
translation.activate(language)
request.LANGUAGE_CODE = translation.get_language()
except KeyError:
request.session['django_language'] = language
translation.activate(language)
request.LANGUAGE_CODE = translation.get_language()




On Dec 7 2011, 3:14 am, kenneth gonsalves 
wrote:
> On Mon, 2011-12-05 at 19:00 -0800, rentgeeen wrote:
> > What I want to how to translate stuff from DB, all at django official
> > say is about static content, what I have only found is this:
>
> django-modeltranslation
> --
> regards
> Kenneth Gonsalves

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Internationalization and localization

2011-12-06 Thread kenneth gonsalves
On Mon, 2011-12-05 at 19:00 -0800, rentgeeen wrote:
> What I want to how to translate stuff from DB, all at django official
> say is about static content, what I have only found is this:
> 
> 

django-modeltranslation
-- 
regards
Kenneth Gonsalves

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Internationalization and localization

2011-12-06 Thread rentgeeen
I am using

EASYMODE

And that created in my DB 3 INFO textfields for each language, and
when is 1 language selected it will show particular text corresponding
to selected language.

But what I want to achieve is if I give somebody link:

it/sample/
en/sample/

it will show that page in that language, now I have to choose language
and then go to the page and see it in that language...



On Dec 6, 7:03 pm, Lachlan Musicman  wrote:
> There's no official support for translation of what you have in your
> DB - but that's because it's not a core need of most projects, coupled
> with the fact that there are a number of ways to do it, none of which
> are more correct than the other. For example - do you have a mirror db
> per language, or is each translation part of the objects in the
> original DB?
>
> Basically, it comes down to what you need, best fit, extensibility and
> personal taste.
>
> There are two projects in particular that address this issue that I'm
> aware of, django-rosetta and django-hvad. There is a third,
> django-multilingual, but it explicitly states "THIS PROJECT IS *NOT*
> SUPPORTED AND SHOULD NOT BE USED UNLESS YOU KNOW EXACTLY WHAT YOU'RE
> DOING!!!" (caps aren't mine)
>
> You can see more about them here:
>
> http://djangopackages.com/grids/g/i18n/
>
> Cheers
> L.
>
>
>
>
>
>
>
> On Wed, Dec 7, 2011 at 00:40, Andres Reyes  wrote:
> > At the moment i don't know of any official support for that kind of
> > internationalization from Django, there are a number of different Packages
> > that try to address the problem with some level of success. In one project
> > of mine i used the approach described
> > in http://snippets.dzone.com/posts/show/2979 . You must remember however
> > that in the end Django Models are only a representation of the data in your
> > database, you can design you database to handle multiple languages just as
> > you would wth PHP or any other framework.
>
> > 2011/12/5 rentgeeen 
>
> >> I have a question about internationalization -
> >>https://docs.djangoproject.com/en/dev/topics/i18n/internationalization/
>
> >> What I want to how to translate stuff from DB, all at django official
> >> say is about static content, what I have only found is this:
>
> >>http://packages.python.org/django-easymode/i18n/index.html
>
> >> Easymode
>
> >> I think there is more official way from Django no?
>
> >> thanks
>
> >> --
> >> 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
> >> django-users+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/django-users?hl=en.
>
> > --
> > Andrés Reyes Monge
> > armo...@gmail.com
> > +(505)-8873-7217
>
> > --
> > 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
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Internationalization and localization

2011-12-06 Thread Lachlan Musicman
There's no official support for translation of what you have in your
DB - but that's because it's not a core need of most projects, coupled
with the fact that there are a number of ways to do it, none of which
are more correct than the other. For example - do you have a mirror db
per language, or is each translation part of the objects in the
original DB?

Basically, it comes down to what you need, best fit, extensibility and
personal taste.

There are two projects in particular that address this issue that I'm
aware of, django-rosetta and django-hvad. There is a third,
django-multilingual, but it explicitly states "THIS PROJECT IS *NOT*
SUPPORTED AND SHOULD NOT BE USED UNLESS YOU KNOW EXACTLY WHAT YOU'RE
DOING!!!" (caps aren't mine)

You can see more about them here:

http://djangopackages.com/grids/g/i18n/

Cheers
L.

On Wed, Dec 7, 2011 at 00:40, Andres Reyes  wrote:
> At the moment i don't know of any official support for that kind of
> internationalization from Django, there are a number of different Packages
> that try to address the problem with some level of success. In one project
> of mine i used the approach described
> in http://snippets.dzone.com/posts/show/2979 . You must remember however
> that in the end Django Models are only a representation of the data in your
> database, you can design you database to handle multiple languages just as
> you would wth PHP or any other framework.
>
>
>
> 2011/12/5 rentgeeen 
>>
>> I have a question about internationalization -
>> https://docs.djangoproject.com/en/dev/topics/i18n/internationalization/
>>
>> What I want to how to translate stuff from DB, all at django official
>> say is about static content, what I have only found is this:
>>
>> http://packages.python.org/django-easymode/i18n/index.html
>>
>> Easymode
>>
>> I think there is more official way from Django no?
>>
>> thanks
>>
>> --
>> 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
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> Andrés Reyes Monge
> armo...@gmail.com
> +(505)-8873-7217
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Internationalization and localization

2011-12-06 Thread Andres Reyes
At the moment i don't know of any official support for that kind of
internationalization from Django, there are a number of different Packages
that try to address the problem with some level of success. In one project
of mine i used the approach described in
http://snippets.dzone.com/posts/show/2979 . You must remember however that
in the end Django Models are only a representation of the data in your
database, you can design you database to handle multiple languages just as
you would wth PHP or any other framework.



2011/12/5 rentgeeen 

> I have a question about internationalization -
> https://docs.djangoproject.com/en/dev/topics/i18n/internationalization/
>
> What I want to how to translate stuff from DB, all at django official
> say is about static content, what I have only found is this:
>
> http://packages.python.org/django-easymode/i18n/index.html
>
> Easymode
>
> I think there is more official way from Django no?
>
> thanks
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Internationalization and localization

2011-12-06 Thread rentgeeen
I have a question about internationalization -
https://docs.djangoproject.com/en/dev/topics/i18n/internationalization/

What I want to how to translate stuff from DB, all at django official
say is about static content, what I have only found is this:

http://packages.python.org/django-easymode/i18n/index.html

Easymode

I think there is more official way from Django no?

thanks

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.