}
It needs to be able to be easily parsed afterwards. I couldn't figure out how to map strings to arrays in a Nim table.
Any advice?
You can do it like that:
import std/tables
var mapping = {
"male": @["男性", "homme"],
"female": @["女性", "femme"],
"unisex": @["ユニセックス", "unisexe"]
}.toTable()
echo mapping["male"]
Or, if you want to fill it manually:
import std/tables
# Mapping from a single string to multiple
# strings
var mapping: Table[string, seq[string]]
mapping["male"] = @["男性", "homme"]
mapping["female"] = @["女性", "femme"]
echo mapping["male"]
This assumes that values in the table can be of different length, if you want them to all be the same, then use array[2, string] instead of seq[string]