1use crate::base::sample;
4use crate::locale::fetch_locale;
5
6pub fn famous_last_words() -> String {
8 fetch_locale("quotes.famous_last_words", "en")
9 .map(|v| sample(&v))
10 .unwrap_or_else(|| sample(FALLBACK_FAMOUS_LAST_WORDS).to_string())
11}
12
13pub fn motivational() -> String {
15 fetch_locale("quotes.motivational", "en")
16 .map(|v| sample(&v))
17 .unwrap_or_else(|| sample(FALLBACK_MOTIVATIONAL).to_string())
18}
19
20pub fn philosophical() -> String {
22 fetch_locale("quotes.philosophical", "en")
23 .map(|v| sample(&v))
24 .unwrap_or_else(|| sample(FALLBACK_PHILOSOPHICAL).to_string())
25}
26
27pub fn shakespeare() -> String {
29 fetch_locale("quotes.shakespeare", "en")
30 .map(|v| sample(&v))
31 .unwrap_or_else(|| sample(FALLBACK_SHAKESPEARE).to_string())
32}
33
34pub fn movie() -> String {
36 fetch_locale("quotes.movies", "en")
37 .map(|v| sample(&v))
38 .unwrap_or_else(|| sample(FALLBACK_MOVIES).to_string())
39}
40
41const FALLBACK_FAMOUS_LAST_WORDS: &[&str] = &[
43 "Et tu, Brute?",
44 "I have a dream.",
45 "That's one small step for man.",
46 "Mr. Watson, come here, I want you.",
47 "I only regret that I have but one life to lose for my country.",
48 "I think therefore I am.",
49 "To be or not to be.",
50];
51
52const FALLBACK_MOTIVATIONAL: &[&str] = &[
53 "The only way to do great work is to love what you do.",
54 "Be the change you wish to see in the world.",
55 "Success is not final, failure is not fatal.",
56 "Believe you can and you're halfway there.",
57 "The future belongs to those who believe in the beauty of their dreams.",
58 "It is during our darkest moments that we must focus to see the light.",
59];
60
61const FALLBACK_PHILOSOPHICAL: &[&str] = &[
62 "The unexamined life is not worth living.",
63 "We are what we repeatedly do.",
64 "The only true wisdom is in knowing you know nothing.",
65 "Man is condemned to be free.",
66 "Hell is other people.",
67 "I think, therefore I am.",
68];
69
70const FALLBACK_SHAKESPEARE: &[&str] = &[
71 "To be, or not to be, that is the question.",
72 "All the world's a stage.",
73 "Romeo, Romeo, wherefore art thou Romeo?",
74 "Something wicked this way comes.",
75 "We are such stuff as dreams are made on.",
76 "The course of true love never did run smooth.",
77];
78
79const FALLBACK_MOVIES: &[&str] = &[
80 "Here's looking at you, kid.",
81 "I'll be back.",
82 "May the Force be with you.",
83 "There's no place like home.",
84 "You can't handle the truth!",
85 "Life is like a box of chocolates.",
86 "I see dead people.",
87];
88
89#[cfg(test)]
90mod tests {
91 use super::*;
92
93 #[test]
94 fn test_famous_last_words() {
95 assert!(!famous_last_words().is_empty());
96 }
97
98 #[test]
99 fn test_motivational() {
100 assert!(!motivational().is_empty());
101 }
102
103 #[test]
104 fn test_philosophical() {
105 assert!(!philosophical().is_empty());
106 }
107
108 #[test]
109 fn test_shakespeare() {
110 assert!(!shakespeare().is_empty());
111 }
112
113 #[test]
114 fn test_movie() {
115 assert!(!movie().is_empty());
116 }
117}