Ensure that URLs are assigned to correct anchor tags in translatable strings
Background
We're assigning URLs at runtime while resolving translations. Currently, we're doing that by assigning them in the order of the anchor tags we find inside the string. However, that order may change depending on how the string got translated. Therefore we need to be able to uniquely mark up parts of translatable strings so that we're not only able to tell that they're supposed to be hyperlinked but also which link they refer to.
This is essential for the upcoming first-run page which, unlike other pages, has strings which contain multiple strings in the same sentence (see https://gitlab.com/eyeo/specs/spec/merge_requests/148).
Note that we probably don't want to change all translatable strings, we should prefer a backwards compatible approach.
What to change
- Introduce support for the tags
<a0>
to<a9>
in translatable strings. - Handle legacy
<a>
tags in the order they appear in (i.e. use current behavior) but after handling all<a#>
tags.
Validation (optional):
- Prevent using the same
<a#>
tag multiple times in the same string. - Prevent using
<a>
tags in strings that contain<a#>
strings.