aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/i18n.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/i18n.md')
-rw-r--r--doc/i18n.md28
1 files changed, 17 insertions, 11 deletions
diff --git a/doc/i18n.md b/doc/i18n.md
index b7de2dc..dcb5727 100644
--- a/doc/i18n.md
+++ b/doc/i18n.md
@@ -92,14 +92,15 @@ follows:
The following character codes are available with the following behaviour:
-| Code | Mnemonic | Description |
-| ---- | ------------------ | ----------------------------------------------------------- |
-| `e` | \[e]mail | inserts a link to an email address |
-| `E` | \[E]nd | inserts closing-tags for the comma-separated HTML tags |
-| `l` | \[l]ink (internal) | links to an internal page |
-| `L` | \[L]ink (external) | links to an external page |
-| `m` | \[m]onetary | formats the given `int` or `float64` as an amount of Euros. |
-| `r` | \[r]aw | inserts the given string verbatim without HTML escaping |
+| Code | Mnemonic | Description |
+| ---- | ------------------ | ---------------------------------------------------------- |
+| `e` | \[e]mail | inserts a link to an email address |
+| `E` | \[E]nd | inserts closing-tags for the comma-separated HTML tags |
+| `l` | \[l]ink (internal) | links to an internal page |
+| `L` | \[L]ink (external) | links to an external page |
+| `m` | \[m]onetary | formats the given `int` or `float64` as an amount of Euros |
+| `p` | \[p]ercentage | formats the given `int` or `float64` as a percentage |
+| `r` | \[r]aw | inserts the given string verbatim without HTML escaping |
```html
<!-- <a href="mailto:help@euro-cash.eu">help@euro-cash.eu</a> -->
@@ -121,11 +122,16 @@ The following character codes are available with the following behaviour:
<!-- Varies per locale -->
<!-- €1 and €1.00 -->
<p>{{ .Get "{1:m} and {1.00:m}" (map "1" 1 "1.00" 1.00) }}</p>
+
+<!-- Varies per locale -->
+<!-- Ölen har 5 % alkoholhalt, eller egentligen 4,5 % -->
+<p>{{ .Get "The beer is {5:p} alcohol, or really {4.5:p}"
+ (map "5" 5 "4.5" 4.5) }}</p>
```
Some additional notes:
- The `-` name is special. `{-:E}` inserts `</a>`. This exists because
of how often you need to do this.
-- The `m` character code won’t include decimals when the argument is an
- integer, and will include the decimals when the argument is a
- floating-point number. \ No newline at end of file
+- The `p` and `m` character codes won’t include decimals when the
+ argument is an integer, and will include the decimals when the argument
+ is a floating-point number. \ No newline at end of file