Skip to content

Commit

Permalink
incr: change inferred lang to lang
Browse files Browse the repository at this point in the history
  • Loading branch information
LighghtEeloo committed Apr 17, 2024
1 parent 2db50db commit 8ead4e2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions scripts/refresh.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import os

if __name__ == "__main__":
with open("~/.zhistory", 'r') as f:
lines = [line for line in f.readlines() if line.startswith("ww ")]
print(lines)
4 changes: 2 additions & 2 deletions src/word.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub use backend::*;

pub trait Question {
fn word(&self) -> String;
fn inferred_lang(&self) -> Lang;
fn lang(&self) -> Lang;
}
pub trait Answer {
fn not_found(&self) -> bool;
Expand Down Expand Up @@ -61,7 +61,7 @@ impl Question for ExactQuery {
fn word(&self) -> String {
self.word.clone()
}
fn inferred_lang(&self) -> Lang {
fn lang(&self) -> Lang {
self.lang
}
}
2 changes: 1 addition & 1 deletion src/word/backend/youdict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl Select for Sen {
let trans_vec = extract_to_vec("No trans found in sentence");

let (ori, trans) = if matches!(
word_query.inferred_lang(),
word_query.lang(),
Lang::Cmn | Lang::Jpn | Lang::Kor
) {
(eastern_concat(ori_vec), western_concat(trans_vec))
Expand Down
2 changes: 1 addition & 1 deletion src/word/speech.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl Speech {
}

fn url(word_query: &impl Question) -> anyhow::Result<String> {
let lang = word_query.inferred_lang();
let lang = word_query.lang();
let code = match lang {
Lang::Eng => "en",
Lang::Fra => "fr",
Expand Down

0 comments on commit 8ead4e2

Please sign in to comment.