unicode-org / icu4x

Solving i18n for client-side and resource-constrained environments.
https://icu4x.unicode.org
Other
1.38k stars 178 forks source link

Change FsDataProvider to put data marker attributes in the same file #5784

Open sffc opened 2 weeks ago

sffc commented 2 weeks ago

In order to reduce the number of JSON files, it might make sense for the FsDataProvider to merge marker attributes into the locale files.

So, instead of this:

we could have foo@1/en.json with the following content:

{
    "attr1": "hello",
    "attr2": "world"
}

CC @Manishearth

robertbastian commented 2 weeks ago

Or one big file for everything 😃.

I don't really want to make changes to FS-JSON only. This doesn't seem compatible with FS-postcard.

sffc commented 2 weeks ago

Well I guess the way this works is that FsDataProvider would serialize a ZeroMap<str, DataStruct> which I think should work with postcard.

sffc commented 2 weeks ago

It does make postcard (and JSON) less efficient since a load operation needs to parse out the whole file. Hmm.

Manishearth commented 2 weeks ago

I think FS should just support both, selectable at datagen time, leading to .multi.json files (or whatever). We use the multi thing for JSON, where the goal is primarily human readability. We use individual ones for postcard where we actually want the slicing.