Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of GetLangTime() usage #6

Open
orontee opened this issue Sep 17, 2023 · 0 comments
Open

Example of GetLangTime() usage #6

orontee opened this issue Sep 17, 2023 · 0 comments

Comments

@orontee
Copy link

orontee commented Sep 17, 2023

Hello, I am the author of taranis a weather application for Pocketbook e-readers.

The English in the GetLangTime() docstring isn't very precise... It would be nice to have an example of this function usage. Having dates printed in current language is a must have for serious applications...

An example of what I've tried: orontee/taranis#46 (comment)

Thanks!

/**
 * localized value by key should be in part of "strftime" format
 * return localized time in variable "buf" or empty string if "key" not found
 * return value "0" - ok
 * return value "-1" - no key found (key may be a format)
 * return value "-2" - not found any replacement of time format
 * return value "-3" - result not fit in buffer
 * return value "-100" - not supported format
 * Notice: function try to add "_12" to key if AM/PM time format turned on in settings
 * Requirments for keys:
 * "@TimeFormat" + <key_words1> + <options> + <key_words2> + <am.pm>
 * <options>:
 * "Date"/"SDate" - month name and month day number / short month name and month day number (ex. January/Jan)
 * "Time" - hours and minutes
 * "WDay"/"SWDay" - Week day name / short week day name (ex. Monday/Mon)
 * "Year" - year number
 * others - other options like "Seconds", "Month", "SMonth", "SMDay", etc
 * <key_words1>, <key_words2> - optional if need for detalize key
 * <am.pm> - if AM/PM time format turned on in settings, auto add "_12" in function.
 */
int GetLangTime(char *buf, int size, const char *key, struct tm *t);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant