Skip to content

Commit

Permalink
live-preview: Do not offer plural forms in UI
Browse files Browse the repository at this point in the history
@ogoffart relorts those do not fully work yet, so
let's just disable those for the time being.
  • Loading branch information
hunger committed Feb 18, 2025
1 parent c94d494 commit c71e2f3
Showing 1 changed file with 42 additions and 37 deletions.
79 changes: 42 additions & 37 deletions tools/lsp/ui/components/property-widgets.slint
Original file line number Diff line number Diff line change
Expand Up @@ -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 <bool> enabled;
in property <string> property-name;
in property <PropertyValue> property-value;
Expand All @@ -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 <bool> open: false;

Expand Down Expand Up @@ -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();
// }
// }
// }
}
}
}
Expand Down

0 comments on commit c71e2f3

Please sign in to comment.