Registry / Framework

framework · v0.1.2
Locale Bundle
Collect a declared number of translated segments and hold publication while segments remain.
Use Locale Bundle
use vendor::locale_bundle::locale_bundle;
Run the example
nest demo locale_bundle@0.1.2
blyxc native-run locale_bundle-demo/main.blyx
Example source and expected output
use std::cli;
use std::text;
use vendor::locale_bundle::locale_bundle;
fn main() {
let arguments = cli_args();
if args_len(arguments) > 0 {
if args_len(arguments) % 2 != 0 {
stderr_line("Expected event and value pairs");
process_exit(2);
}
let mut live = locale_bundle_start();
let mut i = 0;
while i < args_len(arguments) {
let input = args_at(arguments, i + 1);
if !text_is_number(input) {
stderr_line("Expected a whole numeric event value");
process_exit(2);
}
live = locale_bundle_step(live, args_at(arguments, i), text_number(input));
let command = locale_bundle_command(live);
println!(command);
if command == "reject" { process_exit(1); }
i += 2;
}
return;
}
let mut state = locale_bundle_start();
state = locale_bundle_step(state, "declare", 4.0);
println!(locale_bundle_command(state));
state = locale_bundle_step(state, "deliver", 1.0);
println!(locale_bundle_command(state));
state = locale_bundle_step(state, "deliver", 4.0);
println!(locale_bundle_command(state));
state = locale_bundle_step(state, "deliver", 3.0);
println!(locale_bundle_command(state));
state = locale_bundle_step(state, "publish", 0.0);
println!(locale_bundle_command(state));
}
Expected output
request_segments
accept_partial
reject
seal_bundle
expose_bundle
Published versions
| Version | Package | Source commit | SHA-256 |
|---|---|---|---|
| 0.1.2 | Download ZIP · Browse files | 53fe2ca594 | 2afc1077d0d81d15f143f5c48b10fccdcb841d7c58609bd392c57e931bc7e4ed |
| 0.1.1 | Download ZIP · Browse files | 1e2abb4891 | aa87bd0c32077c9b4a5c8706027265e9a5a0f0c8ef55bfa36a33dcc7a4a6b5a9 |
| 0.1.0 | Download ZIP · Browse files | 6349f23784 | a037b6c13c02b0c5d6939616b1f49f7dae9754642cde63eb3ff9b57cd38ba756 |