Skip to content

Commit f14ef00

Browse files
Merge pull request #528 from SuffolkLITLab/document-conditional-text-in-label
Small addition to document conditional syntax at the field/label level
2 parents d0b5d3a + 934f4e5 commit f14ef00

File tree

7 files changed

+4650
-737
lines changed

7 files changed

+4650
-737
lines changed

docs/authoring/dynamic_phrasing_based_on_values.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ slug: dynamic_phrasing_based_on_values
66
---
77

88
Docassemble has several clever features that you can use in templates
9-
and in the body of your interview to automatically rephrase text in a
9+
and in the body of your interview to automatically rephrase text in a
1010
context specific way depending on:
1111

1212
1. the length of a list
@@ -15,7 +15,7 @@ context specific way depending on:
1515
In general, these features are useful short-hand solutions for problems that
1616
you could also solve with ordinary conditional text (e.g., an `if` statement).
1717

18-
These are covered in more depth in the documentation for
18+
These are covered in more depth in the documentation for
1919
[DAList](https://docassemble.org/docs/objects.html#DAList), although it may be hard to
2020
find the specific functions on that fairly long documentation page without internal anchors. The best solution
2121
to learn more may be to read about the method on this page, then visit the DAList documentation page
@@ -31,6 +31,34 @@ It's often safe to use the grammar shortcuts inside a template (because it will
3131
to avoid them inside the interview itself.
3232
:::
3333

34+
## What do to instead for text that will be translated
35+
36+
Instead of using the special grammar functions below, use conditional logic at the sentence level
37+
when the text might be translated in the future.
38+
39+
You might want to use the special [`label`/`field` syntax](https://docassemble.org/docs/fields.html#label) to make it
40+
easier to use conditional logic on the `field` level. This syntax allows you to use multi-line `mako` conditional
41+
syntax.
42+
43+
For example:
44+
45+
```yaml
46+
question: |
47+
% if children.number_gathered() > 1:
48+
Where do the children live?
49+
% else:
50+
Where does your child live?
51+
% endif
52+
fields:
53+
- label: |
54+
% if children.number_gathered() > 1:
55+
Children's address
56+
% else:
57+
Child's address
58+
% endif
59+
field: children.shared_address
60+
```
61+
3462
## Show the person's full name, without abbreviation
3563
3664
By default, Docassemble abbreviates an individual's middle name, so

docs/components/formfyxer/docx_wrangling.md

Lines changed: 0 additions & 123 deletions
This file was deleted.

0 commit comments

Comments
 (0)