Skip to content

Commit

Permalink
Make some strings translatable.
Browse files Browse the repository at this point in the history
  • Loading branch information
7777777-4547 committed Feb 17, 2024
1 parent 0918f28 commit 8f7f41e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public static OptionPage performance() {
.add(OptionImpl.createBuilder(int.class, sodiumOpts)
.setName(Component.translatable("sodium.options.chunk_update_threads.name"))
.setTooltip(Component.translatable("sodium.options.chunk_update_threads.tooltip"))
.setControl(o -> new SliderControl(o, 0, Runtime.getRuntime().availableProcessors(), 1, ControlValueFormatter.quantityOrDisabled("threads", "Default")))
.setControl(o -> new SliderControl(o, 0, Runtime.getRuntime().availableProcessors(), 1, ControlValueFormatter.quantityOrDisabled("sodium.options.chunk_update_threads.value", "options.gamma.default")))
.setImpact(OptionImpact.HIGH)
.setBinding((opts, value) -> opts.performance.chunkBuilderThreads = value, opts -> opts.performance.chunkBuilderThreads)
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ static ControlValueFormatter brightness() {
return (v) -> {
if (v == 0) {
return Component.translatable("options.gamma.min");
} else if (v == 50) {
return Component.translatable("options.gamma.default");
} else if (v == 100) {
return Component.translatable("options.gamma.max");
} else {
Expand All @@ -23,6 +25,7 @@ static ControlValueFormatter brightness() {
};
}


static ControlValueFormatter biomeBlend() {
return (v) -> (v == 0) ? Component.translatable("gui.none") : Component.translatable("sodium.options.biome_blend.value", v);
}
Expand All @@ -41,8 +44,8 @@ static ControlValueFormatter multiplier() {
return (v) -> Component.literal(v + "x");
}

static ControlValueFormatter quantityOrDisabled(String name, String disableText) {
return (v) -> Component.literal(v == 0 ? disableText : v + " " + name);
static ControlValueFormatter quantityOrDisabled(String valueKey, String disableText) {
return (v) -> v == 0 ? Component.translatable(disableText) : Component.translatable(valueKey, v);
}

static ControlValueFormatter number() {
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/sodium/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"sodium.options.use_persistent_mapping.tooltip": "For debugging only. If enabled, persistent memory mappings will be used for the staging buffer so that unnecessary memory copies can be avoided. Disabling this can be useful for narrowing down the cause of graphical corruption.\n\nRequires OpenGL 4.4 or ARB_buffer_storage.",
"sodium.options.chunk_update_threads.name": "Chunk Update Threads",
"sodium.options.chunk_update_threads.tooltip": "Specifies the number of threads to use for chunk building and sorting. Using more threads can speed up chunk loading and update speed, but may negatively impact frame times. The default value is usually good enough for all situations.",
"sodium.options.chunk_update_threads.value": "%s thread(s)",
"sodium.options.always_defer_chunk_updates.name": "Always Defer Chunk Updates",
"sodium.options.always_defer_chunk_updates.tooltip": "If enabled, rendering will never wait for chunk updates to finish, even if they are important. This can greatly improve frame rates in some scenarios, but it may create significant visual lag where blocks take a while to appear or disappear.",
"sodium.options.sort_behavior.name": "Translucency Sorting",
Expand Down

0 comments on commit 8f7f41e

Please sign in to comment.