{ "info": { "author": "garcia.marc", "author_email": "", "bugtrack_url": null, "classifiers": [ "Framework :: Django", "Programming Language :: Python", "Topic :: Software Development :: Internationalization" ], "description": "Overview\r\n========\r\nDjango's field that stores labels in more than one language in database.\r\n\r\nJust working on newforms-admin branch.\r\n\r\nInstalling and using\r\n====================\r\nInstallation Download, unpack and copy files to ${PYTHON_PATH}/site-packages/transdb (or anywhere else if you know what you're doing)\r\n\r\nCreate your models:\r\n\r\nfrom transdb import TransCharField, TransTextField\r\n[...]\r\n\r\nclass MyModel(models.Model):\r\n [...]\r\n my_char_field = TransCharField(max_length=32)\r\n my_text_field = TransTextField()\r\nIf you need to use in models in a more advanced way:\r\n\r\nfrom transdb import TransDbField\r\nfrom django.conf import settings\r\nfrom django.utils.translation import get_language\r\nfrom django.template.defaultfilters import slugify\r\n[...]\r\n\r\nclass MyModel(models.Model):\r\n [...]\r\n my_char_field = TransCharField(max_length=32)\r\n my_text_field = TransTextField()\r\n slug_field = models.SlugField(editable=False)\r\n\r\n def __unicode__(self):\r\n return self.my_char_field\r\n\r\n def save(self):\r\n self.slug_field = slugify(self.my_char_field.get_in_language(settings.LANGUAGE_CODE))\r\n super(MyModel, self).save()\r\n[...]\r\nUse as any other field in templates:\r\n\r\n[...]\r\n

{{ object.my_field }}

\r\n[...]\r\nAnd that's all, enjoy!\r\n\r\nSerialization\r\n==============\r\nDue to technical reasons, serialization on models with TransDb fields has some specific restrictions.\r\n\r\nDjango comes with two serialization formats, xml and json.\r\n\r\nTransDb requires two diferent methods when serializing, one that serializes information for all languages (for example for saving data as fixture). Other method should just return the current language (serialization for ajax processing).\r\n\r\nProbably will change in the future, but now TransDb applies a method depending on the format, so\r\n\r\nUse xml format for including all languages in serialization objects (and use TransDb serializer, see below).\r\nUser json format for returning just the current language in serialization objects.\r\nFor using TransDb serializer add next lines to your settings.py file:\r\n\r\nSERIALIZATION_MODULES = {\r\n 'xml': 'transdb.xml_serializer',\r\n}\r\n\r\nMigration from non-translatable fields (and previous versions of TransDb)\r\n========================================================================\r\nThere is a wiki page MigrationProcedure http://code.google.com/p/transdb/wiki/MigrationProcedure that covers this subject.\r\n\r\nTechincal information\r\n=====================\r\nInternally data is stored in database as a string in dictionary format, for example:\r\n\r\nu'{u'en': u'This is english', u'ca': u'Other lang .. '}'\r\nField uses a subclass of unicode class, adding a raw_data attribute to store the string with all languages, and implementing the get_in_language(language) method to allow access to a diferent language (diferent from the user's current language).\r\n\r\nKnown issues\r\n===================\r\nSee the list in http://code.google.com/p/transdb/issues/list", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://code.google.com/p/transdb/", "keywords": "django,translation,internationalization,i18n,database,model", "license": "UNKNOWN", "maintainer": "", "maintainer_email": "di@sferos.com", "name": "transdb", "package_url": "https://pypi.org/project/transdb/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/transdb/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://code.google.com/p/transdb/" }, "release_url": "https://pypi.org/project/transdb/0.9/", "requires_dist": null, "requires_python": null, "summary": "I18n django reusable app", "version": "0.9" }, "last_serial": 800877, "releases": { "0.9": [ { "comment_text": "", "digests": { "md5": "e80d1cd8aaf7e71ed6ada7fb9be84d47", "sha256": "894a1590b86e1074807ee19ac1c62f645702389a380ae74b58f37326fdeb80fc" }, "downloads": -1, "filename": "transdb-0.9-py2.5.egg", "has_sig": false, "md5_digest": "e80d1cd8aaf7e71ed6ada7fb9be84d47", "packagetype": "bdist_egg", "python_version": "2.5", "requires_python": null, "size": 12617, "upload_time": "2010-11-16T14:26:41", "url": "https://files.pythonhosted.org/packages/a2/ea/3daf54bd4f84e4da2a54fab3c41d25489b612c2728fe1447b677b2ac787c/transdb-0.9-py2.5.egg" }, { "comment_text": "", "digests": { "md5": "d60b8b6cf19070e7f8ca6d85c3c90e71", "sha256": "c44534f5cfe1889a062c3fe4ba457f91cbf0e1a95eabc2fd92d71a2958b2ef08" }, "downloads": -1, "filename": "transdb-0.9.tar.gz", "has_sig": false, "md5_digest": "d60b8b6cf19070e7f8ca6d85c3c90e71", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5717, "upload_time": "2010-11-16T14:28:22", "url": "https://files.pythonhosted.org/packages/cc/d4/ed2a6b0d1c404a1d89847b23127555137ec765d41a92568bd9730157ee39/transdb-0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e80d1cd8aaf7e71ed6ada7fb9be84d47", "sha256": "894a1590b86e1074807ee19ac1c62f645702389a380ae74b58f37326fdeb80fc" }, "downloads": -1, "filename": "transdb-0.9-py2.5.egg", "has_sig": false, "md5_digest": "e80d1cd8aaf7e71ed6ada7fb9be84d47", "packagetype": "bdist_egg", "python_version": "2.5", "requires_python": null, "size": 12617, "upload_time": "2010-11-16T14:26:41", "url": "https://files.pythonhosted.org/packages/a2/ea/3daf54bd4f84e4da2a54fab3c41d25489b612c2728fe1447b677b2ac787c/transdb-0.9-py2.5.egg" }, { "comment_text": "", "digests": { "md5": "d60b8b6cf19070e7f8ca6d85c3c90e71", "sha256": "c44534f5cfe1889a062c3fe4ba457f91cbf0e1a95eabc2fd92d71a2958b2ef08" }, "downloads": -1, "filename": "transdb-0.9.tar.gz", "has_sig": false, "md5_digest": "d60b8b6cf19070e7f8ca6d85c3c90e71", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5717, "upload_time": "2010-11-16T14:28:22", "url": "https://files.pythonhosted.org/packages/cc/d4/ed2a6b0d1c404a1d89847b23127555137ec765d41a92568bd9730157ee39/transdb-0.9.tar.gz" } ] }