Fix build on latest nigthly

Fixes #11
pull/13/head
Ana Gelez 5 years ago
parent a32c0ee40e
commit c5395ab049

@ -1,6 +1,6 @@
[package]
name = "gettext-macros"
version = "0.5.1"
version = "0.5.2"
authors = ["Ana Gelez <ana@gelez.xyz>"]
description = "A few proc-macros to help internationalizing Rust applications"
repository = "https://github.com/Plume-org/gettext-macros"
@ -12,4 +12,4 @@ proc-macro = true
[dependencies]
gettext = "0.4"
runtime-fmt = "0.3"
runtime-fmt = "0.4"

@ -1 +1 @@
nightly-2018-12-06
nightly-2019-08-28

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene, proc_macro_quote, proc_macro_span, uniform_paths, external_doc)]
#![feature(proc_macro_hygiene, proc_macro_quote, proc_macro_span, external_doc)]
#![doc(include = "../README.md")]
@ -488,13 +488,15 @@ pub fn i18n(input: TokenStream) -> TokenStream {
let mut gettext_call = TokenStream::from_iter(catalog);
let content = message.content;
if let Some(pl) = message.plural {
let count = message
let count: TokenStream = message
.format_args
.clone()
.into_iter()
.next()
.expect("Item count should be specified")
.clone();
.take_while(|x| match x {
TokenTree::Punct(p) if p.as_char() == ',' => false,
_ => true
})
.collect();
if let Some(c) = message.context {
gettext_call.extend(quote!(
.npgettext($c, $content, $pl, $count as u64)
@ -521,6 +523,7 @@ pub fn i18n(input: TokenStream) -> TokenStream {
use runtime_fmt::*;
rt_format!($gettext_call, $fargs).expect("Error while formatting message")
});
// println!("{:#?}", res);
res
}

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene, decl_macro, uniform_paths)]
#![feature(proc_macro_hygiene, decl_macro)]
use gettext_macros::*;
@ -23,6 +23,9 @@ fn main() {
println!("{} {}", x, b);
println!("{}", i18n!(cat, "Woohoo, it {}"; "works"));
println!(i18n_domain!());
let v = vec![1, 2, 3];
i18n!(cat, "Test complex formatting {}, {}", "aaahh"; v[0], v[2]);
}
compile_i18n!();

Loading…
Cancel
Save