M Cargo.lock => Cargo.lock +15 -40
@@ 230,9 230,9 @@ dependencies = [
[[package]]
name = "fluent"
-version = "0.13.1"
+version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ef9e54ec7b674ae3477d948ae790e90ae24d54fb31c2e7173252978d9b09bdfa"
+checksum = "61f69378194459db76abd2ce3952b790db103ceb003008d3d50d97c41ff847a7"
dependencies = [
"fluent-bundle",
"unic-langid",
@@ 240,15 240,16 @@ dependencies = [
[[package]]
name = "fluent-bundle"
-version = "0.13.2"
+version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "092ebd50cd3f8a6d664bf156e3550d2f7232fbe446da6707d727cca53f707ce2"
+checksum = "e242c601dec9711505f6d5bbff5bedd4b61b2469f2e8bb8e57ee7c9747a87ffd"
dependencies = [
"fluent-langneg",
- "fluent-syntax 0.10.3",
+ "fluent-syntax",
"intl-memoizer",
"intl_pluralrules",
- "rental",
+ "rustc-hash",
+ "self_cell",
"smallvec",
"unic-langid",
]
@@ 264,12 265,6 @@ dependencies = [
[[package]]
name = "fluent-syntax"
-version = "0.10.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "784f660373ea898f712a7e67b43f35bf79608d46112747c29767d087611d716b"
-
-[[package]]
-name = "fluent-syntax"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0abed97648395c902868fee9026de96483933faa54ea3b40d652f7dfe61ca78"
@@ 483,13 478,14 @@ dependencies = [
"fallible-iterator",
"fluent",
"fluent-langneg",
- "fluent-syntax 0.11.0",
+ "fluent-syntax",
"futures-util",
"ginger",
"hitide_icons",
"http",
"hyper",
"hyper-tls",
+ "intl-memoizer",
"lazy_static",
"log",
"multer",
@@ 1153,27 1149,6 @@ dependencies = [
]
[[package]]
-name = "rental"
-version = "0.5.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc89fe2acac36d212474d138aaf939c04a82df5b61d07011571ebce5aef81f2e"
-dependencies = [
- "rental-impl",
- "stable_deref_trait",
-]
-
-[[package]]
-name = "rental-impl"
-version = "0.5.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "475e68978dc5b743f2f40d8e0a8fdc83f1c5e78cbf4b8fa5e74e73beebc340de"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 1.0.109",
-]
-
-[[package]]
name = "rust-ini"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ 1247,6 1222,12 @@ dependencies = [
]
[[package]]
+name = "self_cell"
+version = "0.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1ef965a420fe14fdac7dd018862966a4c14094f900e1650bbc71ddd7d580c8af"
+
+[[package]]
name = "semver"
version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ 1328,12 1309,6 @@ dependencies = [
]
[[package]]
-name = "stable_deref_trait"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
-
-[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
M Cargo.toml => Cargo.toml +2 -1
@@ 31,11 31,12 @@ unic-langid = { version = "0.9.0", features = ["macros"] }
futures-util = "0.3.5"
hitide_icons = { path = "./icons" }
multer = "1.2.2"
-fluent = "0.13.1"
+fluent = "0.16.0"
log = "0.4"
env_logger = "0.8"
config = { version = "0.11.0", default-features = false, features = ["ini"] }
url = { version = "2.2.2", features = ["serde"] }
+intl-memoizer = "0.5.1"
[build-dependencies]
fluent-syntax = "0.11.0"
M src/lang.rs => src/lang.rs +9 -3
@@ 1,12 1,18 @@
use std::borrow::Cow;
pub struct Translator {
- bundle: fluent::concurrent::FluentBundle<&'static fluent::FluentResource>,
+ bundle: fluent::bundle::FluentBundle<
+ &'static fluent::FluentResource,
+ intl_memoizer::concurrent::IntlLangMemoizer,
+ >,
primary_language: unic_langid::LanguageIdentifier,
}
impl Translator {
pub fn new(
- bundle: fluent::concurrent::FluentBundle<&'static fluent::FluentResource>,
+ bundle: fluent::bundle::FluentBundle<
+ &'static fluent::FluentResource,
+ intl_memoizer::concurrent::IntlLangMemoizer,
+ >,
primary_language: unic_langid::LanguageIdentifier,
) -> Translator {
Translator {
@@ 22,7 28,7 @@ impl Translator {
let mut errors = Vec::with_capacity(0);
let out = match self.bundle.get_message(key) {
Some(msg) => self.bundle.format_pattern(
- msg.value.expect("Missing value for translation key"),
+ msg.value().expect("Missing value for translation key"),
args,
&mut errors,
),
M src/main.rs => src/main.rs +4 -1
@@ 138,7 138,10 @@ pub fn get_lang_for_headers(headers: &hyper::header::HeaderMap) -> Translator {
None => vec![&default],
};
- let mut bundle = fluent::concurrent::FluentBundle::new(languages.iter().copied());
+ let mut bundle = fluent::bundle::FluentBundle::<
+ &'static fluent::FluentResource,
+ intl_memoizer::concurrent::IntlLangMemoizer,
+ >::new_concurrent(languages.iter().copied().cloned().collect());
for lang in &languages {
if let Err(errors) = bundle.add_resource(&LANG_MAP[lang]) {
for err in errors {