Hi,
I am facing the translation of my game: I made a json file with all the strings I intend to use to send it to friends from other native languages.
Since every language has its own special characters(letters), I'd like to extract all the characters used in each specific language file, to a unique string for each language (to cache them on TTfont.new() ).
As an example, from the sentence:
"Both devices must be connected to the same local network"
I'd like to extract the string:
aBbcdehiklmnostuvw"I need to do this on every language file to get a "character set" for each language.
Maybe I am searching with the wrong keywords, since I can't find anything about this on the internet.
Do you have any suggestion on how I could do it?
Thank you
Comments
You could try to do that automatically, like iterating through every string (or rather splitting it into array and iterating it, http://stackoverflow.com/a/832414)
and create one single table, holding character as key, and setting value to true, so in the end you would have a table like
{
a = true,
b = true,
c = true,
--etc
}
Which would be a table with all unique symbols, and then you just iterate and concatenate all keys into single string.
The only thing I'm afraid of is utf encoding. Then iterating string by symbols, you would need to make sure you iterate it not by bytes, by but real symbols, based on encoding. Maybe Lua does it automatically, maybe you need to do something additionally, I don't know.
Likes: pie
It seems to work with latin characters and some other random grapheme I tried.
Could someone with knowledge in languages which use different sets of characters try it please?
Thank you