Merge pull request #6 from fdb-hiroshima/feature/add-ci

Add continuous integration
pull/8/head
Baptiste Gelez 6 years ago committed by GitHub
commit 1b7c94a0c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,4 @@
language: rust
rust:
- nightly
cache: cargo

@ -17,3 +17,8 @@ tera = "0.11"
[dependencies.rocket] [dependencies.rocket]
git = "https://github.com/SergioBenitez/Rocket" git = "https://github.com/SergioBenitez/Rocket"
rev = "55459db7732b9a240826a5c120c650f87e3372ce" rev = "55459db7732b9a240826a5c120c650f87e3372ce"
[dev-dependencies.rocket_contrib]
features = ["tera_templates"]
git = "https://github.com/SergioBenitez/Rocket"
rev = "55459db7732b9a240826a5c120c650f87e3372ce"

@ -22,7 +22,10 @@
//! //!
//! Then, in your `main.rs`: //! Then, in your `main.rs`:
//! //!
//! ```rust //! ```rust,no_run
//! # //can't be run because 'po/LINGUAS' don't exist
//! # extern crate rocket;
//! # extern crate rocket_contrib;
//! extern crate rocket_i18n; //! extern crate rocket_i18n;
//! //!
//! // ... //! // ...
@ -34,7 +37,7 @@
//! // Eventually register the Tera filters (only works with the master branch of Rocket) //! // Eventually register the Tera filters (only works with the master branch of Rocket)
//! .attach(rocket_contrib::Template::custom(|engines| { //! .attach(rocket_contrib::Template::custom(|engines| {
//! rocket_i18n::tera(&mut engines.tera); //! rocket_i18n::tera(&mut engines.tera);
//! })) //! }));
//! // Register routes, etc //! // Register routes, etc
//! } //! }
//! ``` //! ```
@ -65,17 +68,13 @@
//! You can also use all the gettext functions in your Rust code. //! You can also use all the gettext functions in your Rust code.
//! //!
//! ```rust //! ```rust
//! use rocket_i18n; //! # #![feature(custom_attribute)]
//! use rocket_i18n::gettext;
//! //!
//! #[get("/")] //! #[get("/")]
//! fn index() -> String { //! fn index() -> String {
//! gettext("Hello, world!") //! gettext("Hello, world!")
//! } //! }
//!
//! #[get("/<name>")]
//! fn hello(name: String) -> String {
//! format!(gettext("Hello, {}!"), name)
//! }
//! ``` //! ```
//! //!
//! ### Editing the POT //! ### Editing the POT
@ -102,7 +101,7 @@ extern crate rocket;
extern crate serde_json; extern crate serde_json;
extern crate tera; extern crate tera;
use gettextrs::*; pub use gettextrs::*;
use rocket::{Data, Request, Rocket, fairing::{Fairing, Info, Kind}}; use rocket::{Data, Request, Rocket, fairing::{Fairing, Info, Kind}};
use std::{ use std::{
collections::HashMap, collections::HashMap,
@ -119,9 +118,12 @@ const ACCEPT_LANG: &'static str = "Accept-Language";
/// This is the main struct of this crate. You can register it on your Rocket instance as a /// This is the main struct of this crate. You can register it on your Rocket instance as a
/// fairing. /// fairing.
/// ///
/// ```rust /// ```rust,no_run
/// # //can't be run because 'po/LINGUAS' don't exist
/// # extern crate rocket;
/// # extern crate rocket_i18n;
/// rocket::ignite() /// rocket::ignite()
/// .attach(I18n::new("app")) /// .attach(rocket_i18n::I18n::new("app"));
/// ``` /// ```
/// ///
/// The parameter you give to [`I18n::new`] is the gettext domain to use. It doesn't really matter what you choose, /// The parameter you give to [`I18n::new`] is the gettext domain to use. It doesn't really matter what you choose,
@ -252,10 +254,13 @@ fn tera_ngettext(msg: serde_json::Value, ctx: HashMap<String, serde_json::Value>
/// Register translation filters on your Tera instance /// Register translation filters on your Tera instance
/// ///
/// ```rust /// ```rust
/// # extern crate rocket;
/// # extern crate rocket_contrib;
/// # extern crate rocket_i18n;
/// rocket::ignite() /// rocket::ignite()
/// .attach(rocket_contrib::Template::custom(|engines| { /// .attach(rocket_contrib::Template::custom(|engines| {
/// rocket_i18n::tera(&mut engines.tera); /// rocket_i18n::tera(&mut engines.tera);
/// })) /// }));
/// ``` /// ```
/// ///
/// The two registered filters are `_` and `_n`. For example use, see the crate documentation, /// The two registered filters are `_` and `_n`. For example use, see the crate documentation,

Loading…
Cancel
Save