willasm / obsidian-open-weather

Obsidian plugin for OpenWeather API
MIT License
47 stars 3 forks source link

Would it be possible to consider adding support for multiple languages? #6

Closed kickTiger closed 1 year ago

kickTiger commented 1 year ago

I have modified the display of the status bar to the corresponding language by performing the following steps:

1.Open the main.js file located in .obsidian\plugins\open-weather, and find the following code at around line 55:

let url = https://api.openweathermap.org/data/2.5/weather?q=${this.location}&lang=zh_cn&appid=${this.key}&units=${this.units};

2.Add &lang=zh_cn before&appid, and the status bar at the bottom will display in the corresponding language.

Suggestions:

You may want to consider adding a drop-down menu to the plugin's settings, giving users the option to display the weather information in their preferred language.

Currently, my modification only enables the status bar to appear in the selected language. I would like to suggest expanding this feature to also support the display of weather information in the chosen language.

Reference materials:

After reviewing the official documentation, it appears that the supported languages may include the following:"

&lang=zh_cn (Chinese Simplified) 
&lang=en (English) 
&lang=ru (Russian) 
&lang=it (Italian) 
&lang=es (Spanish) 
&lang=uk (Ukrainian) 
&lang=de (German) 
&lang=pt (Portuguese) 
&lang=ro (Romanian) 
&lang=pl (Polish) 
&lang=fi (Finnish) 
&lang=nl (Dutch) 
&lang=fr (French) 
&lang=bg (Bulgarian) 
&lang=sv (Swedish) 
&lang=zh_tw (Chinese Traditional) 
&lang=tr (Turkish) 
&lang=hr (Croatian) 
&lang=ca (Catalan)
&lang=ar (Arabic) 
&lang=cz(Czech) 
&lang =el(Greek) 
& lang =fa(Persian) 
& lang =gl(Galician) 
& lang =hu(Hungarian) 
& lang =ja(Japanese) 
& lang =kr(Korean)
willasm commented 1 year ago

Thanks again for another great suggestion. This will be added for sure. Should have this added this weekend.

willasm commented 1 year ago

Done. Languages are supported in release v1.4.0 which should be available shortly.

[1.4.0] 2022-03-18

Added