mirror of
https://github.com/slint-ui/slint.git
synced 2025-12-23 09:19:32 +00:00
Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
39 lines
1.4 KiB
Text
39 lines
1.4 KiB
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
|
|
|
export component TestCase {
|
|
property <int> int_value: 42;
|
|
|
|
property <string> t1: @tr("Hello World{{}}.");
|
|
property <string> t2: @tr("Hello {}.", "World");
|
|
property <string> t3: @tr("{} Hello {}", int_value, "World");
|
|
property <string> t4: @tr("{1} Hello {0}🌍", @tr("World"), int_value + 1);
|
|
|
|
property <string> c1: @tr("Context" => "xx{0}xx", @tr("CC" => "aa"));
|
|
|
|
function make_plural1(xx: int, yy: string) -> string { return @tr("there is one file in my {}" | "there are {n} files in my {}" % xx, yy); }
|
|
function make_plural2(xx: int) -> string { return @tr("Ctx=>" => "xx{n}xx" | "yy" % xx); }
|
|
|
|
out property <bool> test: t1 == "Hello World{}." && t2 == "Hello World." && t3 == "42 Hello World" && t4 == "43 Hello World🌍"
|
|
&& c1 == "xxaaxx"
|
|
&& make_plural1(1, @tr("Plop")) == "there is one file in my Plop" && make_plural1(10, @tr("Flop")) == "there are 10 files in my Flop"
|
|
&& make_plural2(1) == "xx1xx" && make_plural2(-999) == "yy";
|
|
}
|
|
/*
|
|
```cpp
|
|
auto handle = TestCase::create();
|
|
const TestCase &instance = *handle;
|
|
assert(instance.get_test());
|
|
```
|
|
|
|
|
|
```rust
|
|
let instance = TestCase::new().unwrap();
|
|
assert!(instance.get_test());
|
|
```
|
|
|
|
```js
|
|
var instance = new slint.TestCase({});
|
|
assert(instance.test);
|
|
```
|
|
*/
|