Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rscarson committed Oct 25, 2023
1 parent c879025 commit 99aa32d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
10 changes: 7 additions & 3 deletions src/language.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,13 @@ impl Language {
}
}

match pos.unwrap() {
LanguageStringObject::Direct(s) => Some(s),
LanguageStringObject::Category(_) => None,
if let Some(pos) = pos {
match pos {
LanguageStringObject::Direct(s) => Some(s),
LanguageStringObject::Category(_) => None,
}
} else {
None
}
}
}
Expand Down
15 changes: 7 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
//! A small library to provide translation strings as an embedded resource
//! Language files are in JSON format and will be embedded into the binary at compile time.
//!
//!
//! Please see the examples directory for language file samples
//!
//!
//! Usage example:
//! ```rust
//! use embedded_lang::{ LanguageSet, embedded_language };
//!
//!
//! fn main() {
//! let mut translator = LanguageSet::new("fr", &[
//! embedded_language!("../examples/en.lang.json"),
//! embedded_language!("../examples/fr.lang.json"),
//! ]);
//! translator.set_fallback_language("en");
//!
//!
//! assert_eq!(translator["tree"], "arbre".to_string());
//! }
//! ```
//!
//!
//! LanguageSets have a current language, and a fallback language from which strings will be fetched
//! if the current language is missing the requested string.
#![doc(html_root_url = "https://docs.rs/embedded-lang/0.7.0")]
#![doc(html_root_url = "https://docs.rs/embedded-lang/0.8.0")]
#![warn(missing_docs)]
#![warn(rustdoc::missing_doc_code_examples)]

mod language;
mod language_set;
Expand All @@ -43,4 +42,4 @@ mod test_token {
fn test_html_root_url() {
version_sync::assert_html_root_url_updated!("src/lib.rs");
}
}
}

0 comments on commit 99aa32d

Please sign in to comment.