@@ -6,7 +6,7 @@ slug: dynamic_phrasing_based_on_values
66---
77
88Docassemble 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
1010context specific way depending on:
1111
12121 . the length of a list
@@ -15,7 +15,7 @@ context specific way depending on:
1515In general, these features are useful short-hand solutions for problems that
1616you 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
2020find the specific functions on that fairly long documentation page without internal anchors. The best solution
2121to 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
3131to 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
3664By default, Docassemble abbreviates an individual's middle name, so
0 commit comments