ropg / ezTime

ezTime — pronounced "Easy Time" — is a very easy to use Arduino time and date library that provides NTP network time lookups, extensive timezone support, formatted time and date strings, user events, millisecond precision and more.
MIT License
327 stars 92 forks source link

first internationalisation for German and Dutch #57

Closed koter84 closed 4 years ago

koter84 commented 4 years ago

I wanted to add Dutch to ezTime, and noticed that @Nalsai did this for German in his own fork, but since i don't really want to keep my fork, i figured i could make a pull-request for it, and while i'm at it add German as well.

Would you like to include something like this in the library?

I made it so that by defining EZTIME_LANG_DE before import it gives German days and months with EZTIME_LANG_NL it returns Dutch days and months and when neither is defined it stays on the default English.

Also i added the define for EZTIME_TWO_LETTER_DAY since in NL we only use 2 letters to abbreviate the weekdays, so by defining this before importing the library 'D' gives only 2 letters.

If you'd like to import this, i can also look at documenting the feature..

thanks for a very nice library, i'm just starting to work with it, and i'm already liking it very much, it really is ez :-)

ropg commented 4 years ago

Ha, wat grappig, ik schrijf een library en iemand anders maakt er Nederlands voor.... :)

Thanks!! I will merge this now, although I do worry that this will become unwieldy if and when many more languages are added. When I work on ezTime again I will probably change it so these functions are separated out and we can #include lang/eztime_nl.h or something similar and just have a directory full of small language files. Also, I think the define for two-letter days should be done automatically when EZTIME_LANG_NL is defined.

ropg commented 4 years ago

I changed it all around, there is now a EZTIME_LANGUAGE define, see commit dd966724816e3956fe84097c2cc6f03de6b518a4 . Please give that a try, I will release a new version later today so that the library matches the README again.

koter84 commented 4 years ago

Yeah, funny how things turn out sometimes... I'm not very skilled in the Arduino libraries, but the solution with different files seems a lot better.

ropg commented 4 years ago

Yeah, funny how things turn out sometimes... I'm not very skilled in the Arduino libraries, but the solution with different files seems a lot better.

Yeah, makes it much easier for people to do their own language if they want.