| 1 |
<!DOCTYPE html> |
| 2 |
<html><head> |
| 3 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> |
| 4 |
<title>highlight_fluent.ftl</title> |
| 5 |
<meta name="generator" content="KF5::SyntaxHighlighting - Definition (Fluent) - Theme (Breeze Dark)"/> |
| 6 |
</head><body style="background-color:#232629;color:#cfcfc2"><pre> |
| 7 |
<span style="color:#a43340;">### File wide comment, for reference see https://projectfluent.org</span> |
| 8 |
<span style="color:#a43340;">### And for a EBNF-Syntax, see https://github.com/projectfluent/fluent/blob/master/spec/fluent.ebnf</span> |
| 9 |
|
| 10 |
|
| 11 |
<span style="color:#a43340;">## Section comment: Simple texts</span> |
| 12 |
<span style="color:#7a7c7d;"># identifier = matched word</span> |
| 13 |
<span style="font-weight:bold;">hello-world</span> = <span style="color:#f44f4f;">Hello World</span> |
| 14 |
|
| 15 |
<span style="color:#7a7c7d;"># multiline text</span> |
| 16 |
<span style="font-weight:bold;">multiline</span> = <span style="color:#f44f4f;">Some text on the first line</span> |
| 17 |
<span style="color:#f44f4f;"> And more text on the next line</span> |
| 18 |
<span style="color:#f44f4f;"> One could even go further</span> |
| 19 |
|
| 20 |
<span style="color:#7a7c7d;"># block text</span> |
| 21 |
<span style="font-weight:bold;">block</span> = |
| 22 |
<span style="color:#f44f4f;"> No content on first line</span> |
| 23 |
<span style="color:#f44f4f;"> rest is like multiline</span> |
| 24 |
|
| 25 |
|
| 26 |
<span style="color:#a43340;">## Placeables, insert text from variables etc.</span> |
| 27 |
<span style="font-weight:bold;">variable-placeable</span> = <span style="color:#f44f4f;">We currently have </span><span style="color:#3daee9;">{ </span><span style="color:#27aeae;">$users</span><span style="color:#3daee9;"> }</span><span style="color:#f44f4f;"> users</span> |
| 28 |
<span style="font-weight:bold;">stacked-placeable</span> = <span style="color:#f44f4f;">More </span><span style="color:#3daee9;">{{</span><span style="color:#f44f4f;">"Placeables"</span><span style="color:#3daee9;">}}</span> |
| 29 |
|
| 30 |
<span style="color:#7a7c7d;"># Term, used only in other texts, not final translation string</span> |
| 31 |
<span style="font-weight:bold;">-name</span> = <span style="color:#f44f4f;">Fluent</span> |
| 32 |
<span style="font-weight:bold;">about</span> = <span style="color:#3daee9;">{ -name }</span><span style="color:#f44f4f;"> is great</span> |
| 33 |
|
| 34 |
<span style="color:#7a7c7d;"># Term with parameters</span> |
| 35 |
<span style="font-weight:bold;">-special-term</span> = <span style="color:#f44f4f;">Wrapper around </span><span style="color:#3daee9;">{ </span><span style="color:#27aeae;">$parameter</span><span style="color:#3daee9;"> }</span> |
| 36 |
<span style="font-weight:bold;">using-wrapper</span> = <span style="color:#f44f4f;">Wrapping </span><span style="color:#3daee9;">{ </span><span style="color:#8e44ad;">-special-term(parameter: </span><span style="color:#f44f4f;">"stuff"</span><span style="color:#8e44ad;">)</span><span style="color:#3daee9;"> }</span> |
| 37 |
|
| 38 |
<span style="font-weight:bold;">placeable-with-special-character</span> = <span style="color:#f44f4f;">Using a </span><span style="color:#3daee9;">{</span><span style="color:#f44f4f;">"{ and \U01F91A or \\"</span><span style="color:#3daee9;">}</span> |
| 39 |
|
| 40 |
<span style="font-weight:bold;">builtin-number</span> = <span style="color:#f44f4f;">Time elapsed: </span><span style="color:#3daee9;">{ </span><span style="color:#8e44ad;">NUMBER(</span><span style="color:#27aeae;">$duration</span><span style="color:#8e44ad;">, maximumFractionDigits: </span><span style="color:#f67400;">0</span><span style="color:#8e44ad;">)</span><span style="color:#3daee9;"> }</span><span style="color:#f44f4f;">s.</span> |
| 41 |
|
| 42 |
<span style="font-weight:bold;">builtin-date</span> = <span style="color:#f44f4f;">Last checked: </span><span style="color:#3daee9;">{ </span><span style="color:#8e44ad;">DATETIME(</span><span style="color:#27aeae;">$lastChecked</span><span style="color:#8e44ad;">, day: </span><span style="color:#f44f4f;">"numeric"</span><span style="color:#8e44ad;">, month: </span><span style="color:#f44f4f;">"long"</span><span style="color:#8e44ad;">)</span><span style="color:#3daee9;"> }</span><span style="color:#f44f4f;">.</span> |
| 43 |
|
| 44 |
|
| 45 |
<span style="color:#a43340;">## Selectors, different options for different types of numbers</span> |
| 46 |
<span style="color:#7a7c7d;"># by variable</span> |
| 47 |
<span style="font-weight:bold;">emails</span> = |
| 48 |
<span style="color:#f44f4f;"> </span><span style="color:#3daee9;">{ </span><span style="color:#27aeae;">$unreadEmails</span><span style="color:#3daee9;"> -></span> |
| 49 |
<span style="color:#3daee9;"> </span><span style="font-weight:bold;">[one]</span><span style="color:#f44f4f;"> You have one unread email.</span> |
| 50 |
<span style="color:#3daee9;"> </span><span style="font-weight:bold;">*[other]</span><span style="color:#f44f4f;"> You have </span><span style="color:#3daee9;">{ </span><span style="color:#27aeae;">$unreadEmails</span><span style="color:#3daee9;"> }</span><span style="color:#f44f4f;"> unread emails.</span> |
| 51 |
<span style="color:#3daee9;"> }</span> |
| 52 |
|
| 53 |
<span style="color:#7a7c7d;"># by function</span> |
| 54 |
<span style="font-weight:bold;">your-score</span> = |
| 55 |
<span style="color:#f44f4f;"> </span><span style="color:#3daee9;">{ </span><span style="color:#8e44ad;">NUMBER(</span><span style="color:#27aeae;">$score</span><span style="color:#8e44ad;">, minimumFractionDigits: </span><span style="color:#f67400;">1</span><span style="color:#8e44ad;">)</span><span style="color:#3daee9;"> -></span> |
| 56 |
<span style="color:#3daee9;"> </span><span style="font-weight:bold;">[0.0]</span><span style="color:#f44f4f;"> You scored zero points. What happened?</span> |
| 57 |
<span style="color:#3daee9;"> </span><span style="font-weight:bold;">*[other]</span><span style="color:#f44f4f;"> You scored </span><span style="color:#3daee9;">{ </span><span style="color:#8e44ad;">NUMBER(</span><span style="color:#27aeae;">$score</span><span style="color:#8e44ad;">, minimumFractionDigits: </span><span style="color:#f67400;">1</span><span style="color:#8e44ad;">)</span><span style="color:#3daee9;"> }</span><span style="color:#f44f4f;"> points.</span> |
| 58 |
<span style="color:#3daee9;"> }</span> |
| 59 |
|
| 60 |
<span style="color:#7a7c7d;"># with keywords</span> |
| 61 |
<span style="font-weight:bold;">your-rank</span> = <span style="color:#3daee9;">{ </span><span style="color:#8e44ad;">NUMBER(</span><span style="color:#27aeae;">$pos</span><span style="color:#8e44ad;">, type: </span><span style="color:#f44f4f;">"ordinal"</span><span style="color:#8e44ad;">)</span><span style="color:#3daee9;"> -></span> |
| 62 |
<span style="color:#3daee9;"> </span><span style="font-weight:bold;">[1]</span><span style="color:#f44f4f;"> You finished first!</span> |
| 63 |
<span style="color:#3daee9;"> </span><span style="font-weight:bold;">[one]</span><span style="color:#f44f4f;"> You finished </span><span style="color:#3daee9;">{</span><span style="color:#27aeae;">$pos</span><span style="color:#3daee9;">}</span><span style="color:#f44f4f;">st</span> |
| 64 |
<span style="color:#3daee9;"> </span><span style="font-weight:bold;">[two]</span><span style="color:#f44f4f;"> You finished </span><span style="color:#3daee9;">{</span><span style="color:#27aeae;">$pos</span><span style="color:#3daee9;">}</span><span style="color:#f44f4f;">nd</span> |
| 65 |
<span style="color:#3daee9;"> </span><span style="font-weight:bold;">[few]</span><span style="color:#f44f4f;"> You finished </span><span style="color:#3daee9;">{</span><span style="color:#27aeae;">$pos</span><span style="color:#3daee9;">}</span><span style="color:#f44f4f;">rd</span> |
| 66 |
<span style="color:#3daee9;"> </span><span style="font-weight:bold;">*[other]</span><span style="color:#f44f4f;"> You finished </span><span style="color:#3daee9;">{</span><span style="color:#27aeae;">$pos</span><span style="color:#3daee9;">}</span><span style="color:#f44f4f;">th</span> |
| 67 |
<span style="color:#3daee9;">}</span> |
| 68 |
|
| 69 |
<span style="color:#a43340;">## Attributes</span> |
| 70 |
<span style="font-weight:bold;">login-input</span> = <span style="color:#f44f4f;">Predefined value</span> |
| 71 |
<span style="color:#f44f4f;"> </span><span style="font-weight:bold;">.placeholder</span> = <span style="color:#f44f4f;">[email protected]</span> |
| 72 |
<span style="color:#f44f4f;"> </span><span style="font-weight:bold;">.aria-label</span> = <span style="color:#f44f4f;">Login input value</span> |
| 73 |
<span style="color:#f44f4f;"> </span><span style="font-weight:bold;">.title</span> = <span style="color:#f44f4f;">Type your login email</span> |
| 74 |
|
| 75 |
<span style="color:#7a7c7d;"># accessible via .</span> |
| 76 |
<span style="font-weight:bold;">login-placeholder</span> = <span style="color:#3daee9;">{login-input.placeholder}</span> |
| 77 |
|
| 78 |
<span style="color:#a43340;">## Faulty code, no gurantees for sense of the end of errors</span> |
| 79 |
|
| 80 |
<span style="font-weight:bold;">faulty-quote</span> = <span style="color:#f44f4f;">Won't work </span><span style="color:#3daee9;">{</span><span style="color:#f44f4f;">"\"}</span> |
| 81 |
<span style="color:#3daee9;"> still-inside</span><span style="color:#da4453;text-decoration:underline;">\</span> |
| 82 |
<span style="color:#f44f4f;"> </span><span style="color:#3daee9;">{</span><span style="color:#f44f4f;">"lonely \\ </span><span style="color:#da4453;text-decoration:underline;">\ "}</span> |
| 83 |
<span style="color:#3daee9;">}</span> |
| 84 |
|
| 85 |
<span style="font-weight:bold;">disallowed-identifier</span><span style="color:#da4453;text-decoration:underline;"> characters</span> |
| 86 |
<span style="font-weight:bold;">disallowed-character</span><span style="color:#da4453;text-decoration:underline;">$</span> |
| 87 |
|
| 88 |
<span style="color:#7a7c7d;"># Hilight only at the end of the line, not visible since err only visible on same line</span> |
| 89 |
<span style="font-weight:bold;">broken-function</span> = <span style="color:#3daee9;">{</span><span style="color:#8e44ad;">fn(</span> |
| 90 |
<span style="color:#3daee9;"> </span><span style="color:#8e44ad;">fn(smth:</span><span style="color:#f67400;">123</span><span style="color:#8e44ad;">, </span><span style="color:#f67400;">0</span><span style="color:#8e44ad;">, </span><span style="color:#3daee9;">{</span><span style="color:#da4453;text-decoration:underline;">)</span> |
| 91 |
<span style="color:#3daee9;"> </span><span style="color:#8e44ad;">fn(noth</span><span style="color:#da4453;text-decoration:underline;">!ng:3)</span> |
| 92 |
<span style="color:#3daee9;"> </span><span style="color:#8e44ad;">fn(</span><span style="color:#da4453;text-decoration:underline;">\)</span> |
| 93 |
<span style="color:#3daee9;">}</span> |
| 94 |
|
| 95 |
<span style="color:#7a7c7d;"># Same for open ended string and wron unicode characters</span> |
| 96 |
<span style="font-weight:bold;">broken-string</span> = <span style="color:#3daee9;">{</span> |
| 97 |
<span style="color:#3daee9;"> </span><span style="color:#f44f4f;">"</span> |
| 98 |
<span style="color:#3daee9;"> </span><span style="color:#f44f4f;">"</span><span style="color:#da4453;text-decoration:underline;">\u923"</span> |
| 99 |
<span style="color:#3daee9;"> </span><span style="color:#f44f4f;">"</span><span style="color:#da4453;text-decoration:underline;">\U92345"</span> |
| 100 |
<span style="color:#3daee9;"> </span><span style="color:#f44f4f;">"</span><span style="color:#da4453;text-decoration:underline;">\Ubcdefg"</span> |
| 101 |
<span style="color:#3daee9;">}</span> |
| 102 |
</pre></body></html> |