{"id":15683975,"url":"https://github.com/boxed/okrand","last_synced_at":"2025-04-30T07:05:08.900Z","repository":{"id":65937517,"uuid":"595301581","full_name":"boxed/okrand","owner":"boxed","description":"Okrand is an internationalization/translation tool for Django","archived":false,"fork":false,"pushed_at":"2025-03-25T09:27:27.000Z","size":191,"stargazers_count":17,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-30T07:04:13.091Z","etag":null,"topics":["django","i18n"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boxed.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY.rst","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.rst","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-01-30T20:04:15.000Z","updated_at":"2025-04-04T18:31:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"2f62cef7-719d-4380-823f-b955d334fa79","html_url":"https://github.com/boxed/okrand","commit_stats":{"total_commits":35,"total_committers":1,"mean_commits":35.0,"dds":0.0,"last_synced_commit":"86491a6d41cc49ded57975dd2d0e201cd45158f4"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxed%2Fokrand","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxed%2Fokrand/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxed%2Fokrand/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxed%2Fokrand/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boxed","download_url":"https://codeload.github.com/boxed/okrand/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251658201,"owners_count":21622819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["django","i18n"],"created_at":"2024-10-03T17:09:23.647Z","updated_at":"2025-04-30T07:05:08.841Z","avatar_url":"https://github.com/boxed.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Okrand\n------\n\nOkrand is an internationalization/translation tool for Django.\n\nIt is a pure Python program so doesn't rely on ``gettext``.\n\nOkrand will respect your ``.gitignore``.\n\n\nDjango models\n=============\n\nOkrand can upgrade Django models so translation is much easier. You don't need to write ``verbose_name`` anymore! And if you do write them Okrand will upgrade raw strings to `gettext_lazy`.\n\nTurn this feature on in your ``setup.cfg``:\n\n.. code-block::\n\n    [tool:okrand]\n    django_model_upgrade=1\n    django_model_prefixes=\n        your_package.\n\nSo concretely this model:\n\n.. code-block:: python\n\n    from django.utils.translation import gettext_lazy as _\n\n\n    class Book(Model):\n        name = CharField(verbose_name=_('name'))\n        isbn = CharField(verbose_name=_('ISBN'))\n\n        class Meta:\n            verbose_name = _('book')\n            verbose_name = _('books')\n\nCan now be changed to the more natural:\n\n.. code-block:: python\n\n    class Book(Model):\n        name = CharField()\n        isbn = CharField(verbose_name='ISBN')\n\nNote that you don't need to wrap the ``verbose_name`` in a `gettext_lazy` call anymore.\n\n\nInstallation\n============\n\nFirst ``pip install okrand``, then add ``okrand`` to ``INSTALLED_APPS``.\n\nAdd ``OKRAND_STATIC_PATH`` to settings, pointing to where Okrand should write the JavaScript catalog files. Typically something like:\n\n.. code-block:: python\n\n    OKRAND_STATIC_PATH = Path(BASE_DIR) / 'yourproject' / 'base' / 'static'\n\nIf you have a ``base`` app to put common stuff.\n\n\nConfiguration\n=============\n\nIn ``setup.cfg`` you set:\n\n - additional ignore rules beyond ``.gitignore``. These are regexes for the full path.\n - sorting: none (default), alphabetical\n - if the django model upgrade is enabled\n - custom collector functions\n\n\n.. code-block::\n\n    [tool:okrand]\n    ignore=\n        .*some_annoying_path.*\n    sort=alphabetical\n    django_model_upgrade=1\n    django_model_prefixes=\n        some_app.\n        another_app.\n    find_source_strings_plugins=\n        your.module.function_name\n\n\nInstalling the frontend\n=======================\n\n\nThere is a built in web based frontend to okrand. To install it first `install iommi \u003chttps://docs.iommi.rocks/en/latest/getting_started.html\u003e`_.\n\nThen add the following to your ``urls.py``:\n\n.. code-block:: python\n\n    from okrand.views import i18n\n\n    urlpatterns = [\n        path('i18n/', i18n),\n    ]\n\n\nWhat does \"Okrand\" mean?\n~~~~~~~~~~~~~~~~~~~~~~~~\n\n`Marc Okrand \u003chttps://en.wikipedia.org/wiki/Marc_Okrand\u003e`_ is a linguist who is best known for his work on Star Trek where he created the Klingon language.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboxed%2Fokrand","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboxed%2Fokrand","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboxed%2Fokrand/lists"}