{"id":19864657,"url":"https://github.com/dev360/django-linguist","last_synced_at":"2026-05-10T21:54:18.903Z","repository":{"id":1416679,"uuid":"1504817","full_name":"dev360/django-linguist","owner":"dev360","description":"Simple model i18n support","archived":false,"fork":false,"pushed_at":"2011-04-20T02:32:44.000Z","size":200,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-27T12:36:45.939Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dev360.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-03-21T00:14:52.000Z","updated_at":"2013-10-15T14:36:50.000Z","dependencies_parsed_at":"2022-07-29T13:09:44.931Z","dependency_job_id":null,"html_url":"https://github.com/dev360/django-linguist","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dev360/django-linguist","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev360%2Fdjango-linguist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev360%2Fdjango-linguist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev360%2Fdjango-linguist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev360%2Fdjango-linguist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dev360","download_url":"https://codeload.github.com/dev360/django-linguist/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev360%2Fdjango-linguist/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32873150,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-10T13:40:02.631Z","status":"ssl_error","status_checked_at":"2026-05-10T13:40:02.145Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T15:19:25.091Z","updated_at":"2026-05-10T21:54:18.852Z","avatar_url":"https://github.com/dev360.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"===============\nDjango Linguist\n===============\n\nDjango Linguist is a light-weight approach to localizing your models.\n\nHow it works\n------------\nYour translations are stored in a separate model and you can use the admin\nto edit your translation via tabs.\n\nIn general terms, the structure is as follows:\n\n\tFoo 1 --- * FooTranslation\n\nIn this case, all translations for Foo must reside in the FooTranslation class,\nwhich contains a property `locale` which is unique_together with the reference\nback to Foo's id to avoid duplicate translations for an instance of Foo. The\nlocales are read from the LANGUAGES setting.\n\nIn this scenario, given, the instances foo and foo_translation will follow the\nconventions below:\n\n - foo_translation.parent  \n   returns the parent class, Foo.\n - foo.translations\n   returns all the translations for the instance foo.\n\n\nCapabilities\n------------\n- Renders in admin with tabs for each language when you use the TranslationInline\n  and TranslationAdmin.\n- You can specify a global setting, TRANSLATION_REQUIRED_LANGUAGES to enumerate\n  the languages that you want to be required in admin, if any.\n- Allows convenient access to the parent with the `parent` attribute.\n- Allows convenient access to the translations with the `translations` attribute.\n- The manager for the translations will ensure that parents are retrieved together\n  with the translations (i.e. it uses select_related).\n\n\nMissing capabilities\n--------------------\n- There is currently no locale middleware implemented, so all lookups require you\n  to pass in filter(locale=XXX) to retrieve your translations.\n- There is a little dilemma in how to treat many to many, or one to many relationships\n  between the parent class and other related classes, e.g. Product 1 - * Product Feature\n  etc. It would be ideal if there was a convenient way to edit these in the admin\n  and if it could be achieved without any mind-bending db schemas.\n- The form for a translated object can not account for any property in the parent.\n  The only thing this code does is forward attribute lookups on the translated object\n  back to the parent, but setting attribute on the parent object via the translated object\n  is not supported.\n\n\nRequirements\n------------\nI have only tested with the following:\n\n- Django 1.3\n- Python 2.6/2.7\n\n\nHow to use it\n-------------\n\nAdd 'linguist' to your installed apps, then modify your admin.py and models.py as follows:\n\n\n*** models.py ***  \nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\n\n\nfrom linguist.models import TranslationModel\n\nclass Product(models.Model):\n    model_number = models.CharField(_('model number'), max_length=16)\n\n\nclass ProductTranslation(TranslationModel):\n    model_to_translate = Product\n    \n    title = models.CharField(_('title'), max_length=128)\n    description = models.CharField(_('description'), max_length=128)\n    price = models.DecimalField(_('price'), decimal_places=2,max_digits=6)\n    visible = models.BooleanField(_('visible'), default=False)\n\n\n*** admin.py ***  \nfrom django.contrib import admin\nfrom django.conf import settings\n\nfrom linguist.admin import TranslationInline, TranslationAdmin\n\nfrom testapp.models import Product, ProductTranslation\n\n\nclass ProductTranslationInline(TranslationInline):\n    model = ProductTranslation\n\nclass ProductAdmin(TranslationAdmin):\n    inlines = [ProductTranslationInline,]\n    model = Product\nadmin.site.register(Product, ProductAdmin)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdev360%2Fdjango-linguist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdev360%2Fdjango-linguist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdev360%2Fdjango-linguist/lists"}