aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2018-12-25 18:29:02 +0100
committerHarald Eilertsen <haraldei@anduin.net>2018-12-25 18:29:02 +0100
commitebe4d4244c7cf716229d34c84def32742859d988 (patch)
treeed47c1d6a47e61edfcbe1bdad12d00d45a5a3186 /src
parentb1bd3488795a9e3788e26092452706205ecf2ee5 (diff)
downloadprimstav-ebe4d4244c7cf716229d34c84def32742859d988.tar.gz
primstav-ebe4d4244c7cf716229d34c84def32742859d988.tar.bz2
primstav-ebe4d4244c7cf716229d34c84def32742859d988.zip
Add locale::get() and make EN default locale.
Diffstat (limited to 'src')
-rw-r--r--src/locale.rs4
-rw-r--r--src/main.rs3
2 files changed, 6 insertions, 1 deletions
diff --git a/src/locale.rs b/src/locale.rs
index 6b3b619..1bd190b 100644
--- a/src/locale.rs
+++ b/src/locale.rs
@@ -33,6 +33,10 @@ impl Locale {
}
}
+pub fn get() -> &'static Locale {
+ &EN
+}
+
pub const EN: Locale = Locale {
weekdays: ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"],
months: ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"],
diff --git a/src/main.rs b/src/main.rs
index 8804dc7..a76b378 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -60,7 +60,8 @@ fn main() {
None => chrono::Local::today().naive_utc(),
};
- println!("{}", capitalize(&locale::NB.format_date(&local_date)));
+ let locale = locale::get();
+ println!("{}", capitalize(&locale.format_date(&local_date)));
let key = local_date.format("%d%m").to_string();
match data.get(serde_yaml::Value::Number(u32::from_str(&key).unwrap().into())) {