Hi again,
Before I start to do strange things, I need a quick sanity check...
I am considering writing my own little metaclass for creating models,
where I can specify which fields should be internationalised and it
will create the correct database fields behind the scenes, like what
django-multilingual does. (Maybe I should just use django-multilingual
:-/ after writing this email, I think _maybe_ I'm trying to do the
same thing in a slightly different, less flexible, way...).
Basically:
class MyModel(models.model):
translated_field = models.CharField()
untranslated_field = models.CharField()
i18n = ['translated_field']
__metaclass__ = DansCrazyI18NMetaclass
which would then would be converted to this:
class MyModel(models.model):
translated_field_en = models.CharField()
translated_field_ga = models.CharField() # whatever other languages
translated_field = proxy # which would check the django language
to retrieve the correct field, or perhaps this is set during
instanciation to alias the field for the correct language, like what
django-multilingual does.
untranslated_field = models.CharField()
so when I access the model, I can do model_instance.translated_field
and it will retrieve either model_instance.translated_field_en or
model_instance. translated_field_ga, depending on the current
language.
Basically, I'm asking if this is a good idea, or if I'm just crazy...
and if thats the case, does anyone have any other suggestions?
Also, is it even worth trying to do this myself or am I just
reinventing the wheel (ie django-multilingual)? I don't really want to
spend too much time on this if theres an equally usable solution
already available.
Also, does anyone have any experience using django-multilingual? Would
you recommend using it?
Any suggestions/ideas/comments would be appreciated. Thanks!!
Dan.
2008/6/15 Daniel Kersten <[EMAIL PROTECTED]>:
> Hi,
>
> I'm still undecided, I've been putting it off (hoping someone here
> would have some advice for me). I will let you know what I do
> eventually decide, though.
>
> Dan.
>
> 2008/6/15 Maciej Bliziński <[EMAIL PROTECTED]>:
>>
>> 2008/6/13 Daniel Kersten <[EMAIL PROTECTED]>:
>>> I now have another question however:
>>> I am storing various strings in the database and I would like these to
>>> be translated too. What would be the best way to manage this?
>>> I was looking at transdb (http://code.google.com/p/transdb/) and
>>> django-multilingual (http://code.google.com/p/django-multilingual/),
>>
>> How are you getting on with this? I'd be interested to learn about
>> your findings.
>>
>> Maciej
>>
>> >>
>>
>
>
>
> --
> Daniel Kersten.
> Leveraging dynamic paradigms since the synergies of 1985.
>
--
Daniel Kersten.
Leveraging dynamic paradigms since the synergies of 1985.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Python Ireland" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.ie/group/pythonireland?hl=en
-~----------~----~----~----~------~----~------~--~---