Update dependencies

This commit is contained in:
Savanni D'Gerinel 2022-04-21 09:14:53 -04:00
parent 78ca4b6a09
commit 033e9982ea
3 changed files with 84 additions and 103 deletions

View File

@ -9,7 +9,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc4d7142005e2066e4844caf9f271b93fc79836ee96ec85057b8c109687e629a"
dependencies = [
"fluent-bundle",
"unic-langid 0.9.0",
"unic-langid",
]
[[package]]
@ -25,7 +25,7 @@ dependencies = [
"rustc-hash",
"self_cell",
"smallvec",
"unic-langid 0.9.0",
"unic-langid",
]
[[package]]
@ -34,7 +34,7 @@ version = "0.2.0"
dependencies = [
"fluent",
"fluent-syntax",
"unic-langid 0.8.0",
"unic-langid",
]
[[package]]
@ -43,7 +43,7 @@ version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c4ad0989667548f06ccd0e306ed56b61bd4d35458d54df5ec7587c0e8ed5e94"
dependencies = [
"unic-langid 0.9.0",
"unic-langid",
]
[[package]]
@ -62,7 +62,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c310433e4a310918d6ed9243542a6b83ec1183df95dff8f23f87bb88a264a66f"
dependencies = [
"type-map",
"unic-langid 0.9.0",
"unic-langid",
]
[[package]]
@ -72,7 +72,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b18f988384267d7066cc2be425e6faf352900652c046b6971d2e228d3b1c5ecf"
dependencies = [
"tinystr",
"unic-langid 0.9.0",
"unic-langid",
]
[[package]]
@ -157,31 +157,13 @@ dependencies = [
"rustc-hash",
]
[[package]]
name = "unic-langid"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d81136159f779c35b10655f45210c71cd5ca5a45aadfe9840a61c7071735ed"
dependencies = [
"unic-langid-impl 0.8.0",
]
[[package]]
name = "unic-langid"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73328fcd730a030bdb19ddf23e192187a6b01cd98be6d3140622a89129459ce5"
dependencies = [
"unic-langid-impl 0.9.0",
]
[[package]]
name = "unic-langid-impl"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c43c61e94492eb67f20facc7b025778a904de83d953d8fcb60dd9adfd6e2d0ea"
dependencies = [
"tinystr",
"unic-langid-impl",
]
[[package]]

View File

@ -19,5 +19,5 @@ include = [
[dependencies]
fluent = "0.15"
unic-langid = "0.8"
unic-langid = "0.9"
fluent-syntax = "0.11"

View File

@ -3,8 +3,7 @@
//! The Fluent class makes it easier to load translation bundles with language fallbacks and to go
//! through the most common steps of translating a message.
//!
use fluent::FluentBundle;
use fluent::{FluentArgs, FluentError, FluentResource};
use fluent::{FluentArgs, FluentBundle, FluentError, FluentResource};
use fluent_syntax::parser::ParserError;
use std::collections::hash_map::Entry;
use std::collections::HashMap;
@ -156,7 +155,7 @@ impl FluentErgo {
bundle.add_resource(res).map_err(|err| Error::from(err))
}
Entry::Vacant(e) => {
let mut bundle = FluentBundle::new(&[lang]);
let mut bundle = FluentBundle::new(vec![lang]);
bundle.add_resource(res).map_err(|err| Error::from(err))?;
e.insert(bundle);
Ok(())
@ -251,7 +250,7 @@ impl FluentErgo {
args: Option<&FluentArgs>,
) -> Option<String> {
let mut errors = vec![];
let pattern = bundle.get_message(msgid).and_then(|msg| msg.value);
let pattern = bundle.get_message(msgid).and_then(|msg| msg.value());
let res = match pattern {
None => None,
Some(p) => {
@ -286,12 +285,12 @@ time_display = {$time} during the day
nested_display = nesting a time display: {time_display}
";
const EO_TRANSLATIONS: &'static str = "
const EO_TRANSLATIONS: &'static str = "
history = Historio
";
#[test]
fn translations() {
#[test]
fn translations() {
let en_id = "en-US".parse::<LanguageIdentifier>().unwrap();
let mut fluent = FluentErgo::new(&vec![en_id.clone()]);
fluent
@ -301,10 +300,10 @@ fn translations() {
fluent.tr("preferences", None).unwrap(),
String::from("Preferences")
);
}
}
#[test]
fn translation_fallback() {
#[test]
fn translation_fallback() {
let eo_id = "eo".parse::<LanguageIdentifier>().unwrap();
let en_id = "en".parse::<LanguageIdentifier>().unwrap();
let mut fluent = FluentErgo::new(&vec![eo_id.clone(), en_id.clone()]);
@ -322,10 +321,10 @@ fn translation_fallback() {
fluent.tr("history", None).unwrap(),
String::from("Historio")
);
}
}
#[test]
fn placeholder_insertion_should_strip_placeholder_markers() {
#[test]
fn placeholder_insertion_should_strip_placeholder_markers() {
let en_id = "en".parse::<LanguageIdentifier>().unwrap();
let mut fluent = FluentErgo::new(&vec![en_id.clone()]);
fluent
@ -337,10 +336,10 @@ fn placeholder_insertion_should_strip_placeholder_markers() {
fluent.tr("time_display", Some(&args)).unwrap(),
String::from("13:00 during the day")
);
}
}
#[test]
fn placeholder_insertion_should_strip_nested_placeholder_markers() {
#[test]
fn placeholder_insertion_should_strip_nested_placeholder_markers() {
let en_id = "en".parse::<LanguageIdentifier>().unwrap();
let mut fluent = FluentErgo::new(&vec![en_id.clone()]);
fluent
@ -352,17 +351,17 @@ fn placeholder_insertion_should_strip_nested_placeholder_markers() {
fluent.tr("nested_display", Some(&args)).unwrap(),
String::from("nesting a time display: 13:00 during the day")
);
}
}
#[test]
fn test_send() {
#[test]
fn test_send() {
fn assert_send<T: Send>() {}
assert_send::<FluentErgo>();
}
}
#[test]
fn test_sync() {
#[test]
fn test_sync() {
fn assert_sync<T: Sync>() {}
assert_sync::<FluentErgo>();
}
}
}