String resource markup format
Author: dbrgnCreated Mar 29, 2015Updated May 21, 2025
Labelsarea: assetsto-discuss
I stumbled over this comment in the converter source:
# TODO: transform and cleanup the read strings...
# (strip html, insert formatchars/identifiers, ...)When take a look at the strings, the following format is being used:
<Team><b>Mini-map<b>Create <b> Samurai<b> (<cost>)- ..
I see two different "features" in there. The first one is the pseudo-HTML (it's not HTML as no proper closing tags are being used) that's being used for markup. The other thing is placeholders.
My suggestion is the following:
- Use a markdown subset for markup:
*italic*,**bold**,***bold italic***. Maybe also the underscore variants (although I prefer simplicity). - Use a placeholder syntax inspired by Python 3's named
.format()syntax:Create **Samurai** ({cost}). I don't think we need formatting syntax like!sor:.2. - Convert all uppercase placeholders to lowercase. Convert camelCase (not sure if that even exists) to snake_case.
- Strip unneeded whitespace
So the examples above would become:
{team}**Mini-map**Create **Samurai** ({cost})
An alternative placeholder could be like in the Django template language: {{ placeholder_name }}. That would also leave open the possibility for filters: {{ begin_date|date:"d.m.y H:M" }}
Opinions?
Source: SFTtech/openage