Skip to content

Commit 3dd2257

Browse files
committed
Use multiline string literals in examples of MessageContext.add_messages.
1 parent 806a459 commit 3dd2257

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

examples/external_arguments.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ use std::collections::HashMap;
77
fn main() {
88
let mut ctx = MessageContext::new(&["x-testing"]);
99

10-
ctx.add_messages("hello-world = Hello { $name }");
11-
ctx.add_messages("ref = The previous message says { hello-world }");
12-
ctx.add_messages("unread-emails = You have { $emailCount } unread emails");
10+
ctx.add_messages(
11+
"
12+
hello-world = Hello { $name }
13+
ref = The previous message says { hello-world }
14+
unread-emails = You have { $emailCount } unread emails
15+
",
16+
);
1317

1418
let mut args = HashMap::new();
1519
args.insert("name", FluentValue::from("John"));

examples/message_reference.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ use fluent::context::MessageContext;
55
fn main() {
66
let mut ctx = MessageContext::new(&["x-testing"]);
77

8-
ctx.add_messages("foo = Foo");
9-
ctx.add_messages("foobar = { foo } Bar");
10-
ctx.add_messages("bazbar = { baz } Bar");
8+
ctx.add_messages(
9+
"
10+
foo = Foo
11+
foobar = { foo } Bar
12+
bazbar = { baz } Bar
13+
",
14+
);
1115

1216
match ctx.get_message("foobar")
1317
.and_then(|msg| ctx.format(msg, None))

examples/simple.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ use fluent::context::MessageContext;
55
fn main() {
66
let mut ctx = MessageContext::new(&["x-testing"]);
77

8-
ctx.add_messages("key1 = Value 1");
9-
ctx.add_messages("key2 = Value 2");
8+
ctx.add_messages(
9+
"
10+
key1 = Value 1
11+
key2 = Value 2
12+
",
13+
);
1014

1115
match ctx.get_message("key1")
1216
.and_then(|msg| ctx.format(msg, None))

0 commit comments

Comments
 (0)