Closed kubikaugustyn closed 2 weeks ago
The schema, if updated with every addition of a new string, can help people that use IDEs supporting JSON schema determine whether a new string has been added and/or removed and act accordingly - change the localization in their language.
How would IDEs detect the language JSONs use that schema in particular? Could you give an example with how you set it up for yourself specifically?
I personally use PyCharm Professional for these kinds of stuff, but I can say all IntelliiJ products support JSON schemas. You can check a guide for IntelliJ IDEA (works on Community Edition which I also use) on how to add a custom JSON schema. These also exist for WebStorm and PyCharm and more IntelliJ IDEs as well (they're the same process). I'll show it here specifically for Cosmic Reach though:
It will now show it's selected:
Now, although it may seem like it takes many steps to add it, in the end it's pretty straight forward.
But, when I am let's say adding new texts to some localization, I can just prepare to write a new JSON entry and trigger the Trigger Suggestions command (hit Ctrl + Space), which will bring up the popup with all the missing fields:
For VSCode users, which I'm not, you can also add JSON schemas to VSCode according to their documentation.
There is also a possibility to use it without setting up the schema in your IDE and just have the IDE detect it, and that is by providing a "$schema"
field to every single language file. That would make it possible to not have to register the schema in your IDE.
I've added the $schema
property in https://github.com/FinalForEach/Cosmic-Reach-Localization/pull/136/commits/863f7b04157243d8956075ed2795222aee921732. I've also experimentally set the property to cs_cz.json
. The only thing is I linked it to its future location:
https://github.com/FinalForEach/Cosmic-Reach-Localization/tree/master/assets/lang/lang.schema.json
and not it's current location:
https://github.com/kubikaugustyn/Cosmic-Reach-Localization/blob/Localization-schema/assets/lang/lang.schema.json
Feel free to edit the pull request as needed.
I'll take a look at this again after the next update
Okay, I'll try to keep maintaining the schema until then within this pull request
I just tested it out locally, and there weren't any issues! I'll merge it in now.
I have created a language/localization JSON schema for those who use an IDE that supports JSON schemas. It will need to be maintained and updated every time a new property/language string is added, see
__HOW_TO_ADD_PROPERTY__
for more information on that.