Skip to content

Commit

Permalink
Fix doc forms template
Browse files Browse the repository at this point in the history
  • Loading branch information
Salamandar committed Mar 5, 2025
1 parent b8c5b4f commit 82dca7b
Showing 1 changed file with 33 additions and 26 deletions.
59 changes: 33 additions & 26 deletions doc/forms_doc_template.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,42 @@ Doc auto-generated by [this script](https://github.com/YunoHost/yunohost/blob/{{
You may encounter some named types which are used for simplicity.

- `Translation`: a translated property
- used for properties: `ask`, `help` and `Pattern.error`
- a `dict` with locales as keys and translations as values:
```toml
ask.en = "The text in english"
ask.fr = "Le texte en français"
```
It is not currently possible for translators to translate those string in weblate.
- a single `str` for a single english default string
```toml
help = "The text in english"
```
- used for properties: `ask`, `help` and `Pattern.error`
- a `dict` with locales as keys and translations as values:

```toml
ask.en = "The text in english"
ask.fr = "Le texte en français"
```

It is not currently possible for translators to translate those string in weblate.

- a single `str` for a single english default string

```toml
help = "The text in english"
```

- `JSExpression`: a `str` JS expression to be evaluated to `true` or `false`:
- used for properties: `visible` and `enabled`
- operators availables: `==`, `!=`, `>`, `>=`, `<`, `<=`, `!`, `&&`, `||`, `+`, `-`, `*`, `/`, `%` and `match()`
- used for properties: `visible` and `enabled`
- operators availables: `==`, `!=`, `>`, `>=`, `<`, `<=`, `!`, `&&`, `||`, `+`, `-`, `*`, `/`, `%` and `match()`
- `Binding`: bind a value to a file/property/variable/getter/setter/validator
- save the value in `settings.yaml` when not defined
- nothing at all with `"null"`
- a custom getter/setter/validator with `"null"` + a function starting with `get__`, `set__`, `validate__` in `scripts/config`
- a variable/property in a file with `:__FINALPATH__/my_file.php`
- a whole file with `__FINALPATH__/my_file.php`
- save the value in `settings.yaml` when not defined
- nothing at all with `"null"`
- a custom getter/setter/validator with `"null"` + a function starting with `get__`, `set__`, `validate__` in `scripts/config`
- a variable/property in a file with `:__FINALPATH__/my_file.php`
- a whole file with `__FINALPATH__/my_file.php`
- `Pattern`: a `dict` with a regex to match the value against and an error message
```toml
pattern.regexp = '^[A-F]\d\d$'
pattern.error = "Provide a room number such as F12: one uppercase and 2 numbers"
# or with translated error
pattern.error.en = "Provide a room number such as F12: one uppercase and 2 numbers"
pattern.error.fr = "Entrez un numéro de salle comme F12: une lettre majuscule et deux chiffres."
```
- IMPORTANT: your `pattern.regexp` should be between simple quote, not double.

```toml
pattern.regexp = '^[A-F]\d\d$'
pattern.error = "Provide a room number such as F12: one uppercase and 2 numbers"
# or with translated error
pattern.error.en = "Provide a room number such as F12: one uppercase and 2 numbers"
pattern.error.fr = "Entrez un numéro de salle comme F12: une lettre majuscule et deux chiffres."
```

- IMPORTANT: your `pattern.regexp` should be between simple quote, not double.

## Configuration panel structure
{% for name, docstring in configpanel.items() %}
Expand Down

0 comments on commit 82dca7b

Please sign in to comment.