From 0310a3d2d3536cccd79ed118d01c929545c969cf Mon Sep 17 00:00:00 2001 From: Terry Raimondo Date: Wed, 9 Oct 2019 02:41:34 +0200 Subject: [PATCH] Travis config file --- .travis.yml | 19 +++++++++++++++++++ README.md | 1 + locales/test.json | 4 ++++ src/lib.rs | 7 +++++-- 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..cd53568 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +language: rust +rust: + - stable + - beta + - nightly +matrix: + include: + - rust: nightly + before_script: + - export PATH=$HOME/.cargo/bin:$PATH + - cargo install cargo-update || echo "cargo-update already installed" + - cargo install cargo-travis || echo "cargo-travis already installed" + - cargo install-update -a + - mkdir -p target/kcov-master + script: cargo coveralls --verbose --all-features + allow_failures: + - rust: nightly + fast_finish: true +cache: cargo diff --git a/README.md b/README.md index d6c06c5..863aa2d 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ ![LICENSE](https://img.shields.io/crates/l/internationalization) [![Crates.io Version](https://img.shields.io/crates/v/internationalization.svg)](https://crates.io/crates/internationalization) [![Coverage Status](https://coveralls.io/repos/github/terry90/internationalization-rs/badge.svg?branch=master)](https://coveralls.io/github/terry90/internationalization-rs?branch=master) +[![Build Status](https://travis-ci.org/terry90/internationalization-rs.svg?branch=master)](https://travis-ci.org/terry90/internationalization-rs) An simple compile time i18n implementation in Rust. It throws a compilation error if the translation key is not present, but since the `lang` argument is dynamic it will panic if the language has not been added for the matching key. diff --git a/locales/test.json b/locales/test.json index dc9ae57..8092081 100644 --- a/locales/test.json +++ b/locales/test.json @@ -2,5 +2,9 @@ "key.test": { "en": "This is a test", "fr": "C'est un test" + }, + "err.not_allowed": { + "en": "You are not allowed to do this", + "fr": "Vous n'êtes pas autorisé à faire cela" } } diff --git a/src/lib.rs b/src/lib.rs index c40852a..ba290e0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,6 +3,7 @@ //! [![Crates.io Version](https://img.shields.io/crates/v/internationalization.svg)](https://crates.io/crates/internationalization) //! ![LICENSE](https://img.shields.io/crates/l/internationalization) //! [![Coverage Status](https://coveralls.io/repos/github/terry90/internationalization-rs/badge.svg?branch=master)](https://coveralls.io/github/terry90/internationalization-rs?branch=master) +//! [![Build Status](https://travis-ci.org/terry90/internationalization-rs.svg?branch=master)](https://travis-ci.org/terry90/internationalization-rs) //! //! An simple compile time i18n implementation in Rust. //! It throws a compilation error if the translation key is not present, but since the `lang` argument is dynamic it will panic if the language has not been added for the matching key. @@ -31,9 +32,11 @@ //! Any number of languages can be added, but you should provide them for everything since it will panic if a language is not found when queried for a key. -//! In your app, jsut call the `t!` macro +//! In your app, just call the `t!` macro //! ```rust +//! use internationalization::t; +//! //! fn main() { //! let lang = "en"; //! let res = t!("err.not_allowed", lang); @@ -53,7 +56,7 @@ //! Then include it in your code like this: -//! ```rust +//! ```rust,ignore //! #[macro_use] //! extern crate internationalization; //! ```