File tree 3 files changed +20
-8
lines changed
3 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,13 @@ use std::collections::HashMap;
7
7
fn main ( ) {
8
8
let mut ctx = MessageContext :: new ( & [ "x-testing" ] ) ;
9
9
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
+ ) ;
13
17
14
18
let mut args = HashMap :: new ( ) ;
15
19
args. insert ( "name" , FluentValue :: from ( "John" ) ) ;
Original file line number Diff line number Diff line change @@ -5,9 +5,13 @@ use fluent::context::MessageContext;
5
5
fn main ( ) {
6
6
let mut ctx = MessageContext :: new ( & [ "x-testing" ] ) ;
7
7
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
+ ) ;
11
15
12
16
match ctx. get_message ( "foobar" )
13
17
. and_then ( |msg| ctx. format ( msg, None ) )
Original file line number Diff line number Diff line change @@ -5,8 +5,12 @@ use fluent::context::MessageContext;
5
5
fn main ( ) {
6
6
let mut ctx = MessageContext :: new ( & [ "x-testing" ] ) ;
7
7
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
+ ) ;
10
14
11
15
match ctx. get_message ( "key1" )
12
16
. and_then ( |msg| ctx. format ( msg, None ) )
You can’t perform that action at this time.
0 commit comments