sfmohassel / libc.translation

A library to help you implement translation using json files to replace .resx files in .net standard projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Performance concerns

codengine opened this issue · comments

Hi, I stumbled across your project while looking for a json based translation solution.
It does work well, so kudos for that.

However, I think it is not a good idea to keep the whole JSON structure in memory and look for the translation keys with iterations.

I'd propose to load all keys in a flat structure into dictionaries and just access those dictionary keys.
Based on the PropertyCaseSensitivity the keys could be converted to lower-case, as well as the key that is being searched.

Moreover, I'd also propose to allow a directory-based solution where each file represents a single language instead of having everything in one humongous file.

I did a proof-of-concept implementation already locally and wanted to hear your opinion.

Thanks in advance

@codengine So sorry to answer late, had a lot going on lately.
I say let's see your implementation :-)
I'm open to all contributions

#12
There you go :)

To also give a bit context regarding the split into multiple files has one major advantage.
Most of the time the user uses exactly one language file. If it just contains a few keys thats ok.

But in my case I have about 65kb of language strings to load, at three languages. So its a waste of resources.

@codengine Wow, great! I'll take a look tonight :-)