schachmat / wego

weather app for the terminal
ISC License
7.81k stars 476 forks source link

Multilanguage support for frontend #75

Open ghost opened 8 years ago

ghost commented 8 years ago

Please add multilanguage support for your frontend. I was able to modify and compile ascii-art-table-.go to translate Morning/Noon/Evening/Night but I don't how to translatate dateFmt function.

schachmat commented 8 years ago

There is no possibility from the standard packages, the english weekday and month names are hardcoded. An external library would be needed. Would you mind sharing your changes if they are not just hardcoded replacements to the one language of your choice?

ghost commented 8 years ago

Yes I understand, I was trying to figure it out by myself. To make it consistent you would need to check a value of wwo-lang variable in .wegorc. Create a list of supported langugages, then validate the string against supported languages and if true it would return a reference to a dictionary with a proper translation, 7 days + 12 month is not that much :) Unless there is a way to interact with OS...

In the attachment times of the day in polish.

ascii-art-table.go.zip

schachmat commented 8 years ago

Hm, I don't think adding it to one frontend is a good idea, since it will not scale. However I can imagine a third kind of plugin just for common translations of the weather conditions, and time strings. The different frontends could use the desired languages translation plugin then to localize the output.

dolmen commented 8 years ago

The CLDR has day of week names. The i18n-dateformatter project may be helpful to use them (but I've not really dug into it).

schachmat commented 8 years ago

The project you mentioned does not seem fitting, since it requires the user to generate the code for his locale after installing which further complicates the installation process for new users. Also it does not support translations for the different times of day yet, which we would also want to use for the table headers.