{"id":16424029,"url":"https://github.com/zerolab/wagtail-localize-rws-languagecloud","last_synced_at":"2025-04-04T16:18:43.277Z","repository":{"id":40269894,"uuid":"406672329","full_name":"zerolab/wagtail-localize-rws-languagecloud","owner":"zerolab","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-06T22:17:05.000Z","size":441,"stargazers_count":3,"open_issues_count":3,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-10T01:43:28.097Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zerolab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-15T08:20:15.000Z","updated_at":"2024-05-14T14:55:40.000Z","dependencies_parsed_at":"2023-02-19T12:35:27.150Z","dependency_job_id":null,"html_url":"https://github.com/zerolab/wagtail-localize-rws-languagecloud","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerolab%2Fwagtail-localize-rws-languagecloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerolab%2Fwagtail-localize-rws-languagecloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerolab%2Fwagtail-localize-rws-languagecloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerolab%2Fwagtail-localize-rws-languagecloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zerolab","download_url":"https://codeload.github.com/zerolab/wagtail-localize-rws-languagecloud/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208307,"owners_count":20901570,"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":[],"created_at":"2024-10-11T07:41:45.638Z","updated_at":"2025-04-04T16:18:43.259Z","avatar_url":"https://github.com/zerolab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wagtail Localize RWS LanguageCloud\n\nThis allows users of [RWS LanguageCloud](https://www.rws.com/translation/language-cloud/) to translate and localize Wagtail CMS content.\n\n## Requirements\n\n- Python \u003e= 3.7\n- Django \u003e= 3.2\n- Wagtail \u003e= 2.15\n- wagtail-localize \u003e= 1.0.1\n\n## Setup\n\n1. `pip install wagtail-localize-rws-languagecloud`\n2. Add `wagtail_localize_rws_languagecloud` to `INSTALLED_APPS` _before_ `wagtail.admin` and `wagtail_localize`:\n\n   ```python\n   INSTALLED_APPS = [\n       # ...\n       \"wagtail_localize_rws_languagecloud\",\n       \"wagtail.admin\",\n       \"wagtail_localize\",\n   ]\n   ```\n\n3. Configure the plugin in Django settings:\n\n   ```python\n   import datetime\n\n   WAGTAILLOCALIZE_RWS_LANGUAGECLOUD = {\n       # (required) Authentication details to connect to the LanguageCloud API.\n       # For info on how to obtain these credentials see https://languagecloud.sdl.com/lc/api-docs/authenticate\n       \"CLIENT_ID\": \"\u003cclient id\u003e\",\n       \"CLIENT_SECRET\": \"\u003cclient secret\u003e\",\n       \"ACCOUNT_ID\": \"\u003caccount id\u003e\",\n       # (required) Identifier of a LanguageCloud template to create projects from\n       \"TEMPLATE_ID\": \"\u003ctemplate id\u003e\",\n       # (required) Identifier of a LanguageCloud location to store project files in\n       \"LOCATION_ID\": \"\u003clocation id\u003e\",\n       # (optional) Prefix for project names. Defaults to '' if not specified\n       \"PROJECT_PREFIX\": \"foobar_\",\n       # (optional) A timedelta object used to set the project 'due by' date.\n       # Defaults to datetime.timedelta(days=7) if not specified\n       \"DUE_BY_DELTA\": datetime.timedelta(days=30),\n       # (optional) Number of a seconds to sleep between each API request.\n       # Defaults to 0 if not specified\n       \"API_SLEEP_SECONDS\": 5,\n       # (optional) Send an email to uers with any of the following permissions:\n       # - wagtail_localize.add_translation\n       # - wagtail_localize.change_translation\n       # - wagtail_localize.delete_translation\n       # - wagtail_localize.submit_translation\n       # when new translations are ready for review.\n       # Defaults to False if not specified\n       \"SEND_EMAILS\": True,\n       # (optional) Provide a WAGTAIL_CONTENT_LANGUAGE code to RWS language code map\n       # RWS expects region codes (e.g. \"en-US\", \"de-DE\") whereas Wagtail will happily\n       # accept two letter lanugage code (\"en\", \"de\"). You can also use this mapping\n       # to map dialect language codes to the main supported language\n       \"LANGUAGE_CODE_MAP\": {\n           \"en\": \"en-US\",\n           \"ja\": \"ja-JP\",\n           \"es-mx\": \"es-ES\",\n       },\n   }\n   ```\n\n4. Apply migrations:\n\n   ```\n   ./manage.py migrate\n   ```\n\n## Exporting and importing content to/from LanguageCloud\n\nThis plugin works by:\n\n- Identifying text in Wagtail which is pending localization and exporting it to LanguageCloud\n- Identifying completed projects in LanguageCloud and importing the localized content back into Wagtail\n\nThis is done through a management command:\n\n```\n./manage.py sync_rws\n```\n\nThis command needs to be run on an interval using a scheduler like cron. We recommend an interval of about every 10 minutes.\n\nIt is desirable to prevent more than one copy of the sync command from running at the same time.\n\n- If using cron as a scheduler, [lockrun](http://unixwiz.net/tools/lockrun.html) can be used to prevent multiple instance of the same job running simultaneously.\n- If using a queue-based scheduler like Celery Beat, the `SyncManager` class contains `is_queued` and `is_running` extension points which could be used to implement a lock strategy.\n\n## Update translated pages\n\nWagtail Localize comes with a feature called \"Sync translated pages\" which copies untranslated content from the source page to its translated pages. This is useful when the source page content has been updated and needs to be copied and re-translated.\n\nThis plugin comes with an optional management command that automates this process by running sync translated pages on pages with stale translated content.\n\n```\n./manage.py update_translated_pages\n```\n\nThis command:\n\n- Runs \"sync translated pages\" on pages that have been published but not yet synced.\n- Queues these pages to be translated on LanguageCloud using the default settings.\n- Sends an email summary with the list of pages that were synced or skipped.\n\nPages that match the following criteria are excluded from auto-syncing:\n\n- Pages that haven't been translated before.\n- Pages that have pending translations on LanguageCloud.\n\nYou can use this command ad-hoc, or schedule it to run on an interval to automatically keep translated versions of your content up-to-date.\n\nYou can safely preview which pages will be affected without actually updating them by running the command with `--dry-run`.\n\n```\n./manage.py update_translated_pages --dry-run\n\n```\n\n## Signals\n\n`translation_imported`\n\nThis signal is sent when a translation from RWS LanguageCloud is successfully imported.\n\n**Arguments:**\n\n- **sender:** `LanguageCloudProject`\n- **instance:** The specific `LanguageCloudProject` instance.\n- **source_object:** The page or snippet instance that this translation is for.\n- **translated_object:** The translated instance of the page or snippet.\n\nFor more information on signal handlers, see [the Django docs](https://docs.djangoproject.com/en/stable/topics/signals/#connecting-receiver-functions).\n\nThere are some more detailed examples of how the `translation_imported` signal can be used to send slack notifications in [slack-notification-examples.md](docs/slack-notification-examples.md).\n\n## How it works\n\nThis plugin uses `wagtail-localize` to convert pages into segments and build new pages from translated segments. `wagtail-localize` provides a web interface for translating these segments in Wagtail itself and this plugin plays nicely with that (translations can be made from the Wagtail side too).\n\nPages/snippets are submitted to LanguageCloud when they are submitted for translation from the default locale. Pages authored in other locales are not supported yet.\n\n## Contributing\n\nAll contributions are welcome!\n\n### Install\n\nTo make changes to this project, first clone this repository,\nthen with your preferred virtualenv activated, install testing dependencies:\n\n```shell\nmake install\n```\n\n### pre-commit\n\nNote that this project uses [pre-commit](https://github.com/pre-commit/pre-commit). To set up locally:\n\n```shell\n# if you don't have it yet, globally\n$ pip install pre-commit\n# go to the project directory\n$ cd wagtail-localize-rws-languagecloud\n# initialize pre-commit\n$ pre-commit install\n\n# Optional, run all checks once for this, then the checks will run only on the changed files\n$ pre-commit run --all-files\n```\n\n### local_settings.py\n\nYou can add a `local_settings.py` file next to `settings.py` for any settings that you need when running the project locally.\n\nFor example, you might want to set a `NAME` for the SQLite test database so that `--keepdb` works.\n\n```python\n# wagtail_localize_rws_languagecloud/test/local_settings.py\nfrom .settings import DATABASES\n\nDATABASES[\"default\"][\"TEST\"] = {\"NAME\": \"test.db\"}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerolab%2Fwagtail-localize-rws-languagecloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzerolab%2Fwagtail-localize-rws-languagecloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerolab%2Fwagtail-localize-rws-languagecloud/lists"}