Skip to content

Commit bb4feea

Browse files
committed
Update README with 0.0.4 status
1 parent cb11b85 commit bb4feea

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

README.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,17 @@ It is possible to use this for simple string localization with basic parameter s
2121
- [x] Format Basic messages
2222
- [x] Format String and Number literals
2323
- [x] Substitute VariableReferences
24-
- [ ] Handle Attributes
24+
- [x] Handle Attributes
2525
- [ ] Handle Terms
2626
- [ ] Handle MessageReferences
2727
- [ ] Setup Locale fallbacks in Bundle
2828
- [ ] Localize number formatting
2929
- [ ] Functions
3030

31+
### 0.0.4
32+
33+
Add support for attributes plus access to messages using idomatic Lua (table properties).
34+
3135
### 0.0.3
3236

3337
Added support for more types including format support for TextElement, StringLiteral, NumberLiteral, and VariableReference. Variable sutstitions can be done by passing a parameters table to `format()`. Internally manipulating nodes in the API is now easier with meta methods. For example merge comments with `Comment + Comment`, attach childred with `Message * Comment`, etc.
@@ -55,25 +59,30 @@ local bundle = FluentBundle()
5559

5660
-- Load some messages (can be a string or table of strings)
5761
bundle:add_messages([[
58-
foo = bar
5962
hello = Hello { $name }!
63+
foo = bar
64+
.attr = baz
6065
]])
6166

6267
-- Access methods like other Fluent implementations
6368
print(bundle:format("foo"))
69+
print(bundle:format("foo.attr"))
6470
print(bundle:format("hello", { name = "World" }))
6571

6672
-- Alternate idomatic Lua access methods
6773
print(bundle["foo"]) -- access property, implicit cast to string, cannot pass parammeters
74+
print("Attr: " .. bundle.foo.attr) -- access attributes as property, allow contatenation
6875
print(bundle.hello({ name = "World" })) -- access as property is callable, parameters passed to format()
6976
```
7077

7178
Output of `lua demo.lua`:
7279

7380
```txt
7481
bar
82+
baz
7583
Hello World!
7684
bar
85+
Attr: baz
7786
Hello World!
7887
```
7988

0 commit comments

Comments
 (0)