{"id":23467611,"url":"https://github.com/askbot/django-frontend-i18n","last_synced_at":"2025-08-01T05:08:31.472Z","repository":{"id":137214919,"uuid":"391757066","full_name":"ASKBOT/django-frontend-i18n","owner":"ASKBOT","description":"Integration of Django i18n string extraction with Svelte.","archived":false,"fork":false,"pushed_at":"2023-01-22T18:35:02.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-11T23:44:17.315Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ASKBOT.png","metadata":{"files":{"readme":"README.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-01T22:53:23.000Z","updated_at":"2023-01-22T00:13:38.000Z","dependencies_parsed_at":"2023-07-06T12:00:58.219Z","dependency_job_id":null,"html_url":"https://github.com/ASKBOT/django-frontend-i18n","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ASKBOT/django-frontend-i18n","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ASKBOT%2Fdjango-frontend-i18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ASKBOT%2Fdjango-frontend-i18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ASKBOT%2Fdjango-frontend-i18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ASKBOT%2Fdjango-frontend-i18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ASKBOT","download_url":"https://codeload.github.com/ASKBOT/django-frontend-i18n/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ASKBOT%2Fdjango-frontend-i18n/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268171959,"owners_count":24207437,"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","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-12-24T12:38:08.327Z","updated_at":"2025-08-01T05:08:31.415Z","avatar_url":"https://github.com/ASKBOT.png","language":"Python","readme":"Django i18n localization for frontend apps\n==========================================\n\nNOTE: This app is experimental.\n\nDjango collects i18s strings from the frontend apps,\nserves them via the REST endpoint.\n\nThe idea is to help migration of apps using backend templates (Django, Jinja2) to\nfrontend app using React, Svelte, etc.\n\nYour frontend app should first call the i18n endpoint and retrieve the messages,\nthen render the translations.\n\nThe endpoint returns all messages for the app at once, this may be unacceptable \nfor very large applications.\n\nServing per-route catalogs may be in the future plans.\n\nIf you have a SSR frontend - you could in the SSR load all messages on startup\nand store them. The frontend would load the landing page and then asynchronously\nload all the strings. This approach could work for relatively large apps.\n\nHow to use this app\n-------------------\n\n1) Install and configure the app as described in the section \"Installation\" below.\n2) Create the global per-app translation catalogs by running `python manage.py frontend_makemessages`.\n   The catalogs will be located in the directory specified\n   by the `FRONTEND_I18N[\u003capp_name\u003e]['locale_path']` value.\n3) Make the translations (refer to the Django documentation).\n4) Create catalog by running `python manage.py frontend_compilemessages`\n\n\nInstallation\n------------\n\nTo the urls.py add:\n\n```\n    from frontend_i18n import views\n\n    urlpatterns += (url('^i18n/$', views.JSONCatalog.as_view(), name='frontend-i18n'),)\n```\n\nAdd to the `settings.py` file:\n\n\n```\n    INSTALLED_APPS = [\n        ... \u003cother apps\u003e,\n        'frontend_i18n',\n    ]\n\n\n    FRONTEND_I18N = {\n        '\u003cfrontend_package_name\u003e': {\n            'locale_dir': '\u003cpath to the app locale dir\u003e', # for each package list path to the locale directory\n            'src_dir': '\u003cpath to the frontend source code directory\u003e,\n            'file_extensions': \u003carray of strings e.g.: ['.js', '.ts', '.svelte']\u003e\n        }\n    }\n```\n\n* `package_name` - any string that identifies the frontend app, e.g. 'myapp_react_frontend'\n* `src_dir` - root directory of the app code - to avoid extraction from any files\n              outside this directory\n* `locale_dir` - file system path to `locale` directory. Can be anywhere on disk,\n                 for example at the `/home/smith/myapp/locale`\n* `file_extensions` - list of file extensions, where to look for the i18n strings\n\n\nJSONCatalog view\n----------------\n\nThis app provides one view `JSONCatalog` which provide the translation strings.\n\nThis view returs JSON data, accepts a parameter `package` (required).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faskbot%2Fdjango-frontend-i18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faskbot%2Fdjango-frontend-i18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faskbot%2Fdjango-frontend-i18n/lists"}