Skip to content
Snippets Groups Projects
Commit 5f5b5b09 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Make the Weekday and Month name abbreviations localizable via text.dat/ini

parent 15613b0d
No related branches found
No related tags found
No related merge requests found
Pipeline #6987 failed
...@@ -1062,3 +1062,22 @@ ...@@ -1062,3 +1062,22 @@
"\1n\1b[\1h\1wW\1n\1b] \1hWord-wrap Message Text \1n\1b: \1c%s\r\n" 875 QWKSettingsWrapText "\1n\1b[\1h\1wW\1n\1b] \1hWord-wrap Message Text \1n\1b: \1c%s\r\n" 875 QWKSettingsWrapText
"\1/Unknown uploader (%s) of file\1\\: %s" 876 UnknownUploader "\1/Unknown uploader (%s) of file\1\\: %s" 876 UnknownUploader
"FREE" 877 FREE "FREE" 877 FREE
"Sun" 878 Sun
"Mon" 879 Mon
"Tue" 880 Tue
"Wed" 881 Wed
"Thu" 882 Thu
"Fri" 883 Fri
"Sat" 884 Sat
"Jan" 885 Jan
"Feb" 886 Feb
"Mar" 887 Mar
"Apr" 888 Apr
"May" 889 May
"Jun" 890 Jun
"Jul" 891 Jul
"Aug" 892 Aug
"Sep" 893 Sep
"Oct" 894 Oct
"Nov" 895 Nov
"Dec" 896 Dec
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "date_str.h" #include "date_str.h"
#include "datewrap.h" #include "datewrap.h"
#include "text.h"
const char *wday[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; const char *wday[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
const char *mon[]={"Jan","Feb","Mar","Apr","May","Jun" const char *mon[]={"Jan","Feb","Mar","Apr","May","Jun"
...@@ -233,32 +234,34 @@ char* timestr(scfg_t* cfg, time32_t t, char* str) ...@@ -233,32 +234,34 @@ char* timestr(scfg_t* cfg, time32_t t, char* str)
uchar hour; uchar hour;
struct tm tm; struct tm tm;
time_t intime=t; time_t intime=t;
char** w = (cfg->text == NULL) ? (char**)wday : &cfg->text[Sun];
char** m = (cfg->text == NULL) ? (char**)mon : &cfg->text[Jan];
if(localtime_r(&intime,&tm)==NULL) { if(localtime_r(&intime,&tm)==NULL) {
strcpy(str,"Invalid Time"); strcpy(str,"Invalid Time");
return(str); return(str);
} }
if(cfg->sys_misc&SM_MILITARY) { if(cfg->sys_misc&SM_MILITARY) {
sprintf(str,"%s %s %02u %4u %02u:%02u:%02u" snprintf(str, LEN_DATETIME + 1, "%s %s %02u %4u %02u:%02u:%02u"
,wday[tm.tm_wday],mon[tm.tm_mon],tm.tm_mday,1900+tm.tm_year ,w[tm.tm_wday],m[tm.tm_mon],tm.tm_mday,1900+tm.tm_year
,tm.tm_hour,tm.tm_min,tm.tm_sec); ,tm.tm_hour,tm.tm_min,tm.tm_sec);
return(str); return(str);
} }
if(tm.tm_hour>=12) { if(tm.tm_hour>=12) {
if(tm.tm_hour==12) if(tm.tm_hour==12)
hour=12; hour=12;
else else
hour=tm.tm_hour-12; hour=tm.tm_hour-12;
mer="pm"; mer="pm";
} else { } else {
if(tm.tm_hour==0) if(tm.tm_hour==0)
hour=12; hour=12;
else else
hour=tm.tm_hour; hour=tm.tm_hour;
mer="am"; mer="am";
} }
sprintf(str,"%s %s %02u %4u %02u:%02u %s" snprintf(str, LEN_DATETIME + 1, "%s %s %02u %4u %02u:%02u %s"
,wday[tm.tm_wday],mon[tm.tm_mon],tm.tm_mday,1900+tm.tm_year ,w[tm.tm_wday],m[tm.tm_mon],tm.tm_mday,1900+tm.tm_year
,hour,tm.tm_min,mer); ,hour,tm.tm_min,mer);
return(str); return(str);
} }
......
...@@ -96,6 +96,9 @@ ...@@ -96,6 +96,9 @@
#define LEN_SIFNAME 8 /* Maximum length of SIF filename */ #define LEN_SIFNAME 8 /* Maximum length of SIF filename */
#define LEN_EXTCODE (LEN_CODE*2) /* Code prefix + suffix */ #define LEN_EXTCODE (LEN_CODE*2) /* Code prefix + suffix */
#define LEN_DATE 8
#define LEN_DATETIME 24
/* Lengths of various strings */ /* Lengths of various strings */
#define LEN_GSNAME 15 /* Group/Lib short name */ #define LEN_GSNAME 15 /* Group/Lib short name */
#define LEN_GLNAME 40 /* Group/Lib long name */ #define LEN_GLNAME 40 /* Group/Lib long name */
......
...@@ -894,6 +894,25 @@ enum text { ...@@ -894,6 +894,25 @@ enum text {
,QWKSettingsWrapText ,QWKSettingsWrapText
,UnknownUploader ,UnknownUploader
,FREE ,FREE
,Sun
,Mon
,Tue
,Wed
,Thu
,Fri
,Sat
,Jan
,Feb
,Mar
,Apr
,May
,Jun
,Jul
,Aug
,Sep
,Oct
,Nov
,Dec
,TOTAL_TEXT ,TOTAL_TEXT
}; };
......
...@@ -754,11 +754,11 @@ const char * const text_defaults[TOTAL_TEXT]={ ...@@ -754,11 +754,11 @@ const char * const text_defaults[TOTAL_TEXT]={
,"\x43\x68\x61\x6e\x67\x65\x20\x45\x78\x65\x6d\x70\x74\x69\x6f\x6e\x73" // 448 ChangeExemptionQ ,"\x43\x68\x61\x6e\x67\x65\x20\x45\x78\x65\x6d\x70\x74\x69\x6f\x6e\x73" // 448 ChangeExemptionQ
,"\x20\x20\x20\x20\x20\x20\x20\x20\x01\x6e\x25\x73\x0d\x0a\x54\x6f\x67\x67\x6c\x65\x3a\x20" // 449 FlagEditing ,"\x20\x20\x20\x20\x20\x20\x20\x20\x01\x6e\x25\x73\x0d\x0a\x54\x6f\x67\x67\x6c\x65\x3a\x20" // 449 FlagEditing
,"\x01\x5f\x01\x79\x01\x68\x47\x6f\x20\x74\x6f\x20\x4e\x61\x6d\x65\x20\x6f\x72\x20\x4e\x75\x6d\x62\x65\x72\x3a\x20\x01\x6e" // 450 GoToUser ,"\x01\x5f\x01\x79\x01\x68\x47\x6f\x20\x74\x6f\x20\x4e\x61\x6d\x65\x20\x6f\x72\x20\x4e\x75\x6d\x62\x65\x72\x3a\x20\x01\x6e" // 450 GoToUser
,"\x01\x5f\x01\x79\x01\x68\x4c\x61\x73\x74\x20\x6f\x6e\x3a\x20\x01\x77" // 451 UeditLastOn ,"\x01\x5f\x01\x79\x01\x68\x4c\x61\x73\x74\x20\x6f\x6e\x20\x28\x40\x44\x41\x54\x45\x46\x4d\x54\x40\x29\x3a\x20\x01\x77" // 451 UeditLastOn
,"\x01\x5f\x01\x79\x01\x68\x46\x69\x72\x73\x74\x20\x6f\x6e\x3a\x20\x01\x77" // 452 UeditFirstOn ,"\x01\x5f\x01\x79\x01\x68\x46\x69\x72\x73\x74\x20\x6f\x6e\x20\x28\x40\x44\x41\x54\x45\x46\x4d\x54\x40\x29\x3a\x20\x01\x77" // 452 UeditFirstOn
,"\x01\x5f\x01\x79\x01\x68\x45\x78\x70\x69\x72\x65\x3a\x20\x01\x77" // 453 UeditExpire ,"\x01\x5f\x01\x79\x01\x68\x45\x78\x70\x69\x72\x65\x20\x28\x40\x44\x41\x54\x45\x46\x4d\x54\x40\x29\x3a\x20\x01\x77" // 453 UeditExpire
,"\x01\x5f\x01\x79\x01\x68\x50\x61\x73\x73\x77\x6f\x72\x64\x20\x4c\x61\x73\x74\x20\x4d\x6f\x64\x69\x66\x69\x65\x64\x3a\x20\x01\x77" ,"\x01\x5f\x01\x79\x01\x68\x50\x61\x73\x73\x77\x6f\x72\x64\x20\x4c\x61\x73\x74\x20\x4d\x6f\x64\x69\x66\x69\x65\x64\x20\x28\x40\x44"
"" // 454 UeditPwModDate "\x41\x54\x45\x46\x4d\x54\x40\x29\x3a\x20\x01\x77" // 454 UeditPwModDate
,"\x01\x5f\x01\x79\x01\x68\x4c\x65\x76\x65\x6c\x3a\x20\x01\x77" // 455 UeditML ,"\x01\x5f\x01\x79\x01\x68\x4c\x65\x76\x65\x6c\x3a\x20\x01\x77" // 455 UeditML
,"\x01\x5f\x01\x79\x01\x68\x4e\x6f\x74\x65\x3a\x20\x01\x77" // 456 UeditNote ,"\x01\x5f\x01\x79\x01\x68\x4e\x6f\x74\x65\x3a\x20\x01\x77" // 456 UeditNote
,"\x01\x5f\x01\x79\x01\x68\x43\x6f\x6d\x6d\x65\x6e\x74\x3a\x20\x01\x77" // 457 UeditComment ,"\x01\x5f\x01\x79\x01\x68\x43\x6f\x6d\x6d\x65\x6e\x74\x3a\x20\x01\x77" // 457 UeditComment
...@@ -1437,4 +1437,23 @@ const char * const text_defaults[TOTAL_TEXT]={ ...@@ -1437,4 +1437,23 @@ const char * const text_defaults[TOTAL_TEXT]={
,"\x01\x2f\x55\x6e\x6b\x6e\x6f\x77\x6e\x20\x75\x70\x6c\x6f\x61\x64\x65\x72\x20\x28\x25\x73\x29\x20\x6f\x66\x20\x66\x69\x6c\x65\x01" ,"\x01\x2f\x55\x6e\x6b\x6e\x6f\x77\x6e\x20\x75\x70\x6c\x6f\x61\x64\x65\x72\x20\x28\x25\x73\x29\x20\x6f\x66\x20\x66\x69\x6c\x65\x01"
"\x5c\x3a\x20\x25\x73" // 876 UnknownUploader "\x5c\x3a\x20\x25\x73" // 876 UnknownUploader
,"\x46\x52\x45\x45" // 877 FREE ,"\x46\x52\x45\x45" // 877 FREE
,"\x53\x75\x6e" // 878 Sun
,"\x4d\x6f\x6e" // 879 Mon
,"\x54\x75\x65" // 880 Tue
,"\x57\x65\x64" // 881 Wed
,"\x54\x68\x75" // 882 Thu
,"\x46\x72\x69" // 883 Fri
,"\x53\x61\x74" // 884 Sat
,"\x4a\x61\x6e" // 885 Jan
,"\x46\x65\x62" // 886 Feb
,"\x4d\x61\x72" // 887 Mar
,"\x41\x70\x72" // 888 Apr
,"\x4d\x61\x79" // 889 May
,"\x4a\x75\x6e" // 890 Jun
,"\x4a\x75\x6c" // 891 Jul
,"\x41\x75\x67" // 892 Aug
,"\x53\x65\x70" // 893 Sep
,"\x4f\x63\x74" // 894 Oct
,"\x4e\x6f\x76" // 895 Nov
,"\x44\x65\x63" // 896 Dec
}; };
...@@ -878,4 +878,23 @@ const char* const text_id[]={ ...@@ -878,4 +878,23 @@ const char* const text_id[]={
,"QWKSettingsWrapText" ,"QWKSettingsWrapText"
,"UnknownUploader" ,"UnknownUploader"
,"FREE" ,"FREE"
,"Sun"
,"Mon"
,"Tue"
,"Wed"
,"Thu"
,"Fri"
,"Sat"
,"Jan"
,"Feb"
,"Mar"
,"Apr"
,"May"
,"Jun"
,"Jul"
,"Aug"
,"Sep"
,"Oct"
,"Nov"
,"Dec"
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment