Skip to content

Commit 91281fa

Browse files
Merge branch 'projectfluent:main' into main
2 parents 47802a7 + 10302d0 commit 91281fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+855
-822
lines changed

.github/workflows/clippy.yaml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Clippy
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
push:
7+
branches: [ main ]
8+
9+
10+
jobs:
11+
lints:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Toolchain setup
17+
uses: dtolnay/rust-toolchain@master
18+
with:
19+
toolchain: stable
20+
components: rustfmt
21+
22+
- name: Clippy
23+
run: cargo clippy --all-features -- -Dwarnings

.github/workflows/format.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
name: Rustfmt
22

33
on:
4-
# Triggers the workflow on push request events but only for the master branch
4+
# Triggers the workflow on push or pull request events but only for the main branch
55
push:
66
branches: [ main ]
7+
pull_request:
8+
branches: [ main ]
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
711

812
jobs:
913
format:
1014
runs-on: ubuntu-latest
1115
steps:
1216
- name: Toolchain setup
13-
uses: actions-rs/toolchain@v1
17+
uses: dtolnay/rust-toolchain@master
1418
with:
1519
toolchain: nightly
16-
override: true
1720
components: rustfmt
1821

19-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
2023
- name: Run rustfmt
2124
run: cargo fmt --check

.github/workflows/test.yaml

+7-8
Original file line numberDiff line numberDiff line change
@@ -21,35 +21,34 @@ jobs:
2121
- ''
2222
- '--all-features'
2323
steps:
24-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4
2525
- name: Cache cargo registry
26-
uses: actions/cache@v1
26+
uses: actions/cache@v4
2727
with:
2828
path: ~/.cargo/registry
2929
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
3030
- name: Cache cargo index
31-
uses: actions/cache@v1
31+
uses: actions/cache@v4
3232
with:
3333
path: ~/.cargo/git
3434
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
3535
- name: Cache cargo binaries
36-
uses: actions/cache@v1
36+
uses: actions/cache@v4
3737
with:
3838
path: ~/.cargo/bin
3939
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('**/Cargo.lock') }}
4040
- name: Toolchain setup
41-
uses: actions-rs/toolchain@v1
41+
uses: dtolnay/rust-toolchain@master
4242
with:
4343
toolchain: nightly
44-
override: true
4544
components: llvm-tools-preview
4645
- name: Install grcov
4746
if: matrix.rust-version == 'nightly' && matrix.cargo-args == '--all-features'
4847
run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install grcov; fi
4948
- name: Run tests
5049
run: cargo test --all-features --no-fail-fast
5150
env:
52-
RUSTFLAGS: '-Zinstrument-coverage'
51+
RUSTFLAGS: '-Cinstrument-coverage'
5352
- name: Run grcov
5453
if: matrix.rust-version == 'nightly' && matrix.cargo-args == '--all-features'
5554
# Important! Keep in grcov flags in sync with Makefile.internal.toml.
@@ -73,7 +72,7 @@ jobs:
7372
--excl-br-line '\#\[derive\(|// cov\(skip\)'
7473
- name: Coveralls upload
7574
if: matrix.rust-version == 'nightly' && matrix.cargo-args == '--all-features'
76-
uses: coverallsapp/github-action@master
75+
uses: coverallsapp/github-action@v2
7776
with:
7877
github-token: ${{ secrets.GITHUB_TOKEN }}
7978
path-to-lcov: coverage.lcov

Cargo.toml

+33-17
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,49 @@
11
[workspace]
2+
resolver = "2"
23
members = [
3-
"fluent-syntax",
4-
"fluent-bundle",
5-
"fluent-fallback",
6-
"fluent-resmgr",
7-
"fluent-pseudo",
8-
"fluent-testing",
9-
"fluent",
10-
"intl-memoizer"
4+
"fluent-syntax",
5+
"fluent-bundle",
6+
"fluent-fallback",
7+
"fluent-resmgr",
8+
"fluent-pseudo",
9+
"fluent-testing",
10+
"fluent",
11+
"intl-memoizer",
1112
]
1213

1314
exclude = [
14-
"fluent-cli",
15+
"fluent-cli",
1516
]
1617

18+
[workspace.package]
19+
homepage = "https://www.projectfluent.org"
20+
repository = "https://github.com/projectfluent/fluent-rs"
21+
license = "Apache-2.0 OR MIT"
22+
authors = [
23+
"Caleb Maclennan <caleb@alerque.com>",
24+
"Bruce Mitchener <bruce.mitchener@gmail.com",
25+
"Zibi Braniecki <zibi@unicode.org>",
26+
"Staś Małolepszy <stas@mozilla.com>",
27+
]
28+
categories = ["localization", "internationalization"]
29+
keywords = ["localization", "l10n", "i18n", "intl", "internationalization"]
30+
edition = "2021"
31+
rust-version = "1.67.0"
32+
1733
[workspace.dependencies]
18-
criterion = "0.3"
34+
criterion = "0.5"
1935
fluent-langneg = "0.13"
2036
futures = "0.3"
2137
iai = "0.1"
22-
intl_pluralrules = "7.0.1"
23-
rustc-hash = "1"
38+
intl_pluralrules = "7.0"
39+
rustc-hash = "2"
2440
serde = "1.0"
2541
serde_json = "1.0"
26-
thiserror = "1.0"
42+
thiserror = "2.0"
2743
tokio = "1.0"
2844
unic-langid = "0.9"
2945

30-
fluent-bundle = { path = "fluent-bundle" }
31-
fluent-fallback = { path = "fluent-fallback" }
32-
fluent-pseudo = { path = "fluent-pseudo" }
33-
fluent-syntax = { path = "fluent-syntax" }
46+
fluent-bundle = { version = "0.15.3", path = "fluent-bundle" }
47+
fluent-fallback = { version = "0.7.1", path = "fluent-fallback" }
48+
fluent-pseudo = { version = "0.3.2", path = "fluent-pseudo" }
49+
fluent-syntax = { version = "0.11.1", path = "fluent-syntax" }

Makefile.internal.toml

+8-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ workspace = false
1919
command = "cargo"
2020
args = ["test", "--all-features"]
2121
# toolchain = "nightly"
22-
env = { RUSTFLAGS = "-Cinstrument-coverage", RUSTDOCFLAGS = "-Cinstrument-coverage", LLVM_PROFILE_FILE = "llvm_profile-%p-%m.profraw" }
22+
23+
[tasks.coverage-run-tests.env]
24+
RUSTFLAGS = "-Cinstrument-coverage"
25+
RUSTDOCFLAGS = "-Cinstrument-coverage"
26+
LLVM_PROFILE_FILE = "llvm_profile-%p-%m.profraw"
2327

2428
# After generating the .profraw, this step creates the html report.
2529
# Important! Keep in grcov flags in sync with Makefile.internal.toml.
@@ -43,7 +47,9 @@ args = [
4347
"--excl-line", "\\#\\[derive\\(|// cov\\(skip\\)",
4448
"--excl-br-line", "\\#\\[derive\\(|// cov\\(skip\\)",
4549
]
46-
env = { LLVM_PROFILE_FILE = "llvm_profile-%p-%m.profraw" }
50+
51+
[tasks.coverage-run-grcov.env]
52+
LLVM_PROFILE_FILE = "llvm_profile-%p-%m.profraw"
4753

4854
# Cleans up all of the .profraw files left over after running -C instrument-coverage
4955
[tasks.coverage-clean-profraw]

README.md

+53-30
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,77 @@
1-
# Fluent [![Build and test](https://github.com/projectfluent/fluent-rs/workflows/Build%20and%20test/badge.svg)](https://github.com/projectfluent/fluent-rs/actions?query=branch%3Amain+workflow%3A%22Build+and+test%22) [![Coverage Status](https://coveralls.io/repos/github/projectfluent/fluent-rs/badge.svg?branch=main)](https://coveralls.io/github/projectfluent/fluent-rs?branch=main)
1+
# Project Fluent
22

3-
`fluent-rs` is a collection of Rust crates implementing [Project Fluent](https://projectfluent.org).
3+
[![Build](https://github.com/projectfluent/fluent-rs/actions/workflows/test.yaml/badge.svg)](https://github.com/projectfluent/fluent-rs/actions/workflows/test.yaml)
4+
[![Coverage Status](https://coveralls.io/repos/github/projectfluent/fluent-rs/badge.svg?branch=main)](https://coveralls.io/github/projectfluent/fluent-rs?branch=main)
5+
6+
The `fluent-rs` workspace is a collection of Rust crates implementing [Project Fluent][],
7+
a localization system designed to unleash the entire expressive power of natural language translations.
8+
9+
Project Fluent keeps simple things simple and makes complex things possible.
10+
The syntax used for describing translations is easy to read and understand.
11+
At the same time it allows, when necessary, to represent complex concepts from natural languages like gender, plurals, conjugations, and others.
412

513
## Packages
614

7-
The crates perform the following functions:
15+
This workspace contains the following crates:
816

9-
### fluent [![crates.io](https://img.shields.io/crates/v/fluent.svg)](https://crates.io/crates/fluent)
17+
### fluent
1018

11-
Umbrella crate combining crates that are ready to be used in production.
19+
[![crates.io](https://img.shields.io/crates/v/fluent.svg)](https://crates.io/crates/fluent)
20+
[![docs.rs](https://img.shields.io/docsrs/fluent)](https://docs.rs/fluent)
1221

13-
### fluent-syntax [![crates.io](https://img.shields.io/crates/v/fluent_syntax.svg)](https://crates.io/crates/fluent_syntax)
22+
An umbrella crate exposing the combined features of fluent-rs crates with additional convenience macros.
1423

15-
Low level Fluent Syntax AST and parser API.
24+
### fluent-bundle
1625

17-
### fluent-bundle [![crates.io](https://img.shields.io/crates/v/fluent_bundle.svg)](https://crates.io/crates/fluent_bundle)
26+
[![crates.io](https://img.shields.io/crates/v/fluent_bundle.svg)](https://crates.io/crates/fluent_bundle)
27+
[![docs.rs](https://img.shields.io/docsrs/fluent-bundle)](https://docs.rs/fluent-bundle)
1828

19-
Implementation of the low-level Fluent Localization System providing localization capabilities for any Rust project.
29+
A low-level implementation of a collection of localization messages for a single locale.
2030

21-
### fluent-fallback [![crates.io](https://img.shields.io/crates/v/fluent_fallback.svg)](https://crates.io/crates/fluent_fallback)
31+
### fluent-fallback
2232

23-
Implementation of the high-level Fluent Localization System providing localization capabilities for any Rust project.
33+
[![crates.io](https://img.shields.io/crates/v/fluent_fallback.svg)](https://crates.io/crates/fluent_fallback)
34+
[![docs.rs](https://img.shields.io/docsrs/fluent-fallback)](https://docs.rs/fluent-fallback)
2435

25-
### fluent-resmgr [![crates.io](https://img.shields.io/crates/v/fluent_resmgr.svg)](https://crates.io/crates/fluent_resmgr)
36+
A high-level abstraction model for managing locale bundles and runtime localization lifecycle.
2637

27-
Resource Manager for localization resources.
38+
### fluent-resmgr
2839

29-
### fluent-cli
40+
[![crates.io](https://img.shields.io/crates/v/fluent_resmgr.svg)](https://crates.io/crates/fluent_resmgr)
41+
[![docs.rs](https://img.shields.io/docsrs/fluent-resmgr)](https://docs.rs/fluent-resmgr)
42+
43+
A standalone solution for managing resource files and returning locale bundles.
44+
45+
### fluent-syntax
46+
47+
[![crates.io](https://img.shields.io/crates/v/fluent_syntax.svg)](https://crates.io/crates/fluent_syntax)
48+
[![docs.rs](https://img.shields.io/docsrs/fluent-syntax)](https://docs.rs/fluent-syntax)
3049

31-
Collection of command line tools for Fluent.
50+
A low-level parser, AST, and serializer API for the Fluent syntax.
3251

33-
## Running the project
52+
### fluent-pseudo
3453

35-
Each `fluent-*` directory works with the typical `cargo` commands. In addition there are some general `cargo-make` commands that can be run. First install `cargo-make` via `cargo install --force cargo-make`. The commands are documented in [Makefile.toml](Makefile.toml).
54+
[![crates.io](https://img.shields.io/crates/v/fluent_pseudo.svg)](https://crates.io/crates/fluent_pseudo)
55+
[![docs.rs](https://img.shields.io/docsrs/fluent-pseudo)](https://docs.rs/fluent-pseudo)
3656

37-
### Tests
57+
A pseudolocalization and transformation API.
3858

39-
To run all of the tests for the repo run:
59+
### fluent-testing
4060

41-
```sh
42-
cargo make test
43-
```
61+
[![crates.io](https://img.shields.io/crates/v/fluent_testing.svg)](https://crates.io/crates/fluent_testing)
62+
[![docs.rs](https://img.shields.io/docsrs/fluent-testing)](https://docs.rs/fluent-testing)
4463

45-
For local code coverage reports run:
64+
A collection of mock scenarios for testing fluent-rs components.
65+
66+
### intl-memoizer
67+
68+
[![crates.io](https://img.shields.io/crates/v/intl_memoizer.svg)](https://crates.io/crates/intl_memoizer)
69+
[![docs.rs](https://img.shields.io/docsrs/intl-memoizer)](https://docs.rs/intl-memoizer)
70+
71+
A memoizer specifically tailored for storing lazy-initialized intl formatters.
72+
73+
### fluent-cli
4674

47-
```sh
48-
# Install the tools first if you haven't done so. The llvm tools must be available
49-
# on the path for this to work correctly.
50-
cargo make install-tools
75+
A collection of developer-oriented command line tools for Fluent.
5176

52-
# Then coverage can be run like so:
53-
cargo make coverage
54-
```
77+
[Project Fluent]: https://projectfluent.org

docs/local-testing-firefox.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Now we need to upgrade all the dependencies to `fluent-rs` in the Firefox codeba
3939
- [Search for all references](https://searchfox.org/mozilla-central/search?q=%5E%28fluent%28-%5Cw%2B%29%3F%7Cintl-memoizer%29+%3D+%22.*%22&path=&case=false&regexp=true)
4040
- Update all the references to our local packages by using `{ path = "..." }` in the `Cargo.toml` file of the impacted packages.
4141

42-
### Exemple
42+
### Example
4343

4444
If both `fluent-rs` and `mozilla_unified` directories are on the same root directory, you can update the `fluent-fallback` entry from `fluent-fallback = "0.7.0"` to `fluent-fallback = { path = "../../../../../fluent-rs/fluent-fallback" }` in the `mozilla-unified/intl/l10n/rust/l10nregistry-ffi/Cargo.toml` file.
4545

fluent-bundle/CHANGELOG.md

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
# Changelog
22

33
## Unreleased
4-
5-
-
6-
4+
- Bump `self_cell` to 1.x
5+
- Bump `serde_yaml` to 0.9
6+
7+
## fluent-bundle 0.15.3 (March 16, 2024)
8+
- This is a 'safe harbor' release prior to bringing on non-Mozilla community maintainers
9+
- Implement `From<&String>` for `FluentValue`
10+
- Add `FluentValue.into_string` to prevent String clone
11+
- Fix `FluentValue::try_number` accepting numbers
12+
- Allow optional arguments on `FluentValue`
13+
- Fix behavior of `FluentArgs::set`
14+
- Resolve function instead in `impl ResolveValue`
15+
- Add type alias for concurrent `FluentBundle`
16+
- Fix `FluentBundle::format_pattern` lifetimes
17+
- Workspace: Update to Rust 2021
18+
- Workspace: Add various missing documentation and fix typos and links
19+
- Workspace: Cleanup meta-data using workspaces, use SPDX licenses, etc.
20+
- Workspace: Apply rustfmt and clippy lint fixes
721
## fluent-bundle 0.15.2 (October 25, 2021)
822
- Bump `self_cell` to 0.10.
923

0 commit comments

Comments
 (0)