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 Jan 30, 2024
1 parent ac8137f commit 6045b4a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public static OptionPage performance() {
.add(OptionImpl.createBuilder(int.class, sodiumOpts)
.setName(Text.translatable("sodium.options.chunk_update_threads.name"))
.setTooltip(Text.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 Text.translatable("options.gamma.min");
} else if (v == 50) {
return Text.translatable("options.gamma.default");
} else if (v == 100) {
return Text.translatable("options.gamma.max");
} else {
Expand All @@ -41,8 +43,8 @@ static ControlValueFormatter multiplier() {
return (v) -> Text.literal(v + "x");
}

static ControlValueFormatter quantityOrDisabled(String name, String disableText) {
return (v) -> Text.literal(v == 0 ? disableText : v + " " + name);
static ControlValueFormatter quantityOrDisabled(String key, String disableText) {
return (v) -> v == 0 ? Text.translatable(disableText) : Text.translatable(key, 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. 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.use_no_error_context.name": "Use No Error Context",
Expand Down

0 comments on commit 6045b4a

Please sign in to comment.