Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make some strings translatable. #2292

Open
wants to merge 11 commits into
base: dev
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,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 @@ -31,6 +31,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 @@ -57,8 +59,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 disableKey) {
return (v) -> v == 0 ? Component.translatable(disableKey) : Component.translatable(valueKey, v);
}

static ControlValueFormatter number() {
Expand Down
1 change: 1 addition & 0 deletions common/src/main/resources/assets/sodium/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,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