Skip to content

Commit

Permalink
Add Japanese language (#56)
Browse files Browse the repository at this point in the history
* Update lang.rs
* Update README.md
  • Loading branch information
tkna91 authored Jun 18, 2024
1 parent 81a8b7f commit 91736ec
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ For NixOS, use the [NixPkg](https://github.com/NixOS/nixpkgs/blob/master/pkgs/ap
- `--fahrenheit` - use fahrenheit instead of celsius
- `--mph` - use mph instead of km/h for wind speed
- `--custom-indicator STRING` - optional expression that will be shown instead of main indicator. current_conditions keys surrounded by {} can be used. For example, `"{ICON}{temp_C}({FeelsLikeC})"` will be transformed to `"text":"🌧️0(-4)"` in the output
- `--lang LANG` - set language (currently `en`, `de`, `pl`, `tr`, `fr`, `ru`, `zh`, `be`, `es`, `it` or `pt`; submit a PR to add yours)
- `--lang LANG` - set language (currently `en`, `de`, `pl`, `tr`, `fr`, `ru`, `zh`, `be`, `es`, `pt`, `it`, `ja`; submit a PR to add yours)

e.g. `wttrbar --date-format "%m/%d" --location Paris --hide-conditions`

Expand Down
16 changes: 16 additions & 0 deletions src/lang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub enum Lang {
ES,
PT,
IT,
JA,
}

impl Lang {
Expand All @@ -29,6 +30,7 @@ impl Lang {
Self::ES => "es.wttr.in".to_string(),
Self::PT => "pt.wttr.in".to_string(),
Self::IT => "it.wttr.in".to_string(),
Self::JA => "ja.wttr.in".to_string(),
}
}
pub fn feels_like(&self) -> String {
Expand All @@ -44,6 +46,7 @@ impl Lang {
Self::ES => "Sensación térmica".to_string(),
Self::PT => "Sensação térmica".to_string(),
Self::IT => "Sensazione Termica".to_string(),
Self::JA => "体感温度".to_string(),
}
}
pub fn humidity(&self) -> String {
Expand All @@ -59,6 +62,7 @@ impl Lang {
Self::ES => "Humedad".to_string(),
Self::PT => "Umidade".to_string(),
Self::IT => "Umidità".to_string(),
Self::JA => "湿度".to_string(),
}
}
pub fn location(&self) -> String {
Expand All @@ -74,6 +78,7 @@ impl Lang {
Self::ES => "Ubicación".to_string(),
Self::PT => "Localização".to_string(),
Self::IT => "Posizione".to_string(),
Self::JA => "地点".to_string(),
}
}
pub fn today(&self) -> String {
Expand All @@ -89,6 +94,7 @@ impl Lang {
Self::ES => "Hoy".to_string(),
Self::PT => "Hoje".to_string(),
Self::IT => "Oggi".to_string(),
Self::JA => "今日".to_string(),
}
}
pub fn tomorrow(&self) -> String {
Expand All @@ -104,6 +110,7 @@ impl Lang {
Self::ES => "Mañana".to_string(),
Self::PT => "Amanhã".to_string(),
Self::IT => "Domani".to_string(),
Self::JA => "明日".to_string(),
}
}
pub fn fog(&self) -> String {
Expand All @@ -119,6 +126,7 @@ impl Lang {
Self::ES => "Niebla".to_string(),
Self::PT => "Nevoeiro".to_string(),
Self::IT => "Nebbia".to_string(),
Self::JA => "霧".to_string(),
}
}
pub fn frost(&self) -> String {
Expand All @@ -134,6 +142,7 @@ impl Lang {
Self::ES => "Escarcha".to_string(),
Self::PT => "Geada".to_string(),
Self::IT => "Gelo".to_string(),
Self::JA => "霜".to_string(),
}
}
pub fn overcast(&self) -> String {
Expand All @@ -149,6 +158,7 @@ impl Lang {
Self::ES => "Nublado".to_string(),
Self::PT => "Nublado".to_string(),
Self::IT => "Nuvoloso".to_string(),
Self::JA => "曇り".to_string(),
}
}
pub fn rain(&self) -> String {
Expand All @@ -164,6 +174,7 @@ impl Lang {
Self::ES => "Lluvia".to_string(),
Self::PT => "Chuva".to_string(),
Self::IT => "Pioggia".to_string(),
Self::JA => "雨".to_string(),
}
}
pub fn snow(&self) -> String {
Expand All @@ -179,6 +190,7 @@ impl Lang {
Self::ES => "Nieve".to_string(),
Self::PT => "Neve".to_string(),
Self::IT => "Neve".to_string(),
Self::JA => "雪".to_string(),
}
}
pub fn sunshine(&self) -> String {
Expand All @@ -194,6 +206,7 @@ impl Lang {
Self::ES => "Soleado".to_string(),
Self::PT => "Sol".to_string(),
Self::IT => "Sole".to_string(),
Self::JA => "晴れ".to_string(),
}
}
pub fn thunder(&self) -> String {
Expand All @@ -209,6 +222,7 @@ impl Lang {
Self::ES => "Tormenta".to_string(),
Self::PT => "Trovão".to_string(),
Self::IT => "Tuono".to_string(),
Self::JA => "雷".to_string(),
}
}
pub fn wind(&self) -> String {
Expand All @@ -224,6 +238,7 @@ impl Lang {
Self::ES => "Viento".to_string(),
Self::PT => "Vento".to_string(),
Self::IT => "Vento".to_string(),
Self::JA => "風速".to_string(),
}
}
pub fn weather_desc(&self) -> String {
Expand All @@ -239,6 +254,7 @@ impl Lang {
Lang::ES => "lang_es".to_string(),
Lang::PT => "lang_pt".to_string(),
Lang::IT => "lang_it".to_string(),
Lang::JA => "lang_ja".to_string(),
}
}
}

0 comments on commit 91736ec

Please # to comment.