Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Jan. 7, 2011 15:20:30

Mo M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

i18n django models


Hello,

in my design there are some models where I need to store certain fields in
different languages. I was wondering if anyone has done it before? I saw
some django modules that help do model translations but some of them did not
work properly.

Any best practices out there? below is my code

*my model.py*

class Lookup_I18n(models.Model):
i18n_code = models.CharField(max_length=5,
default=settings.LANGUAGE_CODE)
value = models.CharField(max_length=300)

class Lookup(models.Model):

purpose = models.CharField(max_length=10)
key = models.CharField(max_length=10)
value_i18n = models.ForeignKey(Lookup_I18n)
value = models.Field()

class Meta:
unique_together = (('purpose', 'key'),)

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Jan. 7, 2011 15:25:44

Marcos M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

i18n django models


I've worked on/with this apphttps://github.com/Anue/django-polyglot/Hope it helps.
Rgds,
Marcos

On Fri, Jan 7, 2011 at 12:20 PM, Mo Mughrabi <mo.mughr...@gmail.com> wrote:

> Hello,
>
> in my design there are some models where I need to store certain fields in
> different languages. I was wondering if anyone has done it before? I saw
> some django modules that help do model translations but some of them did not
> work properly.
>
> Any best practices out there? below is my code
>
> *my model.py*
>
> class Lookup_I18n(models.Model):
> i18n_code = models.CharField(max_length=5,
> default=settings.LANGUAGE_CODE)
> value = models.CharField(max_length=300)
>
> class Lookup(models.Model):
>
> purpose = models.CharField(max_length=10)
> key = models.CharField(max_length=10)
> value_i18n = models.ForeignKey(Lookup_I18n)
> value = models.Field()
>
> class Meta:
> unique_together = (('purpose', 'key'),)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>



--
Some people, when confronted with a problem, think “I know, I'll use regular
expressions.” Now they have two problems.

Jamie Zawinski, in comp.emacs.xemacs

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Jan. 8, 2011 13:19:08

Mo M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

i18n django models


This is not exactly what I need.

this library is not done as per the common best practices for i18nlizing
data.

All you have to do is declare an object (field) as an i18n field and the
engine takes care of the rest. This example you can see in java struct and
php symphony, when executing the equivalent for syncdb it will generate an
additional table which holds the i18n languages instead of creating columns
with prefixes and suffixes.

Having columns mapped to a specific language means modifying your table in
the future if you need additional languages. Meanwhile, if creating a one to
many relation with a specific table that holds only the variable in
different languages means you can add as many language support as you need,

Plus, when I went through polyglot it does override a lot
of crucial functions, adding up such plugin into a critical
production environment can be risky with very little information about it.


Any other solutions?



On Fri, Jan 7, 2011 at 6:25 PM, Marcos Moyano <marcosmoy...@gmail.com>wrote:

> I've worked on/with this app
>https://github.com/Anue/django-polyglot/>
> Hope it helps.
> Rgds,
> Marcos
>
> On Fri, Jan 7, 2011 at 12:20 PM, Mo Mughrabi <mo.mughr...@gmail.com>wrote:
>
>> Hello,
>>
>> in my design there are some models where I need to store certain fields in
>> different languages. I was wondering if anyone has done it before? I saw
>> some django modules that help do model translations but some of them did not
>> work properly.
>>
>> Any best practices out there? below is my code
>>
>> *my model.py*
>>
>> class Lookup_I18n(models.Model):
>> i18n_code = models.CharField(max_length=5,
>> default=settings.LANGUAGE_CODE)
>> value = models.CharField(max_length=300)
>>
>> class Lookup(models.Model):
>>
>> purpose = models.CharField(max_length=10)
>> key = models.CharField(max_length=10)
>> value_i18n = models.ForeignKey(Lookup_I18n)
>> value = models.Field()
>>
>> class Meta:
>> unique_together = (('purpose', 'key'),)
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>>http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> Some people, when confronted with a problem, think “I know, I'll use
> regular expressions.” Now they have two problems.
>
> Jamie Zawinski, in comp.emacs.xemacs
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@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-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 Jan. 8, 2011 13:23:47

Alessandro P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

i18n django models


2011/1/8 Mo Mughrabi <mo.mughr...@gmail.com>

> This is not exactly what I need.
>
> this library is not done as per the common best practices for i18nlizing
> data.
>
> All you have to do is declare an object (field) as an i18n field and the
> engine takes care of the rest. This example you can see in java struct and
> php symphony, when executing the equivalent for syncdb it will generate an
> additional table which holds the i18n languages instead of creating columns
> with prefixes and suffixes.
>

Hi,

I've been using transmeta for a big project, I had to slightly adapt it to
suit my needs but it works well and I found it an elegant solution.http://code.google.com/p/django-transmeta/some migration/maintenance commands are also available within the lib.

--
Alessandro Pasotti
w3: www.itopen.it

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#5 Jan. 8, 2011 20:07:35

Mo M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

i18n django models


Transmeta is much nicer and much simpler. I just installed it and I already
like the way it is designed,

I just ran into a small problem with the ./manage.py sync_transmeta_db not
working. Any idea how it can be solved?

Am just getting an unknown command,


Cheers,


On Sat, Jan 8, 2011 at 4:23 PM, Alessandro Pasotti <apaso...@gmail.com>wrote:

> 2011/1/8 Mo Mughrabi <mo.mughr...@gmail.com>
>
> This is not exactly what I need.
>>
>> this library is not done as per the common best practices for i18nlizing
>> data.
>>
>> All you have to do is declare an object (field) as an i18n field and the
>> engine takes care of the rest. This example you can see in java struct and
>> php symphony, when executing the equivalent for syncdb it will generate an
>> additional table which holds the i18n languages instead of creating columns
>> with prefixes and suffixes.
>>
>
> Hi,
>
> I've been using transmeta for a big project, I had to slightly adapt it to
> suit my needs but it works well and I found it an elegant solution.
>
>http://code.google.com/p/django-transmeta/>
> some migration/maintenance commands are also available within the lib.
>
> --
> Alessandro Pasotti
> w3: www.itopen.it
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@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-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#6 Jan. 8, 2011 22:12:17

Alessandro P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

i18n django models


2011/1/8 Mo Mughrabi <mo.mughr...@gmail.com>

> Transmeta is much nicer and much simpler. I just installed it and I already
> like the way it is designed,
>
> I just ran into a small problem with the ./manage.py sync_transmeta_db not
> working. Any idea how it can be solved?
>
> Am just getting an unknown command,
>
>
> Cheers,
>
>
>

I dont' know... did you add transmeta to the installed app in settings.py ?


--
Alessandro Pasotti
w3: www.itopen.it

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#7 Jan. 8, 2011 22:15:09

Mo J.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

i18n django models


Yes, I did that part,

How can I navigate transmeta source for that function? I used python
setup.py install,



Sent from my iPhone

On Jan 9, 2011, at 1:12 AM, Alessandro Pasotti <apaso...@gmail.com> wrote:

2011/1/8 Mo Mughrabi <mo.mughr...@gmail.com>

> Transmeta is much nicer and much simpler. I just installed it and I already
> like the way it is designed,
>
> I just ran into a small problem with the ./manage.py sync_transmeta_db not
> working. Any idea how it can be solved?
>
> Am just getting an unknown command,
>
>
> Cheers,
>
>
>

I dont' know... did you add transmeta to the installed app in settings.py ?


--
Alessandro Pasotti
w3: www.itopen.it

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://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-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 21st of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support