Open rezoner opened 8 years ago
Path resolving will probably change form from {path/to/entry}
to {@path/to/entry}
- that is because I want to introduce math mode Your dps is {damage / cooldown}
which may also evolve into little less readable but safer form {{damage} / {cooldown}}
That is to give translator as much flexibility as possible (I value mod community more than translators per se)
There is also need for functions like upperCaseFirst()
I suggest {path.to.entry}
instead of {@path/to/entry}
or {path/to/entry}
{
"items": {
"weapon": "bron",
"shield": "tarcza",
"armor": "zbroja"
}
}
app.dictionary("items.shield");
> tarcza
{
"weapon": {
"description": "Deals {item.damage} damage each {item.cooldown} seconds"
}
}
app.dictionary("weapon.description", {
item: { damage: 4, cooldown: 6 }
});
> Deals 4 damage each 6 seconds
Letting you know that I need multi language dictionary for my next game so I am working on one.
Leaving this open for discussion in case you expect some features.
Things so far:
Basic usage
Tree
Access object properties
Self lookup and {nested{tags}}
{tags} are resolved in order from inside to outside
If tag is a slash separated path ex.
"{path/to/something}"
the tag will be replaced by dictionary entry If tag is a dot separated path ex."{path.to.something}"
the tag will be replaced by replace entryHence it is possible to create quite flexible dictionary entries
Pulling random element from dictionary group
If the {tag} path ends with slash it will pull random entry from a group