Skip to content

Commit 2cc3074

Browse files
alerquechevdor
andauthored
Add Fluent function to Tera, link to data context (#21)
* refactor: Reuse tera instance for all types of runs * deps: Add fluent templating crate as optional dependency * feat: Inject fluent function to tera * test: Test use of fluent functions in template * ci: Add new feature flags to test matrix * Fix ci --------- Co-authored-by: Chevdor <chevdor@gmail.com>
1 parent 9c3e76d commit 2cc3074

10 files changed

Lines changed: 330 additions & 11 deletions

File tree

.github/workflows/quick-check.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,15 @@ jobs:
4949
uses: actions-rs/cargo@v1
5050
with:
5151
command: clippy
52-
args: -- -D warnings
52+
args: --all-features -- -D warnings
5353

5454
quick_check-tests:
55+
strategy:
56+
fail-fast: false
57+
matrix:
58+
feature-flags:
59+
- ''
60+
- '--all-features'
5561
runs-on: ubuntu-latest
5662
steps:
5763
- name: Install Rust stable toolchain
@@ -67,8 +73,10 @@ jobs:
6773
uses: actions-rs/cargo@v1
6874
with:
6975
command: test
76+
args: ${{ matrix.feature-flags }}
7077

7178
- name: Cargo check
7279
uses: actions-rs/cargo@v1
7380
with:
7481
command: check
82+
args: ${{ matrix.feature-flags }}

Cargo.lock

Lines changed: 248 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@ name = "teracli"
77
readme = "README.md"
88
version = "0.2.4"
99

10+
[features]
11+
default = []
12+
fluent = ["fluent-templates"]
13+
1014
[dependencies]
1115
clap = { version = "4", features = ["derive", "env", "unicode", "cargo"] }
1216
env_logger = "0.10"
17+
fluent-templates = { version = "0.8", optional = true, default-features = false, features = ["tera"]}
1318
log = "0.4"
1419
serde = "1.0"
1520
serde_json = { version = "1.0", optional = false }

data/basic/fluent.tera

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{ fluent(key="hello", name=en) }} {{ fluent(key="hello", lang="tr-TR", name=tr) }}

0 commit comments

Comments
 (0)