Add info on pack translations to new docs and update images

This commit is contained in:
JFronny 2021-09-09 18:18:47 +02:00
parent a256dd1126
commit 45f0bbf5b9
No known key found for this signature in database
GPG Key ID: BEC5ACBBD4EE17E5
11 changed files with 58 additions and 5 deletions

View File

@ -1,5 +1,10 @@
# ResourcePackOpts Config.
### Before we begin
Any pack id or config entry name MUST only contain alphabetical characters (no numbers, spaces, underscores, etc) and SHOULD be in [camelCase](https://en.wikipedia.org/wiki/Camel_case).\
If that is not the case, you may face unexpected issues.\
You can add [translations](./Translations.md) to work around this in the UI shown to users though.
### Location (ResourcePacks).
> `/assets/respackopts/conf.json`
@ -19,7 +24,6 @@
```
### Capabilities:
> **FileFilter:** (Default Enabled) <br> If stated will enable file filtering functionality.
> **DirFilter:** (Default Disabled) <br> If stated will enable folder filtering functionality.
@ -27,7 +31,6 @@
> **DirFilterAdditive:** (Default Disabled) <br> If stated this will enable a compatibility fix for some mods that also modify resources.
## Adding a Toggle/Boolean
To add a boolean entry, add code like this: `"entryName": <Default Option (true/false)>`
### Example:

View File

@ -1,6 +1,6 @@
# ResPackOpts Home
Here is everything you need to know about configuring your resource with respackopts.\
Some pages may not have been updated, you can view those [here](https://gitlab.com/jfmods/respackopts/-/tree/master/docs/old)
Some pages may not have been updated, you can view those [here](old/)
### Compatibility
- Frex/Canvas Shaders

46
docs/Translations.md Normal file
View File

@ -0,0 +1,46 @@
# Translating your config
Adding a translation file to your pack can not only be used to translate your content, it also enables you to change the way entries are displayed in the config screen without changing your actual config.\
NOTE: translations added like this will only be shown if the resource pack containing them is loaded.
## Creating a lang file
Respackopts relies on minecrafts built-in system for translations. This means that you can add them to the normal `assets/minecraft/lang/en_us.json` file in which minecrafts on translations reside.\
An empty translation file will look like this:
```json
{
// your entries
}
```
## Changing the config screens title
In order to change the title of the config screen respackopts generates for your pack, you can add an entry as follows:
```json
{
"rpo.examplePack": "Some other name"
}
```
This will change the display name of the pack with the id `examplePack` to the piece of text after it, in this case `Some other name`.
## Changing an entries name
This works similarly to changing the title, however, the name of the entry is appended to the pack id. Example:
```json
{
"rpo.examplePack": "Some other name",
"rpo.examplePack.someTexture": "Some Texture"
}
```
This example would set the text of the entry named `someTexture` in the pack with the id `examplePack`. Categories work the same way as they do in .rpo files and everywhere else: you use `categoryName.entryName` instead of `entryName`.
## Adding a tooltip to an entry
The translation system also enables you to add tooltips (small pieces of text that are shown only if the users' mouse cursor is above the option) to config options. The syntax for these is as follows: `rpo.tooltip.<PackID>.<Entry Name>`.\
Example:
```json
{
"rpo.examplePack": "Some other name",
"rpo.examplePack.someTexture": "Some Texture",
"rpo.tooltip.examplePack.someTexture": "This would be the tooltip"
}
```
## Finished example
Assuming that someTexture is a boolean toggle, with the language file presented above, the config screen will look as follows:
![configExampleTranslated](./img/ExamplePackTranslations.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -6,7 +6,7 @@ However, the quality of the documentation here is worse.
| Page | Status |
| --- | --- |
| home | done |
| adding_entries | TODO explain translations/tooltips and name restrictions (alphabetic + camelCase) |
| adding_entries | done |
| canvas | TODO |
| conditional | TODO explain advanced conditions/condition arrays |
| expand | TODO |

View File

@ -54,7 +54,11 @@ public class ConfigBranch extends ConfigEntry<Map<String, ConfigEntry<?>>> {
syncSub(current, (ConfigEntry)e.getValue(), mode);
}
else {
Respackopts.LOGGER.warn("Type mismatch in config (" + getName() + "), ignoring");
if (mode == SyncMode.RESPACK_LOAD) {
Respackopts.LOGGER.warn("Type mismatch in config (" + getName() + "), overwriting");
add(e.getKey(), e.getValue().clone());
} else
Respackopts.LOGGER.warn("Type mismatch in config (" + getName() + "), ignoring");
}
}
}