-
Notifications
You must be signed in to change notification settings - Fork 13
Add Welsh translation state diagram #252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
diagrams/state-diagrams/welsh-translation-states-and-fields.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # Adding Welsh to a Form | ||
|
|
||
| This document describes how adding a Welsh translation affect a form and it's form documents. | ||
|
|
||
| ## The Welsh tasklist status | ||
|
|
||
| The Welsh task is optional. If the form creator does nothing, it will not block the form from being made live. | ||
|
|
||
| If the task is started, by entering any values into the translation screen and submitting it as unfinished, the status will be set to in progress. | ||
|
|
||
| The form cannot be made live while the Welsh task is in progress. | ||
|
|
||
| If the task is completed, by entering a full translation of the form and submitting it as finished, the status will be set to complete and the form can be made live. | ||
|
|
||
| Any changes to the form or translation which would mean that the Welsh is no longer complete, such as adding a declaration, new question, exit page or support method will | ||
| set the status to in progress. | ||
|
|
||
| ```mermaid | ||
| stateDiagram-v2 | ||
| Optional --> In_Progress:Enter Welsh, save unfinished | ||
| Optional --> Complete:Enter Welsh, save finished | ||
| Complete --> Optional:Delete Welsh | ||
| In_Progress --> Optional:Delete Welsh | ||
| In_Progress --> Complete:Enter Welsh, save unfinished | ||
| Complete --> In_Progress:Invalidate Welsh | ||
| ``` | ||
|
|
||
| ## New fields on Form | ||
|
|
||
| ## available_languages | ||
|
|
||
| `available_languages`, is an array of language codes. It's `[:en]` by default, which signals that the form is only available in English. | ||
| Forms with a Welsh translation have `[:en, :cy]` in the array. | ||
|
|
||
| As soon as the Welsh translation page is submitted with at least one value for a field, the `available_languages` array will be updated. | ||
|
|
||
| The `available_languages` array is used when generating form documents, which are used by the runner. Form documents are created for each language in the array. | ||
| It's updated when the Welsh translation is submitted so the user can immediately preview the Welsh translation, even if they haven't completed it. | ||
|
|
||
| The `available_languages` array is saved in form documents. It's used by the runner to discover that the form is available in Welsh, if it's showing the English version. | ||
|
|
||
| ### welsh_completed | ||
| `welsh_completed` is a boolean, which is records if the form creator has marked the Welsh as complete. It's not included in form_documents. | ||
|
|
||
| ## Places where the values change | ||
|
|
||
| If the English form changes, we need to update the Welsh translation to match. This can happen if the form creator deletes a field, such as a declaration. | ||
| To keep the Welsh translation in sync, Form has a new method | ||
| `normalise_welsh!`. It's called when the form documents for draft or live are | ||
| made. It ensures that the Welsh translation doesn't have any values which the | ||
| English form doesn't have. | ||
|
|
||
| The method on Form in turn calls `normalise_welsh!` on each page and condition, which syncs these values. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.