From c71e2f3c964154bd0bbb6776c1eafb5107c42e2a Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 18 Feb 2025 15:39:31 +0000 Subject: [PATCH] live-preview: Do not offer plural forms in UI @ogoffart relorts those do not fully work yet, so let's just disable those for the time being. --- .../lsp/ui/components/property-widgets.slint | 79 ++++++++++--------- 1 file changed, 42 insertions(+), 37 deletions(-) diff --git a/tools/lsp/ui/components/property-widgets.slint b/tools/lsp/ui/components/property-widgets.slint index 9f36d233b62..43ee9d348f1 100644 --- a/tools/lsp/ui/components/property-widgets.slint +++ b/tools/lsp/ui/components/property-widgets.slint @@ -295,6 +295,9 @@ component FloatWidget inherits VerticalLayout { } component StringWidget { + // FIXME: @ogoffart says the plural support is not working at this time, so + // we do not offer it in the UI for the time being... + in property enabled; in property property-name; in property property-value; @@ -306,10 +309,12 @@ component StringWidget { callback set-string-binding(text: string, is-translated: bool); function tsb() -> bool { - return test-string-binding(Api.string-to-code(text-rle.text, tr-cb.checked, tr-context.text, tr-plural.text, tr-plural-expression.text), tr-cb.checked); + // return test-string-binding(Api.string-to-code(text-rle.text, tr-cb.checked, tr-context.text, tr-plural.text, tr-plural-expression.text), tr-cb.checked); + return test-string-binding(Api.string-to-code(text-rle.text, tr-cb.checked, tr-context.text, "", ""), tr-cb.checked); } function ssb() { - set-string-binding(Api.string-to-code(text-rle.text, tr-cb.checked, tr-context.text, tr-plural.text, tr-plural-expression.text), tr-cb.checked); + // set-string-binding(Api.string-to-code(text-rle.text, tr-cb.checked, tr-context.text, tr-plural.text, tr-plural-expression.text), tr-cb.checked); + set-string-binding(Api.string-to-code(text-rle.text, tr-cb.checked, tr-context.text, "", ""), tr-cb.checked); } property open: false; @@ -378,41 +383,41 @@ component StringWidget { } } } - Row { - Text { - vertical-alignment: center; - horizontal-alignment: right; - text: "Plural"; - } - tr-plural := ResettingLineEdit { - enabled: root.enabled && tr-cb.checked; - default-text: root.property-value.tr-plural; - edited(text) => { - self.can-compile = root.tsb(); - } - accepted(text) => { - root.ssb(); - } - } - } - Row { - Text { - vertical-alignment: center; - horizontal-alignment: right; - text: "Expression"; - } - tr-plural-expression := ResettingLineEdit { - enabled: root.enabled && tr-cb.checked; - default-text: root.property-value.tr-plural-expression; - edited(text) => { - self.can-compile = root.tsb(); - tr-plural.can-compile = self.can-compile; - } - accepted(text) => { - root.ssb(); - } - } - } + // Row { + // Text { + // vertical-alignment: center; + // horizontal-alignment: right; + // text: "Plural"; + // } + // tr-plural := ResettingLineEdit { + // enabled: root.enabled && tr-cb.checked; + // default-text: root.property-value.tr-plural; + // edited(text) => { + // self.can-compile = root.tsb(); + // } + // accepted(text) => { + // root.ssb(); + // } + // } + // } + // Row { + // Text { + // vertical-alignment: center; + // horizontal-alignment: right; + // text: "Expression"; + // } + // tr-plural-expression := ResettingLineEdit { + // enabled: root.enabled && tr-cb.checked; + // default-text: root.property-value.tr-plural-expression; + // edited(text) => { + // self.can-compile = root.tsb(); + // tr-plural.can-compile = self.can-compile; + // } + // accepted(text) => { + // root.ssb(); + // } + // } + // } } } }