Hello, Here I'm again with the same subject, internationalization in db. I think this should be included in 1.0, it's not so hard, I have thought a way to make it work:
We have a class like this: class Book(models.Model): name = models.CharField( max_length=255, i18n=True) And the following line in settings.py LANGUAGES = ( 'en', ugettext(u'English'), 'es', ugettext(u'Spanish') ) Note that name field has an attribute i18n= True. when creating the columns in the db, if i18n=True is found, the extra name_es,... columns is created. I don't like to have separate tables for this for many reasons: 1.- Not easy to interact with the db from a client 2.- Not needed 3.- Decreasing performance the column name contains the string in the first language defined in LANGUAGES, in this case: English. name_i18n_es will contain the name in Spanish language. When the object is accessed: name = Book.objects.get( id=1 ) book.name = 'Name of the book' book.name gets the value of the default language, the first one defined in LANGUAGES, and: book.name_i18n_es = 'Nombre del libro' is stored the string in a different language. book.name should be a function instead of an attribute where you pass the language and get the string. If none is passed you get the string of the first LANGUAGE. Some extra arrays should be added to the _meta options class named i18n_fields and i18n_languages. Using this approach ordering and even full-text with multiple languages is possible. For creating an object: book = Book( name='Name of the book') or: book = Book( name='Name of the book', name_i18n_es='Nombre del libro') With this it would be easier to implement different languages in the newforms.FormForModel and nfa-branch. Filtering could be done in the first approach: field_name = 'name_i18n_%s__contains' % ( language_id ) kwargs={ field_name:'text to search'} I'm not convinced of this but something else could be done inside the django.db I think I can make this work in three weeks, If I do, could it be considered for Django 1.0? Let's be honest, English is not the only language in the world and I have known some companies that didn't switch to django because of this. Any suggestions are welcome. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---