From 5d5297c2f433e471429495c1d86e299846a5c789 Mon Sep 17 00:00:00 2001 From: KAYT33N Date: Wed, 7 Aug 2024 10:29:47 +0330 Subject: [PATCH] Minor changes --- src/bigclock/en.zig | 4 +++- src/bigclock/fa.zig | 4 +++- src/config/migrator.zig | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/bigclock/en.zig b/src/bigclock/en.zig index de0946b..868656a 100644 --- a/src/bigclock/en.zig +++ b/src/bigclock/en.zig @@ -4,6 +4,7 @@ const LocaleChars = Lang.LocaleChars; const X = Lang.X; const O = Lang.O; +// zig fmt: off pub const locale_chars = LocaleChars{ .ZERO = [_]u21{ X,X,X,X,X, @@ -89,4 +90,5 @@ pub const locale_chars = LocaleChars{ O,O,O,O,O, O,O,O,O,O, }, -}; \ No newline at end of file +}; +// zig fmt: on \ No newline at end of file diff --git a/src/bigclock/fa.zig b/src/bigclock/fa.zig index 36ff2eb..63a897a 100644 --- a/src/bigclock/fa.zig +++ b/src/bigclock/fa.zig @@ -4,6 +4,7 @@ const LocaleChars = Lang.LocaleChars; const X = Lang.X; const O = Lang.O; +// zig fmt: off pub const locale_chars = LocaleChars{ .ZERO = [_]u21{ O,O,O,O,O, @@ -89,4 +90,5 @@ pub const locale_chars = LocaleChars{ O,O,O,O,O, O,O,O,O,O, }, -}; \ No newline at end of file +}; +// zig fmt: on \ No newline at end of file diff --git a/src/config/migrator.zig b/src/config/migrator.zig index f003213..0a004bd 100644 --- a/src/config/migrator.zig +++ b/src/config/migrator.zig @@ -85,6 +85,21 @@ pub fn configFieldHandler(_: std.mem.Allocator, field: ini.IniField) ?ini.IniFie return null; } + if (std.mem.eql(u8, field.key, "bigclock")) { + // The option now uses a string (which then gets converted into an enum) instead of an boolean + // It also includes the ability to change active bigclock's language + var mapped_field = field; + + if (std.mem.eql(u8, field.value, "true")) + mapped_field.value = "en"; + if (std.mem.eql(u8, field.value, "false")) + mapped_field.value = "none"; + + + mapped_config_fields = true; + return mapped_field; + } + return field; }