{ "info": { "author": "Florent Cayr\u00e9 (Villejuif, FRANCE)", "author_email": "Florent Cayr\u00e9 ", "bugtrack_url": null, "classifiers": [], "description": "Summary\n-------\n\nThis cube provides a way to manage and display entity field (attribute)\ntranslations, stored in the application database.\n\nTo achieve this for your particular entity type, you have to:\n\n* add an 'i18nfield_of' relation definition, linking from the 'I18nField'\n entity type to your translatable entity type(s)\n\n* add a 'ref_lang' relation definition, linking from your entity types\n to the 'I18nLang' entity type\n\n* make your business entity type inherit the 'TranslatableEntityMixin' and\n list its translatable fields in its 'i18nfields' attribute\n\n* create a simple adapter that inherits '_TranslatableEntityAdapter' and is\n selectable for your translatable entity types\n\nThat's all for the code part. Just add at least one I18nLang instance in your\ndatabase and link your translatable entities to their reference language.\n\nThe default web UI will then display a new 'translations' action menu to\nusers who can modify translatable entities, and display your translatable\nentities in the web request language by default.\n\nExample\n-------\n\nIf you want to translate all fields of the Card entity type (from the 'card'\ncube), you will need in your schema.py file::\n\n from yams.buildobjs import RelationDefinition\n \n \n class i18nfield_of(RelationDefinition):\n subject = 'I18nField'\n object = 'Card'\n cardinality = '1*'\n composite = 'object'\n \n \n class ref_lang(RelationDefinition):\n subject = 'Card'\n object = 'I18nLang'\n cardinality = '1*'\n inlined = True\n\n\nAnd in the entities.py file::\n\n from cubicweb.selectors import is_instance\n \n from cubes.card.entities import Card as OrigCard\n from cubes.i18nfield.entities import (TranslatableEntityMixin,\n _TranslatableEntityAdapter)\n \n \n class Card(TranslatableEntityMixin, OrigCard):\n i18nfields = (u'title', u'synopsis', u'content')\n \n def dc_title(self):\n return self.printable_value('title', format='text/plain')\n \n \n class MyTranslatableEntityAdapter(_TranslatableEntityAdapter):\n __select__ = _TranslatableEntityAdapter.__select__ & is_instance('Card')", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://www.cubicweb.org/project/cubicweb-i18nfield", "keywords": null, "license": "LGPL", "maintainer": null, "maintainer_email": null, "name": "cubicweb-i18nfield", "package_url": "https://pypi.org/project/cubicweb-i18nfield/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/cubicweb-i18nfield/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://www.cubicweb.org/project/cubicweb-i18nfield" }, "release_url": "https://pypi.org/project/cubicweb-i18nfield/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Provides a way to translate entity fields individually.", "version": "0.1.0" }, "last_serial": 1281593, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "ff3e54761af380b8a512d5187d73e656", "sha256": "4f3bdeaef156b582fc955a5ea71b2db2500d55ed776c04491556ada3953c1889" }, "downloads": -1, "filename": "cubicweb-i18nfield-0.1.0.tar.gz", "has_sig": false, "md5_digest": "ff3e54761af380b8a512d5187d73e656", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15170, "upload_time": "2014-10-24T16:26:00", "url": "https://files.pythonhosted.org/packages/81/b0/2ab481b0411d8025b1ffa1d4f4b6d264361fa34a826a521c085c8e20d4d6/cubicweb-i18nfield-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ff3e54761af380b8a512d5187d73e656", "sha256": "4f3bdeaef156b582fc955a5ea71b2db2500d55ed776c04491556ada3953c1889" }, "downloads": -1, "filename": "cubicweb-i18nfield-0.1.0.tar.gz", "has_sig": false, "md5_digest": "ff3e54761af380b8a512d5187d73e656", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15170, "upload_time": "2014-10-24T16:26:00", "url": "https://files.pythonhosted.org/packages/81/b0/2ab481b0411d8025b1ffa1d4f4b6d264361fa34a826a521c085c8e20d4d6/cubicweb-i18nfield-0.1.0.tar.gz" } ] }