In the Lightning Web Runtime OSS documentation, in the "Use Module Providers" section, I can see "Your application components can now statically import labels sourced from JSON files in your project’s $rootDir/src/labels directory".
What is the expected JSON file format ?
Best Answer
After some tests, it looks like the following is working: In the src/labels directory, create one JSON file per locale you want to support, for instance
fr.json
,en_US.json
etcIn each file, format should be like this:
Then you can import your label in your LWC OSS like on the Platform which is pretty cool for reusability:
Looks like the correct locale is used if the related file exists, otherwise english is used. As soon as a file exists, all labels must be in there (it won't default to english for a specific value, just for a whole file).
This is just what I discovered by testing though and as it's not officially documented it could break at any time. I tried to get some more official information on the related Trailblazer Community Group.