#![feature(decl_macro)]
pub mod locale;
pub use locale::Locale;
pub use fluent;
pub mod ftl;
#[derive(Copy, Clone, PartialEq)]
pub enum TextDirection {
Ltr,
Rtl,
}
pub trait HasTextDirection {
fn text_direction(&self) -> TextDirection;
}
impl HasTextDirection for locale::Locale {
fn text_direction(&self) -> TextDirection {
self.id.text_direction()
}
}
impl HasTextDirection for locale::LanguageIdentifier {
fn text_direction(&self) -> TextDirection {
match self.language.as_str() {
| "ar" | "ara"
| "arc"
| "az" | "aze"
| "dv" | "div"
| "he" | "heb"
| "ku" | "kur"
| "fa" | "per" | "fas"
| "ur" | "urd"
=> TextDirection::Rtl,
_ => TextDirection::Ltr,
}
}
}