| LEFT | RIGHT |
| 1 # Websites translation string format | 1 # Websites translation string format |
| 2 | 2 |
| 3 ## Format | 3 ## Format |
| 4 | 4 |
| 5 `{{ $uid[$tag-name $tag-attribute] $contents }}` | 5 `{{ $uid[$context] $contents }}` |
| 6 |
| 7 ### $uid (required) |
| 8 |
| 9 Format |
| 10 : >= 1 alphanumeric asic char |
| 11 |
| 12 Exceptions |
| 13 : Should be human readable if reused. |
| 14 |
| 15 ### $context (optional - unnesisary for reuse) |
| 16 |
| 17 Format |
| 18 : Parent HTML tag and attribute name (if applicable) |
| 19 |
| 20 Exceptions |
| 21 : - Expand tag names e.g. "p" -> "paragraph" |
| 22 - Exclude irrelivant information like heading number e.g. "h1" -> "heading" |
| 23 - Provide functional context if applicable e.g. "title" -> "tooltip" |
| 24 |
| 25 ### $content (optional - unnessisary for reuse) |
| 26 |
| 27 Format: |
| 28 : >= 1 UTF-8 char |
| 29 |
| 30 Exceptions: |
| 31 : Should not contain "}}" |
| 6 | 32 |
| 7 ## Example | 33 ## Example |
| 8 | 34 |
| 9 ``` | 35 ``` |
| 10 <section> | 36 <nav> |
| 11 <h1>{{ 1[heading text] Example heading }}</h1> | 37 <h1>{{ brand-name[heading] Adblock Plus }}</h1> |
| 12 <p>{{ 2[paragraph text] Example paragraph }}</p> | 38 ... |
| 13 <ul> | 39 </nav> |
| 14 <li>{{ 5[list item text] List item }}</li> | 40 <header> |
| 15 </ul> | 41 <h1>{{ brand-name }}</h1> |
| 16 <a title="{{ 3[link tooltip text] Example tooltip }}">{{ 4[link text] Example
link }}</a> | 42 <p>{{ 1[subtitle] Blocks annoying ads }}</p> |
| 17 </section> | 43 </header> |
| 44 ... |
| 18 ``` | 45 ``` |
| 19 | 46 |
| 20 ## Explination | 47 - Notice how "brand-name" is reused |
| 48 - Notice how "1" has functional context |
| 49 - Notice that "1" is a UID not an NID. It could just as easily be "a" or "9" as
long as it's not used more than once on the page. |
| 21 | 50 |
| 22 ### $uid | 51 ## FAQ |
| 23 | 52 |
| 24 A numeric unique identifier. | 53 Why not make all string IDs human readable? |
| 54 : Because picky humans cannot generate or review them efficiently |
| 25 | 55 |
| 26 ### $tag-name | 56 Why not add location information to string contexts? |
| 27 | 57 : Because [picky humans cannot generate or review them efficiently, we often be
gin translation before implementation, we don't have a staging system to show vi
sual context information]. |
| 28 A human readable tag name. | |
| 29 | |
| 30 ### $tag-attribute | |
| 31 | |
| 32 A human readable tag attribute name. | |
| 33 | |
| 34 ### $contents | |
| 35 | |
| 36 String contents. | |
| 37 | |
| 38 ### FAQ | |
| 39 | |
| 40 Should $uid be human readable? | |
| 41 : No, because making it human readable only complicates things. | |
| 42 | |
| 43 Should $tag-name be human readable? | |
| 44 : Yes, use common sense to expand abbreviations e.g. p -> paragraph and exclud
e irrelivant information like heading number. | |
| 45 | |
| 46 Should $attribute-name be human readable? | |
| 47 : Yes, use common sense to expand the meaning of the attribute e.g. title -> t
ooltip. | |
| 48 | |
| 49 What if there is no attribute? | |
| 50 : Use "text". | |
| 51 | |
| 52 What about naming conflicts? | |
| 53 : These should be easy to spot if we test/preview and review changes. These co
uld also be identified by linting. | |
| 54 | |
| 55 What about order of numbers? | |
| 56 : It should be understood that these numbers are unique IDs; not ordered IDs (
I put them out-of-order in my example on purpose). | |
| LEFT | RIGHT |